wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

SQL Basics

Total questions: 29

Worksheet time: 58mins

Name
Class
Date
1.

What does SQL stand for?

a)

Strong Question Language

b)

Structured Query Language

c)

Structured Question Language

d)

Strong Query Language

2.

Which SQL Statement is used to get data from a database

a)

GET

b)

EXTRACT

c)

SELECT

d)

SHOW

3.

What is missing from the following SQL statement:


SELECT * _______ Customers;

a)

SELECT

b)

ORDER BY

c)

WHERE

d)

FROM

4.

What is the purpose of a * ?

a)

Selects all fields from a table

b)

Selects all rows from a table

c)

Selects the first record from a table

d)

Selects the last record from a table

5.

Which of the following does not describe the relationship in the diagram

a)

A player can play no games or many games

b)

A game must have at least one player

c)

A game can have more then one player

d)

A player has to play at least one game

6.

Which clause lets you filter data?

a)

SORT

b)

ORDER BY

c)

WHERE

d)

FILTER

7.

For an AND operator either condition must be true to return a record.

a)

True

b)

False

8.

What does the FROM clause do?

a)

Selects the columns to be returned

b)

Selects the rows to be returned

c)

Selects the table to use in the query

d)

Selects the database to use in the query

9.

Which of the following is used to select all the records from the Order Table where the Price is more then $100?

a)

SELECT * FROM Order WHERE Price > 100;

b)

SELECT [all] FROM Order WHERE Price > 100;

c)

SELECT Order WHERE Price > 100;

d)

SELECT * FROM Order WHERE Price OVER 100

10.

Which of the following allows you to add more then one filter to a query?

a)

LIKE

b)

BETWEEN

c)

EQUALS

d)

OR

11.

You must always use ______ when filtering string values?

a)

Percent Signs

b)

Exclamation Mark

c)

Quote Marks

d)

Asterisk

12.

A Foreign Key is:

a)

Specifies which table to select or delete data from

b)

Two or more columns in a table that can be used to uniquely identify each row

c)

A constraint that uniquely identifies each record in a database table

d)

A constraint that is a key used to link two tables together

13.

What does the notation in the image mean?

a)

One

b)

One and only one

c)

One or more

d)

One or none

14.

Which of the following is NOT required for the following query: "Get all books that have a user rating higher then 3.5"

a)

SELECT

b)

FROM

c)

WHERE

d)

ORDER BY

15.

A Primary Key can be a null value.

a)

True

b)

False

16.

When looking at a row in a table we refer to it as a?

a)

Record

b)

Result

c)

Row

d)

Information

17.

When looking at a column in a table we refer to it as a?

a)

Name

b)

Field

c)

Column

d)

Data Type

18.

A Primary Key ensures that each value in the field is:

a)

Meaningful

b)

Identical

c)

A number

d)

Unique

19.

To get all of the matching records between Table A and Table B you would use which of the following?

a)

Left Outer Join

b)

Right Outer Join

c)

Inner Join

d)

Cartesian Table

20.

What will this SQL query return?

a)

All the records in tableA and the matching records in tableB

b)

The records where there is a match between tableA and tableB

c)

The records from tableA where there is a match and all the records from tableB

d)

All of the records from both tables.

21.

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

a)

b)

c)

d)

22.

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

a)

LIKE

b)

GET

c)

FROM

d)

SOME

23.

Which SQL Command changes data that already exists in a table?

a)

EDIT

b)

MODIFY

c)

UPDATE

d)

ALTER

24.

Which of the following clause allows us to extract data in a range?

a)

RANGE

b)

BETWEEN

c)

FIND IN

d)

LIKE

25.

Which of the following shows comment in SQL?

a)

/* This is a comment. */

b)

# This is a comment.

c)

% This is a comment. %

d)

& This is a comment.

26.

Which of the following is true about NULL values in SQL?

a)

A NULL value means zero.

b)

A null value can only be used with numeric attributes.

c)

Null value means that data of that field is not available.

d)

None of these

27.

This part of the Join is doing what?

a)

Setting the ID column of tableA to the same as the ID column of tableB

b)

Identifying the columns to use when checking for records that match

c)

Setting a foreign key relationship between tableA and tableB on IDColumn

d)

Selecting the tables to join together.

28.

What happens when we run the below query but emp_id ‘AR5’ doesn’t exist in our table?

SELECT * FROM DataFlair_info WHERE emp_id = ‘AR5’

a)

Error in the query execution.

b)

Compilation error.

c)

Nothing appears in the result tab.

d)

None of these.

29.

Which of the following is not a constraint in SQL?

a)

UNIQUE

b)

NULL

c)

NOT NULL

d)

PRIMARY KEY