wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

MYSQL

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

What does SQL stand for?

a)

Structured Question Language

b)

Structured Query Language

c)

Strong Question Language

2.

Which SQL statement is used to extract data from a database?

a)

SELECT

b)

INSERT

c)

UPDATE

d)

DELETE

3.

Which SQL statement is used to update data in a database?

a)

MODIFY

b)

SAVE

c)

UPDATE

d)

INSERT

4.

Which SQL statement is used to delete data from a database?

a)

DELETE

b)

DROP

c)

REMOVE

d)

COLLAPSE

5.

Which SQL statement is used to insert new data in a database?

a)

INSERT INTO

b)

INSERT NEW

c)

INSERT VALUE

d)

ADD NEW

6.

With SQL, how do you select a column named "FirstName" from a table named "Persons"?

a)

EXTRACT FirstName FROM Persons

b)

SELECT FirstName FROM Persons

c)

SELECT Persons.FirstName

7.

With SQL, how do you select all the columns from a table named "Persons"?

a)

SELECT *.Persons

b)

SELECT [all] FROM Persons

c)

SELECT Persons

d)

SELECT * FROM Persons

8.

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 [all] FROM Persons WHERE FirstName LIKE 'Peter'

b)

SELECT * FROM Persons WHERE FirstName='Peter'

c)

SELECT [all] FROM Persons WHERE FirstName='Peter'

d)

SELECT * FROM Persons WHERE FirstName<>'Peter'

9.

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='a'

b)

SELECT * FROM Persons WHERE FirstName LIKE 'a%'

c)

SELECT * FROM Persons WHERE FirstName='%a%'

d)

SELECT * FROM Persons WHERE FirstName LIKE '%a'

10.

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

a)

TRUE

b)

FALSE

11.

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 FirstName='Peter', LastName='Jackson' FROM Persons

b)

SELECT * FROM Persons WHERE FirstName<>'Peter' AND LastName<>'Jackson'

c)

SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson'

d)

SELECT * FROM Persons WHERE FirstName='Peter' OR FirstName='Jackson'

12.

Which SQL statement is used to return only different values?

a)

SELECT DIFFERENT

b)

SELECT UNIQUE

c)

SELECT DISTINCT

d)

SELECT MIN

13.

Which SQL keyword is used to sort the result-set?

a)

ORDER

b)

SORT BY

c)

ORDER BY

d)

SORT

14.

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

15.

With SQL, how can you insert a new record into the "Persons" table?

a)

INSERT INTO Persons VALUES ('Jimmy', 'Jackson')

b)

INSERT ('Jimmy', 'Jackson') INTO Persons

c)

INSERT VALUES ('Jimmy', 'Jackson') INTO Persons

16.

With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?

a)

INSERT INTO Persons (LastName) VALUES ('Olsen')

b)

INSERT ('Olsen') INTO Persons (LastName)

c)

INSERT INTO Persons ('Olsen') INTO LastName

17.

How can you change "Hansen" into "Nilsen" in the "LastName" column in the Persons table?

a)

UPDATE Persons SET LastName='Hansen' INTO LastName='Nilsen'

b)

MODIFY Persons SET LastName='Hansen' INTO LastName='Nilsen

c)

UPDATE Persons SET LastName='Nilsen' WHERE LastName='Hansen'

d)

MODIFY Persons SET LastName='Nilsen' WHERE LastName='Hansen'

18.

With SQL, how can you delete the records where the "FirstName" is "Peter" in the Persons Table?

a)

DELETE FirstName='Peter' FROM Persons

b)

DELETE FROM Persons WHERE FirstName = 'Peter'

c)

DELETE ROW FirstName='Peter' FROM Persons

19.

With SQL, how can you return the number of records in the "Persons" table?

a)

SELECT COUNT(*) FROM Persons

b)

SELECT NO(*) FROM Persons

c)

SELECT LEN(*) FROM Persons

d)

SELECT COLUMNS(*) FROM Persons

20.

What is the most common type of join?

a)

INNER JOIN

b)

INSIDE JOIN

c)

JOINED

d)

JOINED TABLE

21.

Which operator is used to select values within a range?

a)

RANGE

b)

BETWEEN

c)

WITHIN

22.

The NOT NULL constraint enforces a column to not accept NULL values.

a)

True

b)

False

23.

Which operator is used to search for a specified pattern in a column?

a)

FROM

b)

LIKE

c)

GET

24.

Which SQL statement is used to create a database table called 'Customers'?

a)

CREATE DB Customers

b)

CREATE DATABASE TAB Customers

c)

CREATE TABLE Customers

d)

CREATE DATABASE TABLE Customers

25.

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>'Hansen' AND LastName<'Pettersen'

b)

SELECT LastName>'Hansen' AND LastName<'Pettersen' FROM Persons

c)

SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen'