SQL 模拟测试


本节为您提供与SQL 框架相关的各种模拟测试。您可以将这些示例模拟测试下载到本地计算机,并在方便时离线解答。每个模拟测试都附带一个答案,以便您验证最终分数并进行自我评分。

问答

SQL 模拟测试一

题 2 - 考虑以下模式:

STUDENTS(student_code, first_name, last_name, email, 
         phone_no, date_of_birth, honours_subject, percentage_of_marks);

以下哪个查询将显示学生的全名,列标题为“姓名”?

A - select first_name, last_name as “Name” from students;

B - select Name from students;

C - select first_name || last_name as “Name” from students;

D - select first_name, last_name from students;

答案:C

题 3 - 考虑以下模式:

STUDENTS(student_code, first_name, last_name, email, 
         phone_no, date_of_birth, honours_subject, percentage_of_marks);

以下哪个查询将显示 STUDENTS 表中不同的荣誉科目?

A - select honours_subject from students;

B - select distinct honours_subject from students;

C - select all honours_subject from students;

D - select * from students;

答案:B

答案:A

题 5 - 考虑以下模式:

STUDENTS(student_code, first_name, last_name, email, 
         phone_no, date_of_birth, honours_subject, percentage_of_marks);

以下哪个查询将显示所有名字以“A”开头的学生?

A - select first_name from students where first_name like ‘A%’;

B - select first_name from students where first_name like ‘%A’;

C - select first_name from students where first_name like ‘%A%’;

D - select first_name from students where first_name like ‘A’;

答案:A

题 6 - 考虑以下模式:

STUDENTS(student_code, first_name, last_name, email, 
         phone_no, date_of_birth, honours_subject, percentage_of_marks);

以下哪个查询将显示名字第二个字母是“i”的所有学生?

A - select first_name from students where first_name like ‘_i%’;

B - select first_name from students where first_name like ‘%i_’;

C - select first_name from students where first_name like ‘%i%’;

D - select first_name from students where first_name like ‘_i_’;

答案:A

题 7 - 考虑以下模式:

STUDENTS(student_code, first_name, last_name, email, 
         phone_no, date_of_birth, honours_subject, percentage_of_marks);

以下哪个查询将显示所有未提供电子邮件地址的学生姓名?

A - select first_name, last name from students where email = 0;

B - select first_name, last name from students where email = ‘ ’;

C - select first_name, last name from students where email is null;

D - select first_name, last name from students where email = ‘null’;

答案:C

Q 14 - 以下哪个不是字符操作函数?

A - concat

B - substr

C - instr

D - coalesce

答案:D

Q 15 - INSTR('TUTORIALS POINT', 'P') 返回什么?

A - 11

B - 10

C - POINT

D - TUTORIALS

答案:A

Q 16 - SUBSTR('TUTORIALS POINT', 1, 9) 返回什么?

A - TUTORIAL

B - POINT

C - TUTORIALS

D - UTORIALS

答案:C

Q 17 - SUBSTR('TUTORIALS POINT', -1, 1) 返回什么?

A - T

B - NULL

C - 0

D - N

答案:A

Q 18 - ROUND(789.8389, 2) 返回什么?

A - 789.84

B - 789.83

C - 78

D - 789.00

答案:A

Q 19 - TRUNC(789.8389, 2) 返回什么?

A - 789.84

B - 789.83

C - 78

D - 789.00

答案:B

Q 20 - MOD(1000,30) 返回什么?

A - 33

B - 30

C - 3

D - 10

答案:D

Q 21 - 考虑以下模式:

STUDENTS(student_code, first_name, last_name, email, 
         phone_no, date_of_birth, honours_subject, percentage_of_marks);

哪个查询将显示所有学生的姓名和荣誉科目,如果学生尚未获得荣誉科目,则应显示“尚未获得荣誉”?

A - 从 students 表中选择 first_name、last_name、nvl(honours_subject, '尚未获得荣誉');

B - 从 students 表中选择 first_name、last_name、nvl2(honours_subject, '尚未获得荣誉');

C - 从 students 表中选择 first_name、last_name、honours_subject;

D - 从 students 表中选择 first_name、last_name、nullif(honours_subject, '尚未获得荣誉');

答案:A

Q 22 - 你想计算某个组织员工应缴纳的税款。如果员工获得佣金,则税款将根据佣金加薪水计算;如果员工没有获得任何佣金,则税款将仅根据薪水计算。你应该使用哪个函数来计算税款?

A - NVL

B - NVL2

C - NULLIF

D - COALESCE

答案:B

Q 23 - 对于某些特定作业,你需要比较两个值,如果两者相等,则结果为 null,如果值不相等,则返回第一个值。你应该使用哪个函数?

A - NVL

B - NVL2

C - NULLIF

D - COALESCE

答案:C

答案表

题号 答案
1 D
2 C
3 B
4 A
5 A
6 A
7 C
8 A
9 B
10 C
11 A
12 D
13 C
14 D
15 A
16 C
17 A
18 A
19 B
20 D
21 A
22 B
23 C
24 C
25 A
sql_questions_answers.htm
广告