wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

SQL Easy Test – 100 Questions (Part 1: 1–30)

Total questions: 100

Worksheet time: 50mins

Name
Class
Date
1.

SQL stands for:

a)

Simple Query Language

b)

Structured Query Language

c)

Server Query Language

d)

Sequential Query Logic

2.

Which SQL statement is used to retrieve data?

a)

GET

b)

SELECT

c)

READ

d)

FETCH

3.

Which SQL statement is used to insert new rows?

a)

INSERT

b)

ADD

c)

PUSH

d)

INCLUDE

4.

Which SQL statement is used to update existing rows?

a)

CHANGE

b)

MODIFY

c)

UPDATE

d)

ALTER

5.

Which SQL statement is used to delete rows?

a)

REMOVE

b)

DELETE

c)

ERASE

d)

DROP

6.

6. Which clause filters rows based on a condition?

a)

WHERE

b)

SELECT

c)

ORDER BY

d)

GROUP BY

7.

Which clause is used to sort results?

a)

ORDER BY

b)

SORT

c)

SORT BY

d)

ARRANGE

8.

Which keyword removes duplicate rows?

a)

UNIQUE

b)

DISTINCT

c)

DIFFERENT

d)

SINGLE

9.

Which wildcard matches any number of characters in LIKE?

a)

_

b)

%

c)

*

d)

?

10.

Which wildcard matches a single character in LIKE?

a)

_

b)

%

c)

*

d)

?

11.

Which function counts rows?

a)

SUM()

b)

COUNT()

c)

TOTAL()

d)

NUMBER()

12.

12. The function that returns the highest value is:

a)

max()

b)

min()

c)

sum()

d)

avg()

13.

Which function returns the lowest value?

a)

MIN()

b)

MAX()

c)

LEAST()

d)

LOW()

14.

Which SQL clause groups rows by column values?

a)

GROUP BY

b)

ORDER BY

c)

HAVING

d)

JOIN

15.

Which clause filters grouped data?

a)

WHERE

b)

HAVING

c)

FILTER

d)

GROUP

16.

INNER JOIN returns:

a)

All rows

b)

Only matching rows

c)

Left table rows

d)

Right table rows

17.

LEFT JOIN returns:

a)

Left table rows + matches

b)

Right table rows + matches

c)

All rows

d)

Only matching rows

18.

RIGHT JOIN returns:

a)

Right table rows + matches

b)

Left table rows + matches

c)

All rows

d)

Only matching rows

19.

FULL OUTER JOIN returns:

a)

Left rows only

b)

Right rows only

c)

Only matching rows

d)

All rows from both tables

20.

Which operator tests for NULL?

a)

= NULL

b)

!= NULL

c)

IS NULL

d)

NOT NULL

21.

PRIMARY KEY ensures:

a)

No duplicates

b)

Not NULL

c)

Both A and B

d)

Auto-increment

22.

FOREIGN KEY ensures:

a)

Unique values

b)

Links to another table

c)

Cannot be NULL

d)

Auto-increment

23.

Which command creates a table?

a)

NEW TABLE

b)

CREATE TABLE

c)

MAKE TABLE

d)

BUILD TABLE

24.

Which command removes a table?

a)

DELETE TABLE

b)

DROP TABLE

c)

REMOVE TABLE

d)

DESTROY TABLE

25.

Which command deletes all rows but keeps the table?

a)

DELETE

b)

TRUNCATE

c)

DROP

d)

ERASE

26.

Which SQL statement renames a column?

a)

RENAME

b)

ALTER TABLE...AS

c)

AS

d)

CHANGE COLUMN

27.

Which clause limits the number of returned rows?

a)

LIMIT

b)

TOP

c)

ROWNUM

d)

All of the above

28.

DEFAULT constraint:

a)

Makes column NOT NULL

b)

Sets a fallback value

c)

Ensures uniqueness

d)

Adds a primary key

29.

CHECK constraint:

a)

Ensures column values meet a condition

b)

Sets default values

c)

Makes column UNIQUE

d)

Prevents NULL values

30.

UNIQUE constraint:

a)

Ensures column values meet a condition

b)

Sets default values

c)

Makes column UNIQUE

d)

Prevents NULL values

31.

A. Prevents duplicates B. Sets default value C. Allows NULL D. Creates foreign key

a)

A. Prevents duplicates

b)

B. Sets default value

c)

C. Allows NULL

d)

D. Creates foreign key

32.

Which command updates rows in a table?

a)

CHANGE

b)

MODIFY

c)

UPDATE

d)

ALTER

33.

Which keyword is used to filter rows in UPDATE or SELECT?

a)

FILTER

b)

WHERE

c)

HAVING

d)

ON

34.

Which SQL function calculates the sum?

