SQL-Multiple Choice Question
SQL-Multiple Choice Question
9. Which of the following SQL clauses is used to DELETE data from a database
table?
A.
DELETE
B.
REMOVE
C.
DROP DATA
D.
CLEAR
10. Which of the following SQL statements is correct?
A.
SELECT CustomerName, COUNT(CustomerName) FROM Orders
B.
SELECT CustomerName, COUNT(CustomerName) FROM Orders GROUP BY
CustomerName
C.
SELECT CustomerName, COUNT(CustomerName) FROM Orders ORDER BY
CustomerName
11. What does SQL stand for?
A.
Strong Question Language
B.
Structured Query Language
C.
Structured Question Language
12. Which SQL statement is used to extract data from a database?
A.
SELECT
B.
GET
C.
OPEN
D.
EXTRACT
13. Which SQL statement is used to update data in a database?
A.
SAVE
B.
SAVE AS
C.
MODIFY
D.
UPDATE
14. With SQL, how do you select a column named "FirstName" from a table
named "Persons"?
A.
SELECT Persons.FirstName
B.
SELECT FirstName FROM Persons
C.
EXTRACT FirstName FROM Persons
15. With SQL, how do you select all the columns from a table named "Persons"?
A.
SELECT *.Persons
B.
SELECT [all] FROM Persons
C.
SELECT * FROM Persons
D.
SELECT Persons
16. With SQL, how do you select all the records from a table named "Persons"
where the value of the column "FirstName" is "Peter"?
A.
SELECT * FROM Persons WHERE FirstName<>'Peter'
B.
SELECT [all] FROM Persons WHERE FirstName LIKE 'Peter'
C.
SELECT * FROM Persons WHERE FirstName='Peter'
D.
SELECT [all] FROM Persons WHERE FirstName='Peter'
17. 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"?
A.
B.
C.
D.
SELECT
SELECT
SELECT
SELECT
*
*
*
*
FROM
FROM
FROM
FROM
Persons
Persons
Persons
Persons
WHERE
WHERE
WHERE
WHERE
FirstName='a'
FirstName LIKE 'a%'
FirstName LIKE '%a'
FirstName='%a%'
18. 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
A.
False
B.
True
19. With SQL, how do you select all the records from a table named "Persons"
where the "FirstName" is "Peter" and the "LastName" is "Jackson"?
A.
SELECT * FROM Persons WHERE FirstName='Peter' AND
LastName='Jackson'
B.
SELECT FirstName='Peter', LastName='Jackson' FROM Persons
C.
SELECT * FROM Persons WHERE FirstName<>'Peter' AND
LastName<>'Jackson'
20. 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"?
A.
SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND
'Pettersen'
B.
SELECT * FROM Persons WHERE LastName>'Hansen' AND
LastName<'Pettersen'
C.
SELECT LastName>'Hansen' AND LastName<'Pettersen' FROM Persons
21. Which SQL statement is used to return only different values?
A.
SELECT DIFFERENT
B.
SELECT UNIQUE
C.
SELECT DISTINCT
22. Which SQL keyword is used to sort the result-set?
A.
ORDER BY
B.
SORT
C.
ORDER
D.
SORT BY
23. With SQL, how can you return all the records from a table named "Persons"
sorted descending by "FirstName"?
A.
SELECT * FROM Persons SORT BY 'FirstName' DESC
B.
SELECT * FROM Persons ORDER FirstName DESC
C.
SELECT * FROM Persons SORT 'FirstName' DESC
D.
SELECT * FROM Persons ORDER BY FirstName DESC
24. With SQL, how can you insert a new record into the "Persons" table?
A.
INSERT INTO Persons VALUES ('Jimmy', 'Jackson')
B.
INSERT VALUES ('Jimmy', 'Jackson') INTO Persons
C.
INSERT ('Jimmy', 'Jackson') INTO Persons]
25. How can you change "Hansen" into "Nilsen" in the "LastName" column in the
Persons table?
A.
B.
C.
D.
26. With SQL, how can you delete the records where the "FirstName" is "Peter" in
the Persons Table?
A.
DELETE FROM Persons WHERE FirstName = 'Peter'
B.
DELETE ROW FirstName='Peter' FROM Persons
C.
DELETE FirstName='Peter' FROM Persons
27. With SQL, how can you return the number of records in the "Persons" table?
A.
SELECT COUNT() FROM Persons
B.
SELECT COLUMNS() FROM Persons
C.
SELECT COLUMNS(*) FROM Persons
D.
SELECT COUNT(*) FROM Persons
28. If you don't specify ASC or DESC after a SQL ORDER BY clause, the following
is used by default:
A.
ASC
B.
DESC
C.
There is no default value.
29. When inserting data in a table do you always have to specify a list of all
column names you are inserting values for?
A.
No
B.
Yes
30. Which of the following 3 SQL statements is correct?
A.
SELECT Username, Password FROM Users
B.
SELECT Username AND Password FROM Users
C.
SELECT Username, Password WHERE Username = 'user1'
31. What is a database cursor?
A.
Cursor is acronym for Current Set Of Records and is a database object
pointing to a currently selected set of records.
B.
A cursor is SQL keyword specifying a retrieved data order.
C.
A blinking vertical line that indicates the location of the next input on the
display screen.
32. What does follow after the SQL WHERE clause?
A.
Definition of the condition to be met for the rows to be returned.
B.
A list of columns to be selected.
C.
The name of the table we are selecting from.
33. What does the ALTER TABLE clause do?
A.
The SQL ALTER TABLE clause modifies a table definition by altering,
adding, or deleting table columns and/or constraints.
B.
The SQL ALTER TABLE clause is used to insert data into database table.
C.
THE SQL ALTER TABLE deletes data from database table.
D.
The SQL ALTER TABLE clause is used to delete a database table.
34. What is the difference between the WHERE and HAVING SQL clauses?
A.
The WHERE and the HAVING clauses are identical
B.
The HAVING SQL clause condition(s) is applied to all rows in the result set
before the WHERE clause is applied (if present). The WHERE clause is used
C.
only with SELECT SQL statements and specifies a search condition for an
aggregate or a group.
The WHERE SQL clause condition(s) is applied to all rows in the result set
before the HAVING clause is applied (if present). The HAVING clause is
used only with SELECT SQL statements and specifies a search condition for
an aggregate or a group.
Date
CustomerID
12/12/2005
13/12/2005
13
17