MultipleChoiceExam SQL
MultipleChoiceExam SQL
Lopez
NAME: _________________________________
SQL EXAM
1. What does SQL stand for?
A. Structured Query Language
B. Structured Question Language
C. Strong Query Language
3. How can you change "Hansel" into "Gretel" in the "LastName" column in the
Persons table?
A. MODIFY Persons SET LastName='Gretel' WHERE LastName='Hansel'
B. UPDATE Persons SET LastName='Gretel' WHERE LastName='Hansel'
C. UPDATE Persons SET LastName='Hansel' INTO LastName='Gretel'
4. With SQL, how can you delete the records where the "FirstName" is
"Peterson" in the Persons Table?
A. DELETE FROM Persons WHERE FirstName = 'Peterson'
B. DELETE ROW FirstName='Peterson' FROM Persons
C. DELETE FirstName='Peterson' FROM Persons
5. With SQL, how can you insert a new record into the "Persons" table?
A. INSERT INTO Persons VALUES ('Katy', 'Perr')
B. INSERT VALUES ('Katy', 'Perr') INTO Persons
C. INSERT ('Katy', 'Perr') INTO Persons
6. 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. SELECT * FROM Persons WHERE FirstName LIKE '%a'
B. SELECT * FROM Persons WHERE FirstName='%a%'
C. SELECT * FROM Persons WHERE FirstName LIKE 'a%'
7. With SQL, how do you select all the records from a table named "Persons"
where the "LastName" is alphabetically between (and including) "Hansel" and
"Gretel"?
A. SELECT * FROM Persons WHERE LastName BETWEEN 'Hansel' AND
'Gretel'
B. SELECT LastName>'Hansel' AND LastName<'Gretel' FROM Persons
C. SELECT * FROM Persons WHERE LastName>'Hansel' AND
LastName<'Gretel'
8. With SQL, how can you return all the records from a table named "Persons"
sorted descending by "FirstName"?
A. SELECT * FROM Persons ORDER BY FirstName DESC
B. SELECT * FROM Persons SORT BY 'FirstName' DESC
C. SELECT * FROM Persons SORT 'FirstName' DESC
D. SELECT * FROM Persons ORDER FirstName DESC
9. Given two tables (employees and departments table). You want to retrieve all
employees, whether or not they have matching departments in the
departments table. Which query would you use?
16. Which of the following statements is false about the HAVING clause?
A. The HAVING clause selects rows before grouping.
B. The HAVING clause can contain aggregate functions
C. The HAVING clause cannot be used without the GROUP BY clause.
17. 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
18. Which of the following is false about group by:
A. Group by can be used on more than one column
B. The usage of SQL GROUP BY clause is, to divide the rows in a table
into smaller groups
C. The GROUP BY clause cannot be used without an aggregate function.
19. True or False: Stored procedure can call itself or recursive stored procedure. False