Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

STRUCTURED QUERY LANGUAGE

Total questions: 46

Worksheet time: 26mins

Name
Class
Date
1.

ENTER YOUR NAME

4 lines
2.

CLASS & SECTION

a)

12 A

b)

12 B

c)

12 D

d)

12 A (JP)

e)

12 F(JP)

3.

BRANCH

a)

MEERA BAGH

b)

JANAK PURI

4.

Which SQL function is used to count the number of rows in a SQL query?

a)

COUNT()

b)

NUMBER()

c)

SUM()

d)

COUNT(*)

5.

Which of the following SQL clauses is used to DELETE tuples from a database table?

a)

DELETE

b)

REMOVE

c)

DROP

d)

CLEAR

6.

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

d)

None of the mentioned

7.

With SQL, how do you select all the records from a table named “Persons” where the value of the column “FirstName” ends with an “a”?

a)

SELECT * FROM Persons WHERE FirstName=’a’

b)

SELECT * FROM Persons WHERE FirstName LIKE ‘a%’

c)

SELECT * FROM Persons WHERE FirstName LIKE ‘%a’

d)

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

8.

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

9.

The UPDATE SQL clause can _____________

a)

update only one row at a time

b)

update more than one row at a time

c)

delete more than one row at a time

d)

delete only one row at a time

10.

SQL query to find all the cities whose humidity is 95.

a)

SELECT city WHERE humidity = 95

b)

SELECT city FROM weather WHERE humidity = 95

c)

SELECT humidity = 89 FROM weather

d)

SELECT city FROM weather

11.

SQL query to find the temperature in increasing order of all cities.

a)

SELECT city FROM weather ORDER BY temperature

b)

SELECT city, temperature FROM weather

c)

SELECT city, temperature FROM weather ORDER BY temperature

d)

SELECT city, temperature FROM weather ORDER BY city

12.

The command to remove rows from a table ‘CUSTOMER’ is __________________

a)

DROP FROM CUSTOMER

b)

UPDATE FROM CUSTOMER

c)

REMOVE FROM CUSTOMER

d)

DELETE FROM CUSTOMER WHERE

13.

Find the names of these cities with temperature and condition whose condition is neither sunny nor cloudy.

a)

SELECT city, temperature, condition FROM weather WHERE condition NOT IN (‘sunny’, ‘cloudy’)

b)

SELECT city, temperature, condition FROM weather WHERE condition NOT BETWEEN (‘sunny’, ‘cloudy’)

c)

SELECT city, temperature, condition FROM weather WHERE condition IN (‘sunny’, ‘cloudy’)

d)

SELECT city, temperature, condition FROM weather WHERE condition BETWEEN (‘sunny’, ‘cloudy’);

14.

SQL is

a)

Structured Query Language

b)

Simple Query Language

c)

Structured Question Language

d)

Structure Quality Language

15.

DDL means

(a)  

16.

DML

(a)  

17.

In order to modify data in a database we would use which SQL statement?

a)

Update

b)

Amend

c)

Alter

d)

Modify

18.

Which statement is used to extract data from a database?

a)

Extract

b)

Get

c)

Open

d)

Select

19.

Which statement allows us to add a record to a table?

a)

Add To

b)

Update To

c)

Add Into

d)

Insert Into

20.

Less than or equal to?

a)

>=

b)

=>

c)

=<

d)

<=

21.

Which word is missing from the following SQL statement?


Select * table_name

a)

With

b)

Where

c)

From

d)

And

22.

Which SQL statement would add a record to the database?

a)

INSERT INTO Designer VALUES ('SMI01', 'M Smith', 'mail@msmith.com', '01224123456')

b)

INSERT VALUES ('SMI01', 'M Smith', 'mail@msmith.com', 01224123456') INTO Designer

c)

INSERT ('SMI01', 'M Smith', 'mail@msmith.com', '01224123456') INTO Designer

d)

INSERT Designer INTO VALUES (''SMI01', 'M Smith', 'mail@msmith.com', '01224123456')

23.

Where does the CREATE Command belong?

a)

DML

b)

