https://www.w3schools.com/sql/sql_quiz.asp
SQL Quiz(共 25 題):
第 1 題:
■SQL 代表什麼?
What does SQL stand for?
▶Strong Question Language
▶Structured Question Language
✔▶Structured Query Language
第 2 題:
■哪條 SQL 語句用於從數據庫中提取數據?
Which SQL statement is used to extract data from a database?
▶EXTRACT
✔▶SELECT
▶OPEN
▶GET
第 3 題
■哪個 SQL 語句用於更新數據庫中
Which SQL statement is used to update data in a database?
▶SAVE AS
▶MODIFY
▶SAVE
✔▶UPDATE
第 4 題
■哪條 SQL 語句用於從數據庫中刪除數據?
Which SQL statement is used to delete data from a database?
✔▶DELETE
▶REMOVE
▶COLLAPSE
第 5 題
■哪條 SQL 語句用於在數據庫中插入新數據?
Which SQL statement is used to insert new data in a database?
▶ADD NEW
▶ADD RECORD
▶INSERT NEW
✔▶INSERT INTO
第 6 題:
■使用 SQL,如何從名為“Persons”的表中選擇名為“FirstName”的欄位?
With SQL, how do you select a column named "FirstName" from a table named "Persons"?
✔▶SELECT FirstName FROM Persons
▶SELECT Persons.FirstName
▶EXTRACT FirstName FROM Persons
第 7 題:
■使用 SQL,如何從名為“Persons”的表中選擇所有欄位?
With SQL, how do you select all the columns from a table named "Persons"?
▶SELECT Persons
▶SELECT [all] FROM Persons
✔▶SELECT * FROM Persons
▶SELECT *.Persons
第 8 題:
■使用 SQL,如何從名為“Persons”的表中選擇所有記錄,其中“FirstName”欄位的值為“Peter”?
With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" is "Peter"?
✔▶SELECT * FROM Persons WHERE FirstName='Peter'
▶SELECT * FROM Persons WHERE FirstName<>'Peter'
▶SELECT [all] FROM Persons WHERE FirstName LIKE 'Peter'
▶SELECT [all] FROM Persons WHERE FirstName='Peter'
第 9 題:
■使用 SQL,如何從名為“Persons”的表中選擇所有記錄,其中“FirstName”列的值以“a”開頭?
With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" starts with an "a"?
✔▶SELECT * FROM Persons WHERE FirstName LIKE 'a%'
▶SELECT * FROM Persons WHERE FirstName='%a%'
▶SELECT * FROM Persons WHERE FirstName LIKE '%a'
▶SELECT * FROM Persons WHERE FirstName='a'
第 10 題:
■如果列出的任何條件為真,OR 運算符將顯示一條記錄。如果列出的所有條件都為真,AND 運算符會顯示一條記錄
The OR operator displays a record if ANY conditions listed are true. The AND operator displays a record if ALL of the conditions listed are true
▶False
✔▶True
第 11 題:
■使用 SQL,如何從名為“Persons”的表中選擇所有記錄,其中“FirstName”為“Peter”,“LastName”為“Jackson”?
With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jackson"?
✔▶SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson'
▶SELECT FirstName='Peter', LastName='Jackson' FROM Persons
▶SELECT * FROM Persons WHERE FirstName<>'Peter' AND LastName<>'Jackson'
第 12 題:
■使用 SQL,如何從名為“Persons”的表中選擇所有記錄,其中“LastName”按字母順序介於(包括)“Hansen”和“Pettersen”之間?
With SQL, how do you select all the records from a table named "Persons" where the "LastName" is alphabetically between (and including) "Hansen" and "Pettersen"?
▶SELECT LastName>'Hansen' AND LastName<'Pettersen' FROM Persons ▶SELECT * FROM Persons WHERE LastName>'Hansen' AND LastName<'Pettersen'
✔▶SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen'
第 13 題:
■哪個 SQL 語句用於只返回不同的值?
Which SQL statement is used to return only different values?
✔▶SELECT DISTINCT
▶SELECT UNIQUE
▶SELECT DIFFERENT
第 14 題:
■哪個 SQL 關鍵字用於對結果集進行排序?
Which SQL keyword is used to sort the result-set?
▶ORDER
▶SORT
✔▶ORDER BY
▶SORT BY
第 15 題:
■使用 SQL,如何從名為“Persons”的表中返回按“FirstName”降序排序的所有記錄?
With SQL, how can you return all the records from a table named "Persons" sorted descending by "FirstName"?
✔▶SELECT * FROM Persons ORDER BY FirstName DESC
▶SELECT * FROM Persons ORDER FirstName DESC
▶SELECT * FROM Persons SORT 'FirstName' DESC
▶SELECT * FROM Persons SORT BY 'FirstName' DESC
第 16 題:
■使用 SQL,如何在“Persons”表中插入一條新記錄?
With SQL, how can you insert a new record into the "Persons" table?
✔▶INSERT INTO Persons VALUES ('Jimmy', 'Jackson')
▶INSERT VALUES ('Jimmy', 'Jackson') INTO Persons
▶INSERT ('Jimmy', 'Jackson') INTO Persons
第 17 題:
■使用 SQL,如何在“Persons”表中插入“Olsen”作為“LastName”?
With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?
With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?
▶INSERT INTO Persons ('Olsen') INTO LastName
✔▶INSERT INTO Persons (LastName) VALUES ('Olsen')
▶INSERT ('Olsen') INTO Persons (LastName)
第 18 題:
■如何在 Persons 表的“LastName”欄位中將“Hansen”更改為“Nilsen”?
How can you change "Hansen" into "Nilsen" in the "LastName" column in the Persons table?
▶MODIFY Persons SET LastName='Nilsen' WHERE LastName='Hansen' ▶UPDATE Persons SET LastName='Hansen' INTO LastName='Nilsen'
▶MODIFY Persons SET LastName='Hansen' INTO LastName='Nilsen
✔▶UPDATE Persons SET LastName='Nilsen' WHERE LastName='Hansen'
第 19 題:
■使用 SQL,如何刪除 Persons 表中“FirstName”為“Peter”的記錄?
With SQL, how can you delete the records where the "FirstName" is "Peter" in the Persons Table?
✔▶DELETE FROM Persons WHERE FirstName = 'Peter'
▶DELETE FirstName='Peter' FROM Persons
▶DELETE ROW FirstName='Peter' FROM Persons
第20 題:
■使用 SQL,如何返回“Persons”表中的記錄筆數?
With SQL, how can you return the number of records in the "Persons" table?
▶SELECT NO(*) FROM Persons
✔▶SELECT COUNT(*) FROM Persons
▶SELECT COLUMNS(*) FROM Persons
▶SELECT LEN(*) FROM Persons
第21 題:
■最常見的連接類型是什麼?
What is the most common type of join?
▶JOINED
▶JOINED TABLE
▶INSIDE JOIN
✔▶INNER JOIN
第 22 題:
■哪個運算符用於選擇範圍內的值?
Which operator is used to select values within a range?
✔▶BETWEEN
▶WITHIN
▶RANGE
第 23 題:
■NOT NULL 約束強制欄位內不接受 NULL 值。
The NOT NULL constraint enforces a column to not accept NULL values.
✔▶True
▶False
第 24 題:
■哪個運算符用於搜索列中的指定模式?
Which operator is used to search for a specified pattern in a column?
✔▶LIKE
▶GET
▶FROM
第 25 題:
■哪個 SQL 語句用於創建名為“客戶”的數據庫表?
Which SQL statement is used to create a database table called 'Customers'?
✔▶CREATE TABLE Customers
▶CREATE DATABASE TAB Customers
▶CREATE DB Customers
▶CREATE DATABASE TABLE Customers