sql语句面试题及答案2020
姓名:____________________
一、选择题(每题2分,共20分)
1.下列关于SQL语句的描述,错误的是:
A.SQL是一种关系型数据库查询语言
B.SQL语句可以用来创建、查询、更新和删除数据库中的数据
C.SQL语句只能用于数据库查询
D.SQL语句可以用来执行数据定义和数据控制操作
2.下列哪个SQL语句可以创建一个名为“Students”的表,包含“id”和“name”两个字段?
A.CREATETABLEStudents(idINT,nameVARCHAR(50));
B.CREATETABLEStudents(idINT,nameVARCHAR(50),idINT);
C.CREATETABLEStudents(nameVARCHAR(50),idINT);
D.CREATETABLEStudents(idINT,nameVARCHAR(50),idINT,nameVARCHAR(50));
3.下列哪个SQL语句可以查询“Students”表中所有学生的姓名?
A.SELECTnameFROMStudents;
B.SELECTStudents.nameFROMStudents;
C.SELECT*FROMStudentsWHEREname;
D.SELECT*FROMStudentsWHEREnameISNOTNULL;
4.下列哪个SQL语句可以删除“Students”表中所有学生的记录?
A.DELETEFROMStudents;
B.DELETEFROMStudentsWHEREid0;
C.DELETE*FROMStudents;
D.DELETEStudents;
5.下列哪个SQL语句可以修改“Students”表中学生的姓名为“Tom”?
A.UPDATEStudentsSETname=Tom;
B.UPDATEStudentsSETname=TomWHEREid0;
C.UPDATEStudentsWHEREname=TomSETname=Tom;
D.UPDATEStudentsSETname=TomWHEREname=Tom;
6.下列哪个SQL语句可以查询“Students”表中年龄大于18岁的学生姓名?
A.SELECTnameFROMStudentsWHEREage18;
B.SELECTnameFROMStudentsWHEREage18ORDERBYage;
C.SELECTnameFROMStudentsWHEREage18GROUPBYname;
D.SELECTnameFROMStudentsWHEREage18HAVINGage18;
7.下列哪个SQL语句可以创建一个名为“Books”的表,包含“id”和“title”两个字段?
A.CREATETABLEBooks(idINT,titleVARCHAR(100));
B.CREATETABLEBooks(idINT,titleVARCHAR(100),idINT);
C.CREATETABLEBooks(titleVARCHAR(100),idINT);
D.CREATETABLEBooks(idINT,titleVARCHAR(100),idINT,titleVARCHAR(100));
8.下列哪个SQL语句可以查询“Books”表中所有书籍的标题?
A.SELECTtitleFROMBooks;
B.SELECTBooks.titleFROMBooks;
C.SELECT*FROMBooksWHEREtitle;
D.SELECT*FROMBooksWHEREtitleISNOTNULL;
9.下列哪个SQL语句可以删除“Books”表中所有书籍的记录?
A.DELETEFROMBooks;
B.DELETEFROMBooksWHEREid0;
C.DELETE*FROMBooks;
D.DELETEBooks;
10.下列哪个SQL语句可以修改“Books”表中书籍的标题为“SQL基础教程”?
A.UPDATEBooksSETtitle=SQL基础教程;
B.UPDATEBooksSETtitl