DDL

c)

DCL

24.

It is a DML command that is used to display record.

a)

DISPLAY

b)

STRUCTURE

c)

WHERE

d)

SELECT

25.

A primary key can be NULL in the table? TRUE or FALSE

a)

TRUE

b)

FALSE

26.
Write a code for the following: Return the names and imdb_ratings of all movies with ‘day’ in the name.
a)
SELECT * FROM movies WHERE name LIKE ‘day’;
b)
RETURN  name, imdb_rating FROM movies WHERE name LIKE '%day%';
c)
SELECT name, imdb_rating FROM movies WHERE name LIKE '%day%';
d)
SELECT * FROM movies WHERE imdb_rating AND name LIKE ‘%day%’;
27.
A column in a database
a)
record
b)
row
c)
field
d)
data
28.
Return all dramas made after 2004.
a)
SELECT * FROM movies WHERE genre = 'drama';
b)
SELECT * FROM movies WHERE genre = 'drama' AND year > 2004;
c)
SELECT * FROM movies WHERE genre = "drama' AND year < 2004;
d)
SELECT * FROM movies WHERE imdb_rating = 7 AND LIMIT = 7
29.
What is a special value in SQL that represents missing or unknown data?
a)
%
b)
?
c)
NULL
d)
*
30.
Write the code for the following : Return all movies with the word love.
a)
SELECT * FROM movies WHERE name LIKE %love%;
b)
SELECT * FROM movies WHERE name LIKE ‘love’;
c)
SELECT * FROM movies WHERE name LIKE %love;
d)
SELECT * FROM movies WHERE name LIKE ‘%love%’;
31.
What is wrong with the following code: SELECT * FROM movies WHERE genre = comedy AND year < 2016 ORDER BY year DESC;
a)
Comedy should have single quotes around it
b)
AND should be lower case
c)
movies should be capitalized
d)
No changes should be made
32.
What does * mean when writing code?
a)
Select all columns
b)
Select all rows
c)
Select all genres
d)
Select jaskfjfjfjsfjiosjisjfjsfjsfjkjsk
33.
What is missing in this code? SELECT * FROM WHERE genre = ‘action’ ORDER BY year ASC;
a)
Missing an AND
b)
Table name
c)
Capitalize action
d)
None of these
34.
What word is missing from the line below?
SELECT *
_______ CUSTOMER;
a)
FROM
b)
WHERE
c)
SELECT
d)
ORDER BY
35.
What is the purpose of  *?
a)
Selects ALL fields from the table
b)
Selects only the first field in the table
c)
Selects the last field in the table
d)
Shows only the first row in the table
36.
Return only the customers who have ER anywhere in their last name. 
a)
last_name LIKE "%er%"
b)
last_name = "%er"
c)
last_name = "%er%"
d)
last_name LIKE "%er"
37.
Which clause allows you to SORT data?
a)
ORDER BY
b)
WHERE
c)
FROM
d)
HAVING
38.
What represents no value? 
a)
NULL
b)
" "
c)
0
d)
N/A
39.
SELECT MAX(price)
FROM    PRODUCT
will return how many rows?
a)
1
b)
0
c)
2
d)
As many rows that are in the table
40.
AVG, COUNT, MAX, MIN and SUM are known as what?
a)
Aggregate functions
b)
Wildcard filters
c)
Subqueries
d)
Calculated field
41.

If you were wanting to filter data, which clause would you use?

a)

Where

b)

Order by

c)

From

d)

Select

42.

Which character returns all the data found in a table?

a)

%

b)

#

c)

*

d)

/

43.

Which symbol would you use to represent more than 50

a)

= 50

b)

< 50

c)

> 50

d)

# 50

44.

Using which word allows you to specify that more than one condition must be met in a query?

a)

Also

b)

And

c)

Or

d)

Where

45.

In order to amend data in a database we would use which SQL statement?

a)

Update

b)

Amend

c)

Alter

d)

Modify

46.

Using which word allows you to specify that only one of a series of conditions needs to be met in a query filter?

a)

And

b)

Maybe

c)

If

d)

Or