- 相關(guān)推薦
2016計算機二級MYSQL數(shù)據(jù)庫模擬習題及答案
模擬訓練是為了讓考生提前熟悉考試流程和考試題型,可以讓考生提前適應考試的環(huán)境。以下是百分網(wǎng)小編為大家整理的2016計算機二級MYSQL數(shù)據(jù)庫模擬習題及答案,希望對大家有幫助!
(一)單選題
1) SQL 2005 的字符串連接運算符是什么?
A &
B .
C +
D _
2) SQL 2005中的比較運算符 不等于 有幾種表示方法?
A 1
B 2
C 3
D 4
3) !<在 SQL 2005中的含義是:
A 不等于
B 不小于
C 不大于
D 取反
4) 哪個是正確的小于等于號?
A >=
B =>
C <=
D =<
5) select substring(’長江長城黃山黃河’,2,2) 返回的是什么?
A 長江
B 江長
C 長城
D 長江長城
6) varchar 類型的數(shù)據(jù)長度默認是__個字節(jié)?
A 1
B 2
C 4
D 8000
7) 若student 表中有一字段s_fenshu,數(shù)據(jù)類型為整型,保存每個學生的考試成績,求全班平均分的正確做法是:
A 把每個學生的 s_fenshu 手工進行相加,然后除以全班人數(shù),得到平均分
B 使用 select avg(s_fenshu) from student
C 使用 select sum(s_fenshu) from student / select count(*) from student
D 使用 select sum(s_fenshu) from student % select count(*) from student
8) 100/3 的結(jié)果是:
A 33.33
B 33.333333
C 33
D 無法執(zhí)行
9) 哪些是正確的 like 運算表達式?
A select * from net_46 where s_name like ’#曉#’
B select * from net_46 where s_name like ’&曉&’
C select * from net_46 where s_name like ’$曉$’
D select * from net_46 where s_name like ’%曉%’
10) 以下的數(shù)據(jù)庫中,哪個是大型的數(shù)據(jù)庫?
A MySql
B DB2
C Oracle
D MS Sql 2005
參考答案:CBBCB ABCDC
(二)代碼題
1) 寫代碼創(chuàng)建student數(shù)據(jù)庫 (滿分10)
數(shù)據(jù)庫里建立數(shù)據(jù)表student_web
要求包含以下字段:
s_id 數(shù)據(jù)類型為整型,非空約束,
s_name 數(shù)據(jù)類型為可變字符型,最大長度12個字符,保存學生姓名
s_fenshu 數(shù)據(jù)類型為整型,
保存學生考試成績
s_hometown 數(shù)據(jù)類型為可變字符型,最大長度50個字符 保存學生籍貫
s_tuition 數(shù)據(jù)類型為整型
保存學生學費
2)寫代碼 向上題所創(chuàng)建好的數(shù)據(jù)表中添加以下三條記錄,(滿分9)
id : 1 id : 2 id : 3
姓名: Jack Tomas 姓名: Tom Joe 姓名: Smiths
成績: 89 成績: 88 成績: 87
籍貫: 北京豐臺 籍貫: 天津南開 籍貫: 北京海濱
學費: 2800 學費: 3000 學費: 2700
3)寫代碼 返回所有學生的信息 (滿分3)
4)寫代碼 返回所有姓名帶J字母的學生信息!(滿分5)
5)寫代碼 返回所有北京籍貫的學生信息 (滿分5)
6)寫代碼 返回所有學費低于平均學費的學生信息。提示使用嵌套的select查詢 (滿分8)
代碼答案:(如下)
1)
create database student
use student
create table student_web
(
s_id int not null,
s_name varchar(12),
s_fenshu int,
s_hometown varchar(50),
s_tuition int
)
2)
insert into student_web (s_id,s_name,s_fenshu,s_hometown,s_tuition)
values(1,’Jacktomas’,89,’北京豐臺’,2800)
insert into student_web (s_id,s_name,s_fenshu,s_hometown,s_tuition)
values(1,’TomJoe’,88,’天津南開’,3000)
insert into student_web (s_id,s_name,s_fenshu,s_hometown,s_tuition)
values(1,’Smiths’,87,’北京海濱’,2700)
3)
select * from student_web
4)
select * from student_web where s_name like ’%J%’
5)
select * from student_web where s_hometown=’北京%’
6)
select * from student_web where s_tuition<(select avg(s_tuition) from s_tuition)
【計算機二級MYSQL數(shù)據(jù)庫模擬習題及答案】相關(guān)文章:
2022計算機二級《MySQL數(shù)據(jù)庫》考點習題與答案07-10
2017計算機二級mysql數(shù)據(jù)庫模擬題及答案09-17
2017計算機二級mysql數(shù)據(jù)庫復習題及答案08-25
2016計算機二級《MySQL數(shù)據(jù)庫》練習題與答案09-21
全國計算機二級mysql數(shù)據(jù)庫模擬試題及答案11-05
計算機二級mysql數(shù)據(jù)庫模擬試題10-17
2017年計算機二級mysql數(shù)據(jù)庫備考習題及答案07-24