wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

SQLite - Writing Queries

Total questions: 9

Worksheet time: 8mins

Name
Class
Date
1.
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%’;
2.

Write the SQL command that will return all information from movies that have genre of romances and imdb_rating over 6.

a)

SELECT * FROM movies WHERE genre = ‘romance’ AND imdb_rating > 6;

b)

SELECT * FROM movies WHERE genre = ‘romance’ AND imdb_rating < 6;

c)

SELECT imdb_rating, name FROM movie WHERE genre = ‘romance’ AND imdb_rating > 6;

d)

SELECT * FROM movies WHERE genre = romance and imdb_rating < 6;

3.
What is a special value in SQL that represents missing or unknown data?
a)
%
b)
?
c)
NULL
d)
*
4.

Return 2 movies where the movie name include the word power.

a)

SELECT * FROM movies WHERE name = ‘%power%’ LIMIT 2;

b)

SELECT * FROM movies WHERE genre LIKE ‘%power%’ LIMIT 2;

c)

SELECT * FROM movies WHERE name LIKE ‘%power%’ LIMIT 2;

d)

SELECT * FROM games WHERE name LIKE ‘%power%’ LIMIT 2;

5.
Which of the following code is written correctly?
a)
SELECT * FROM movies WHERE imdb_rating is 1 AND ORDER by desc;
b)
SELECT * FROM movies WHERE genre = ‘comedy’ AND ORDER BY ASC LIMIT 1:
c)
SELECT * FROM movies WHERE genre = ‘horror’;
d)
SELECT * FROM movies genre is horror, and rating is 2;
6.
What is wrong with the following code: SELECT * FROM movies WHERE genre = ‘romance’ AND imdb rating > 8;
a)
The asterisk doesn’t need to be there
b)
The equal sign needs to go before genre
c)
There needs to be an underscore in between imdb and rating
d)
The single quotes don’t need to be there
7.

SQLite is a _____

a)

NoSQL database

b)

Distributed database

c)

Relational database

d)

Operational database

8.

SQLite is case insensitive.

a)

TRUE

b)

FALSE

9.

Which of the following will be returned if the query is:


SELECT * from Customer

where CustFName LIKE ‘Ta_g%';

a)

Tung

b)

Tammg

c)

Tang

d)

Tarngie