- 创建数据库的语法为: (分数: 1)
A create database tb_name;
B show databases;
C use database;
D drop database tb_name;
- 假设电话号码不超过15位, 用哪种格式的数据类型来存储数据最为合适? (分数: 1)
A char(15)
B varchar(15)
C int
D decimal(15,0)
- 删除数据库的SQL语句: (分数: 1)
A create database
B alter database
C drop database
D delete database
- 修改表结构的SQL语句: (分数: 1)
A alter table
B create table
C update table
D insert table
- 要消除返回结果集中的重复记录, 应该使用哪个关键字? (分数: 1)
A top
B count
C distinct
D desc
- 查询工资在1500元到2000元之间, 正确的表达式为: (分数: 1)
A >= 1500 or <= 2000
B 1500 and 2000
C between 1500 and 2000
D between >= 1500 and 2000
- 下面哪个函数可以计算平均值__ (分数: 1)
A sum
B avg
C count
D min
- select 语句中, 可以和having子句同时使用的, 是哪个子句? (分数: 1)
A order by
B where
C group by
D 以上都不是
- "select * from stuinfo where stuno __ (select stuno from stumarks);",SQL语句横线处, 需要填入的字符为: (分数: 1)
A <=
B in
C like
D >=
- 在SELECT语句中使用CEILING(属性名)时,属性名__ (分数: 1)
A 建议是整数型
B 建议是字符型
C 建议是小数类型
D 建议是日期类型
- 下列哪个函数, 可以四舍五入? (分数: 1)
A rand( )
B replace( )
C round( )
D insert( )
- 已知变量a="一个坚定的人只会说yes不会说no",下列截取"yes"的操作正确的语法是__ (分数: 1)
A RIGHT(LEFT(a,21),4)
B RIGHT(LEFT(a,12),3)
C RIGHT(LEFT(a,20),3)
D SUBSTRING(a,19,3)
- 要让结果降序排列,应使用____关键字 (分数: 1)
A asc
B count
C distinct
D desc
- 下列哪个函数可以获得最小值__ (分数: 1)
A sum
B avg
C count
D min
- 下列设置的查询"工资"不在(注意是不在)1500元到2000元之间的sql语句是__ (分数: 1)
A >= 1500 or <=2000
B >= 1500 and <= 2000
C < 1500 or > 2000
D < 1500 and > 2000
- 下面关于自连接和子查询, 说法有误的是__ (分数: 1)
A 子查询意味着,查询语句中嵌套了查询语句
B 自连接时, 无需为表起别名
C =any 和 in ( ) 操作的结果是一样的
D 没有 = all 的子查询
- select,where,having,group by如果出现在同一个语句中,顺序应该是__ (分数: 1)
A select group by where having
B select group by having where
C select where group by having
D select having group by where
- decimal(10,5)表示数值中共有 __位整数, ___ 位小数. (分数: 1)
A 10,5
B 5,5
C 15,5
D 5,10
- 删除表中的所有记录, 可以使用 ___ 语句. (分数: 1)
A drop
B delete
C remove
D clear
- sql语句'select 99%66;'的结果: __ (分数: 1)
A 1
B 33
C 66
D 99
- 使用 ___ 函数, 获取当前的mysql数据库的版本 (分数: 1)
A version( )
B user( )
C database( )
D charset( )
- sql语句'select 99/66;'的结果: (分数: 1)
A 1
B 33
C 66
D 99
- sql语句'select round(99/66);'的结果: __ (分数: 1)
A 1
B 2
C 3
D 0
- sql语句'select floor(99/66);'的结果: __ (分数: 1)
A 1
B 2
C 3
D 0
- sql语句"select left('abcdefghijklmn',3);"的结果: __ (分数: 1)
A abc
B bcd
C lmn
D klm
- sql语句"select concat('hello','world','!');"的结果: __ (分数: 1)
A hello world !
B helloworld!
C hello world!
D helloworld !
- sql语句"select right('abcdefghijklmn',4);"的结果: __ (分数: 1)
A abcd
B bcde
C klmn
D jklm
- sql语句"select substring('abcdefghijklmn',5,4);"的结果: __ (分数: 1)
A efgh
B fghi
C ghij
D hijk
- sql语句"select year(now());"的结果: __ (分数: 1)
A 2019
B 3
C 29
D 都不对
- sql语句"select date_add('2007-09-08',interval 1 week);"的结果: __ (分数: 1)
A 2007-10-08
B 2008-09-08
C 2007-09-15
D 2008-10-08
- sql语句"select datediff('2007-09-08','2007-10-01');"的结果: __ (分数: 1)
A 23
B -23
C 24
D -24
- sql语句"select date_sub('2007-09-08',interval 1 year);"的结果: __ (分数: 1)
A 2006-09-08
B 2007-08-08
C 2007-09-07
D 都不对
- sql语句"select sqrt(4);"的结果: __ (分数: 1)
A 2
B 16
C 4
D 1
- sql语句"select rand() = rand();"的结果: __ (分数: 1)
A rand()
B 1
C 0
D 都不对
- sql语句"select pow(2,3);"的结果: __ (分数: 1)
A 8
B 6
C 9
D 5
- 查询工资不在1500~2000之间的教师号、姓名及职称。以下语句, 正确的是:__ (分数: 1)
A select tid,tname,title from teacher where salary <= 1500 and salary >= 2000;
B select tid,tname,title from teacher where salary <= 1500 or salary >= 2000;
C select tid,tname,title from teacher where salary >= 1500 and salary <= 2000;
D select tid,tname,title from teacher where salary >= 1500 or salary <= 2000;
- 下列哪个字符集不支持中文? (分数: 1)
A gbk
B gb2312
C utf8
D latin1
- 从表 bookinfo中查询书的名称和单价,使书的单价精确到个位即可。 (分数: 1)
A select bookname,floor(bookprice) from bookinfo;
B select bookname,sum(bookprice) from bookinfo;
C select bookname,rand(bookprice) from bookinfo;
D select bookname,bookprice from bookinfo;
- 从 bookinfo表中查询所有以“ Processing”结尾的书名、数量以及单价信息。 (分数: 1)
A select bookname,booksum,bookprice from bookinfo where bookname regexp '$Processing';
B select bookname,booksum,bookprice from bookinfo where bookname regexp '^Processing';
C select bookname,booksum,bookprice from bookinfo where bookname like '%Processing';
D select bookname,booksum,bookprice from bookinfo where bookname like '%Processing_';
- 查询愚人节是今年的第几天 (分数: 1)
A select date('2019-04-01');
B select dateofyear('2019-04-01');
C select day('2019-04-01');
D select dayofyear('2019-04-01');
- 查询'2019-04-04' 之后一个星期是几号 (分数: 1)
A select date_add('2019-04-04', 7 days);
B select date_add('2019-04-04', 7 day);
C select date_add('2019-04-04', interval 1 week);
D select date_add('2019-04-04', char 1 week);
- 查询选修课程号‘C3’的学号和成绩。 (分数: 1)
A select sid,score from scourse where cid == 'C3';
B select sid,score from scourse where cid = 'C3';
C select sid,score from scourse where cid in 'C3';
D select sid,score from scourse where cid is 'C3';
- 查询成绩高于85分的学生的学号、课程号和成绩。 (分数: 1)
A select sid,cid,score from scourse having score >= 85;
B select sid,cid,score from scourse having score > 85;
C select sid,cid,score from scourse where score >= 85;
D select sid,cid,score from scourse where score > 85;
- 查询没有选修C1,也没有选修C2的学生学号、课程号和成绩。 (分数: 1)
A select sid,cid,score from scourse where cid not is 'C1' or cid not is 'C2';
B select sid,cid,score from scourse where cid not is 'C1' and cid not is 'C2';
C select sid,cid,score from scourse where cid != 'C1' or cid != 'C2';
D select sid,cid,score from scourse where cid != 'C1' and cid != 'C2';
- 查询工资在1500~2000之间的教师的教师号、姓名及职称。 (分数: 1)
A select salary,tid,tname,title from teacher where 1500 <= salary <= 2000;
B select salary,tid,tname,title from teacher where salary in(1500, 2000);
C select salary,tid,tname,title from teacher where salary between 1500, 2000;
D select salary,tid,tname,title from teacher where salary between 1500 and 2000;
- 查询所有姓张的教师的教师号和姓名。 (分数: 1)
A select tid,tname from teacher where tname regexp '张$';
B select tid,tname from teacher where tname like '张%';
C select tid,tname from teacher where tname like '张__';
D select tid,tname from teacher where tname like '张_';
- 查询选修C1或C2的学生的学号、课程号和成绩。哪句不正确? (分数: 1)
A select sid,cid,score from scourse where cid >= 'C1' and cid <= 'C2';
B select sid,cid,score from scourse where cid is 'C1' or cid is 'C2';
C select sid,cid,score from scourse where cid between 'C1' and 'C2';
D select sid,cid,score from scourse where cid in ('C1','C2');
- 查询选修C1的学生学号和成绩,并按成绩降序排列。 (分数: 1)
A select sid,score from student where cid = 'C1' order by score desc;
B select sid,score from student where cid = 'C1' order by score asc;
C select sid,score from student where cid = 'C1' order by score;
D select sid,score from student where cid = 'C1';
- 查询计算机系学生的总数。 (分数: 1)
A select count(\*) from student where dept = '计算机系';
B select sum(\*) from student where dept = '计算机系';
C select count(\*) from student where dept is '计算机系';
D select sum(\*) from student where dept is '计算机系';
- 查询选修C1的学生学号和成绩,并显示成绩前3名的学生。 (分数: 1)
A select \* from student order by score desc limit 1,3;
B select \* from student order by score asc limit 1,3;
C select \* from student order by score desc limit 0,3;
D select \* from student order by score asc limit 0,3;
- show database engines; 可以查看数据库引擎 (分数: 1)
对
错
- 数据库有三大范式 (分数: 1)
对
错
- mysql 5.7 的默认字符集是utf8 (分数: 1)
对
错
- delete table user; 可以删除user表 (分数: 1)
对
错
- delete library; 会删除library数据库 (分数: 1)
对
错
- 如果把一个字段设置成int(20), 表示该字段只能保存长度为20位的数字 (分数: 1)
对
错
- not null, 可以设置字段的非空属性 (分数: 1)
对
错
- InnoDB支持事务,而MyISAM不支持事务 (分数: 1)
对
错
- memory存储引擎, 把数据存到了内存里, 所以查询数据会很快 (分数: 1)
对
错
- utf8字符集支持中文 (分数: 1)
对
错
- primary key 表示该列为主键 (分数: 1)
对
错
- 一个表可以有多个外键 (分数: 1)
对
错
- 一个表可以有多个主键 (分数: 1)
对
错
- 主键可以为空 (分数: 1)
对
错
- 主键可以重复 (分数: 1)
对
错
- 主键可以设置成字符串类型 (分数: 1)
对
错
- 删除主键表之前, 需要先删除外键约束 (分数: 1)
对
错
- 数据库, 数据表, 数据字段的字符集可以各不相同 (分数: 1)
对
错
- show databases; 可以查看当前正在使用的数据库 (分数: 1)
对
错
- 无符号的tinyint, 取值范围为0~255 (分数: 1)
对
错
- 如果一个表的主键是另外一个表的外键, 那么这个主键字段和另一个表的外键字段, 名称必须一致 (分数: 1)
对
错
- rename table user1 to user2; 可以把用户表user1重命名为user2 (分数: 1)
对
错
- 一条insert语句可以插入多行数据 (分数: 1)
对
错
- 数据库的删除操作, 无法撤销 (分数: 1)
对
错
- 左连接属于内连接 (分数: 1)
对
错
- 为字段建立别名, 必须使用as (分数: 1)
对
错
- 只能为字段建立别名, 不能给数据表建立别名 (分数: 1)
对
错
- inner join 中的inner可以省略 (分数: 1)
对
错
- left join 和 left outer join 一样 (分数: 1)
对
错
- mysql可以使用 full join (分数: 1)
对
错
- > any 是大于最大的 (分数: 1)
对
错
- < any 是小于最小的 (分数: 1)
对
错
- 在mysql, 如果重复就会报错, 包括数据库重复, 数据表重复, 和字段重复 (分数: 1)
对
错
- 主键必须是int类型 (分数: 1)
对
错
- 外键必须是int类型 (分数: 1)
对
错
- tinyint(1), 表示该字段只能填入, 0,1,2,3,4,5,6,7,8,9 (分数: 1)
对
错
- A表中有3条记录, B表中有5条记录, 那么 A cross jion B之后的结果是8条记录 (分数: 1)
对
错
- 为字段起别名时, as 关键字不可省略 (分数: 1)
对
错
- 为数据表起别名时, 别名中不可以带空格 (分数: 1)
对
错
- having语句和where语句, 不能同时出现 (分数: 1)
对
错
- sql语句中如果牵涉到具体日期, 需要使用引号 (分数: 1)
对
错
- 一张表中如果没有外键, 则不能和其他表相连 (分数: 1)
对
错
- mysql的regexp, 可以使用[0~9]来表示0,1,2,3,4,5,6,7,8,9 (分数: 1)
对
错
- <> 和 = 的效果是一样的 (分数: 1)
对
错
- not 的优先级 比 and 高 (分数: 1)
对
错
- trim可以去除字符串中的所有空格 (分数: 1)
对
错
- * 的优先级 比 = 高 (分数: 1)
对
错
- substring函数的作用是截取字符串 (分数: 1)
对
错
- truncate(3.14159,4)的结果是: 3.1416 (分数: 1)
对
错
- 作者很帅! (分数: 1)
对
错
如需答案请私信 ^_^