Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Data and Database: SQL

Total questions: 36

Worksheet time: 22mins

Name
Class
Date
1.
Which is the best example of a primary key?
a)
Driver's License Number
b)
Home Runs Hit
c)
Price
d)
First and Last Name
2.
Data _____ helps ensure that an incorrect entry isn't made.
a)
validation
b)
checks
c)
accuracy
d)
integrity
3.
The front-end of a database is known as a _____.
a)
form
b)
report
c)
query
d)
website
4.
The following are functions of a DBMS except
a)
Creating database
b)
Processing data
c)
Creating and processing forms
d)
Administrating database
5.
A database management system (DBMS) is a:
a)
Software system used to create, maintain, and provide controlled access to a database
b)
Hardware system used to create, maintain, and provide controlled access to a database
c)
Hardware system used to create, maintain, and provide uncontrolled access to a database
d)
Software system used to create, maintain, and provide uncontrolled access to a database
6.
A database application can perform which of the following activities?
a)
Add records
b)
Display / read records
c)
Update records
d)
All of the above
7.
A relational database consists of a collection of
a)
Field
b)
Record
c)
Table
d)
Keys
8.
The term attribute refers to a ________ of a table
a)
Record
b)
Foreign key
c)
Primary key
d)
Field
9.
The term _______ is used to refer a row
a)
Record
b)
Foreign key
c)
Primary key
d)
Field
10.
Consider attributes ID, CITY, and NAME. Which one if this can be considered as a primary key?
a)
NAME
b)
ID
c)
CITY
d)
ID, NAME
11.
which one of the following cannot be taken as a primary key?
a)
ID
b)
RegistrationNo
c)
DepartmentID
d)
Street
12.
Which of the following gives a logical structure of the database graphically?
a)
Entity--relationship diagram
b)
Entity diagram
c)
Database diagram
d)
Architectural representation
13.
The entity relationship set is represented in E-R diagram as
a)
Double diamonds
b)
Undivided rectangles
c)
Dashed lines
d)
Diamond
14.

Which statement is used to extract data from a database?

a)

Extract

b)

Get

c)

Open

d)

Select

15.

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

a)

Update

b)

Amend

c)

Alter

d)

Modify

16.

To remove a record from a table which SQL statement would you use?

a)

Remove

b)

Cancel

c)

Delete

d)

Eradicate

17.

Which character returns all the data found in a table?

a)

%

b)

#

c)

*

d)

/

18.

Which word is missing from the following SQL statement?


Select * table_name

a)

With

b)

Where

c)

From

d)

And

19.

What is the correct order of clauses in a SQL statement?

a)

SELECT, FROM, ORDER BY, WHERE

b)

SELECT, FROM, WHERE, ORDER BY

c)

SELECT, WHERE, FROM, ORDER BY

d)

WHERE, FROM, SELECT, ORDER BY

20.

Where does the CREATE Command belong?

a)

DML

b)

DDL

c)

DCL

21.

This symbol is an SQL wildcard that can substitute for one or more characters when searching for data in a database.

a)

$

b)

%

c)

=

d)

*

22.

What is the commands that define a database, including creating, altering, and dropping tables and establishing constraints

a)

DCL

b)

DDL

c)

DML

d)

SQL

23.

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

a)

COUNT()

b)

NUMBER()

c)

SUM()

d)

COUNT(*)

24.

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%’

25.

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=’Nilsen’ WHERE LastName=’Hansen’

c)

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

d)

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

26.

Find the name of those cities with temperature and condition whose condition is either sunny or cloudy but temperature must be greater than 70.

a)

SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ OR temperature > 70

b)

SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ OR temperature > 70

c)

SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ AND temperature > 70

d)

SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ AND temperature > 70

27.

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’);

28.
What is data redundancy?
a)
Data that is repeated multiple times.
b)
Data that is safe from SQL attacks.
c)
Data that is weak to SQL attacks.
d)
Data that has no use anymore.
29.
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%’;
30.
a)
ANSWER: SELECT id, name, year FROM movies WHERE year > 2010;
b)
ANSWER: SELECT id, name, year FROM movies WHERE year < 2010;
c)
ANSWER: SELECT * FROM movies WHERE year > 2010;
d)
ANSWER: SELECT id, name, year FROM movies WHERE YEAR > 2010;
31.
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
32.
What is a special value in SQL that represents missing or unknown data?
a)
%
b)
?
c)
NULL
d)
*
33.
What is the expected output from following SQL Query:
SELECT title
FROM videogames
WHERE title LIKE  '%2'
a)
It will only show video games which contains the character 2 somewhere in the title
b)
It will only show  videogames which begins with the character 2 in the title
c)
It will only show videogames which ends with the character 2 in the title
34.
Which SQL reserved keyword do you use to combine data from two or more tables, based on a common field between them?
a)
using SELECT
b)
using JOIN
c)
using WHERE
d)
using GET
35.
What is SQL ?
a)
It is a programming lanuage
b)
It is a declarative language
c)
It is a markup language
36.

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

a)

ADD NEW

b)

INSERT INTO

c)

ADD RECORD

d)

INSERT NEW