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
廣告