a)

ADD()

b)

SUM()

c)

TOTAL()

d)

PLUS()

35.

Which SQL function calculates the average?

a)

MEAN()

b)

AVG()

c)

MIDO

d)

AVERAGE()

36.

Which keyword joins tables based on a column?

a)

JOIN

b)

LINK

c)

CONNECT

d)

UNION

37.

Which of the following can be used in a SQL JOIN?

a)

One table

b)

Multiple tables or queries

c)

Only numeric columns

d)

Only string columns

38.

Which keyword keeps duplicates when combining queries?

a)

UNION

b)

UNION ALL

c)

INTERSECT

d)

JOIN

39.

Which function returns the current date in MySQL?

a)

NOW()

b)

GETDATE()

c)

CURDATE()

d)

TODAY()

40.

Which function returns the current timestamp in SQL Server?

a)

NOW()

b)

GETDATE()

c)

CURRENT_TIMESTAMP

d)

TODAY()

41.

Which command removes a column from a table?

a)

REMOVE COLUMN

b)

DROP COLUMN

c)

DELETE COLUMN

d)

ERASE COLUMN

42.

Which operator checks if a value is in a list?

a)

INSIDE

b)

IN

c)

BETWEEN

d)

EXISTS

43.

A range of values

a)

A range of values

b)

A list

c)

NULL values

d)

Text patterns

44.

AND operator returns TRUE if:

a)

Any condition is TRUE

b)

All conditions are TRUE

c)

Only first condition is TRUE

d)

Only second condition is TRUE

45.

OR operator returns TRUE if:

a)

Any condition is TRUE

b)

All conditions are TRUE

c)

No conditions are TRUE

d)

Only first condition is TRUE

46.

NOT operator reverses:

a)

Conditions

b)

Columns

c)

Tables

d)

Joins

47.

IS NULL checks:

a)

If a column equals 0

b)

If a column has no value

c)

If a column equals empty string

d)

If a column is negative

48.

IS NOT NULL checks:

a)

Column has a value

b)

Column equals NULL

c)

Column equals 0

d)

Column equals empty string

49.

48. ORDER BY DESC sorts data:

a)

in descending order

b)

in ascending order

c)

alphabetically

d)

randomly

50.

49. ORDER BY ASC sorts data:

a)

A. Ascending

b)

B. Descending

c)

C. Random

d)

D. Alphabetically

51.

Which keyword creates a view?

a)

CREATE VIEW

b)

NEW VIEW

c)

MAKE VIEW

d)

VIEW TABLE

52.

Which clause filters rows in a view?

a)

HAVING

b)

WHERE

c)

FILTER

d)

LIMIT

53.

Which command renames a table?

a)

CHANGE TABLE

b)

RENAME TABLE

c)

ALTER TABLE

d)

UPDATE TABLE

54.

Which constraint ensures values are unique?

a)

PRIMARY KEY

b)

UNIQUE

c)

FOREIGN KEY

d)

NOT NULL

55.

Which constraint prevents NULL?

a)

PRIMARY KEY

b)

UNIQUE

c)

FOREIGN KEY

d)

NOT NULL

56.

A. UNIQUE B. DEFAULT D. PRIMARY KEY

a)

A. UNIQUE

b)

B. DEFAULT

c)

C. NOT NULL

d)

D. PRIMARY KEY

57.

A composite key is:

a)

A key that includes multiple columns

b)

A single column primary key

c)

A foreign key only

d)

A temporary key

58.

Which keyword sets a default value for a column?

a)

DEFAULT

b)

VALUE

c)

SET

d)

INIT

59.

57. COUNT(column) ignores:

a)

NULL values

b)

Duplicates

c)

Numbers

d)

Text

60.

58. COUNT(*) counts:

a)

Only non-NULL values

b)

Only numbers

c)

All rows including NULLs

d)

Only text

61.

MAX(column) returns:

a)

Lowest value

b)

Highest value

c)

Average

d)

Count

62.

Which of the following represents the lowest value?

a)

Lowest value

b)

Highest value

c)

Average

d)

Count

63.

61. SUM(column) adds:

a)

Text values

b)

Numeric values

c)

All rows

d)

Only NULLs

64.

AVG(column) calculates:

a)

Sum

b)

Count

c)

Average of numeric values

d)

Median

65.

Which SQL statement creates a database?

a)

CREATE DATABASE

b)

NEW DATABASE

c)

MAKE DATABASE

d)

BUILD DATABASE

66.

Which SQL statement deletes a database?

a)

DROP DATABASE

b)

DELETE DATABASE

c)

ERASE DATABASE

d)

REMOVE DATABASE

67.

Which SQL command backs up a database?

a)

BACKUP DATABASE

b)

SAVE DATABASE

c)

COPY DATABASE

d)

EXPORT DATABASE

68.

A. RESTORE DATABASE B. IMPORT DATABASE C. COPY DATABASE D. LOAD DATABASE

a)

RESTORE DATABASE

b)

IMPORT DATABASE

c)

COPY DATABASE

d)

LOAD DATABASE

69.

INNER JOIN returns:

a)

All rows

b)

Only rows with matching keys

c)

Left table rows

d)

Right table rows

70.

LEFT JOIN returns:

a)

Left table rows + matching rows

b)

Right table rows + matching rows

c)

Only matching rows

d)

All rows

71.

RIGHT JOIN returns:

a)

Right table rows + matching rows

b)

Left table rows + matching rows

c)

Only matching rows

d)

All rows

72.

FULL OUTER JOIN returns:

a)

Left table only

b)

Right table only

c)

Only matching rows

d)

All rows from both tables

73.

Which keyword prevents duplicate rows in a SELECT query?

a)

UNIQUE

b)

DISTINCT

c)

SINGLE

d)

DIFFERENT

74.

Which wildcard matches any number of characters in LIKE?

a)

%

b)

_

c)

*

d)

?

75.

Which wildcard matches any number of characters in LIKE?

a)

%

b)

_

c)

*

d)

?

76.

Which wildcard matches a single character in LIKE?

a)

_

b)

%

c)

*

d)

?

77.

Which SQL statement removes all rows but keeps the table structure?

a)

DELETE

b)

TRUNCATE

c)

DROP

d)

ERASE

78.

Which SQL statement removes an entire table?

a)

DELETE TABLE

b)

DROP TABLE

c)

ERASE TABLE

d)

REMOVE TABLE

79.

Which SQL statement adds a new row?

a)

ADD

b)

INSERT

c)

PUSH

d)

INCLUDE

80.

Which SQL statement changes existing rows?

a)

MODIFY

b)

UPDATE

c)

CHANGE

d)

ALTER

81.

Which SQL clause filters rows?

a)

WHERE

b)

HAVING

c)

FILTER

d)

LIMIT

82.

Which SQL clause filters groups?

a)

WHERE

b)

HAVING

c)

GROUP

d)

ORDER

83.

Which keyword is used to rename a column in SELECT?

a)

A. AS

b)

B. RENAME

c)

C. CHANGE

d)

D. MODIFY

84.

PRIMARY KEY ensures:

a)

Column allows NULL

b)

Unique and NOT NULL

c)

Only uniqueness

d)

Only NOT NULL

85.

FOREIGN KEY ensures:

a)

Unique values in a column

b)

Column references another table

c)

Column cannot be NULL

d)

Column auto-increments

86.

NOT NULL ensures:

a)

Column has a value

b)

Column can be NULL

c)

Column has duplicates

d)

Column is unique

87.

DEFAULT sets:

a)

A fallback value if none provided

b)

Column as unique

c)

Column as NOT NULL

d)

Column as primary key

88.

CHECK constraint ensures:

a)

Values meet a condition

b)

Column is unique

c)

Column cannot be NULL

d)

Column references another table

89.

COUNT(*) counts:

a)

Only non-NULL rows

b)

All rows

c)

Only numeric rows

d)

Only text rows

90.

COUNT(column) counts:

a)

Only numeric rows

b)

All rows

c)

Only non-NULL rows in that column

d)

Only text rows

91.

89. SUM(column) calculates:

a)

Count

b)

Average

c)

Sum of numeric values

d)

Maximum value

92.

Column values are unique, Column cannot be NULL, Column has default value, Column references another table

a)

Column values are unique

b)

Column cannot be NULL

c)

Column has default value

d)

Column references another table

93.

MAX(column) returns:

a)

Minimum value

b)

Maximum value

c)

Average value

d)

Sum of values

94.

MIN(column) returns:

a)

Maximum value

b)

Minimum value

c)

Average value

d)

Sum of values

95.

Which operator checks if a value is in a list?

a)

IN

b)

BETWEEN

c)

EXISTS

d)

LIKE

96.

BETWEEN checks:

a)

A single value

b)

A range

c)

A list

d)

NULL values

97.

AND operator returns TRUE if:

a)

Any condition is TRUE

b)

All conditions are TRUE

c)

First condition is TRUE

d)

Second condition is TRUE

98.

OR operator returns TRUE if:

a)

Any condition is TRUE

b)

All conditions are TRUE

c)

First condition is TRUE

d)

Second condition is TRUE

99.

NOT operator:

a)

Inverts a condition

b)

Joins tables

c)

Filters rows

d)

Sorts rows

100.

ORDER BY ASC sorts:

a)

Ascending

b)

Descending

c)

Random

d)

Alphabetically