wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

MySQL Easy-Advanced Mix

Total questions: 75

Worksheet time: 25mins

Name
Class
Date
1.

Which command is used to create a new database in MySQL?

a)

MAKE DATABASE

b)

NEW DATABASE

c)

CREATE DATABASE

d)

BUILD DATABASE

2.

What command is used to display all available databases?

a)

SHOW DATABASES

b)

LIST DATABASE

c)

DISPLAY DATABASE

d)

SELECT DATABASE

3.

Which SQL statement is used to add new records to a table?

a)

INSERT NEW

b)

INSERT INTO

c)

ADD RECORD

d)

CREATE ROW

4.

Which clause is used to filter records in a SELECT statement?

a)

ORDER BY

b)

WHERE

c)

GROUP BY

d)

HAVING

5.

What command deletes all rows from a table but not the table itself?

a)

DROP TABLE

b)

REMOVE TABLE

c)

DELETE TABLE

d)

TRUNCATE TABLE

6.

Which function returns the total number of rows in a result set?

a)

SUM()

b)

TOTAL()

c)

COUNT()

d)

NUMBER()

7.

What type of JOIN returns all records that have matching values in both tables?

a)

FULL JOIN

b)

LEFT JOIN

c)

RIGHT JOIN

d)

INNER JOIN

8.

Which keyword sorts the result set?

a)

SORT

b)

ORDER BY

c)

GROUP BY

d)

ASCEND

9.

What constraint uniquely identifies each record in a table?

a)

FOREIGN KEY

b)

PRIMARY KEY

c)

UNIQUE KEY

d)

DEFAULT KEY

10.

Which SQL command is used to remove a table completely from the database?

a)

DELETE TABLE

b)

ERASE TABLE

c)

DROP TABLE

d)

REMOVE TABLE

11.

What command is used to modify the structure of an existing table?

a)

CHANGE TABLE

b)

ALTER TABLE

c)

UPDATE TABLE

d)

MODIFY TABLE

12.

Which function returns the average value of a numeric column?

a)

MEAN()

b)

AVG()

c)

AVERAGE()

d)

SUM()

13.

Which clause groups rows that have the same values?

a)

GROUP BY

b)

ORDER BY

c)

UNION

d)

JOIN

14.

Which statement is used to retrieve data from a table?

a)

FETCH

b)

GET

c)

SELECT

d)

SHOW

15.

Which command removes a database permanently?

a)

DELETE DATABASE

b)

REMOVE DATABASE

c)

DROP DATABASE

d)

ERASE DATABASE

16.

Which operator is used to test for NULL values?

a)

=

b)

IS NULL

c)

NULL

d)

IS NOT

17.

Which SQL keyword is used to prevent duplicate values?

a)

UNIQUE

b)

DISTINCT

c)

ONLY

d)

NO DUPLICATE

18.

Which MySQL command is used to rename a table?

a)

RENAME TABLE

b)

ALTER NAME

c)

CHANGE TABLE

d)

MODIFY TABLE

19.

Which clause is used to arrange the result set?

a)

A) GROUP BY

b)

B) ORDER BY

c)

C) WHERE

d)

D) LIMIT

20.

Which SQL statement is used to update existing data?

a)

UPDATE

b)

CHANGE

c)

ALTER

d)

MODIFY

21.

Which function returns the largest value in a set?

a)

TOP()

b)

HIGHEST()

c)

MAX()

d)

LARGEST()

22.

Which keyword limits the number of returned rows?

a)

RESTRICT

b)

LIMIT

c)

ROWCOUNT

d)

MAXROWS

23.

Which JOIN includes all records from the left table?

a)

LEFT JOIN

b)

RIGHT JOIN

c)

FULL JOIN

d)

CROSS JOIN

24.

Which command adds a new column to a table?

a)

ADD COLUMN

b)

ALTER TABLE ADD

c)

ALTER TABLE ADD COLUMN

d)

APPEND COLUMN

25.

What constraint ensures that a column cannot have NULL values?

a)

PRIMARY KEY

b)

NOT NULL

c)

UNIQUE

d)

FOREIGN KEY

26.

Which clause is used to specify conditions for grouped records?

a)

A) WHERE

b)

B) HAVING

c)

C) GROUP

d)

D) FILTER

27.

Which function returns the smallest value in a column?

a)

LOWEST()

b)

MIN()

c)

SMALL()

d)

LEAST()

28.

Which command permanently deletes a table?

a)

DROP

b)

DELETE

c)

REMOVE

d)

ERASE

29.

Which operator is used to combine conditions in SQL?

a)

AND/OR

b)

IF

c)

JOIN

d)

COMBINE

30.

Which statement adds a new table to a database?

a)

INSERT TABLE

b)

MAKE TABLE

c)

CREATE TABLE

d)

NEW TABLE

31.

What command is used to undo a transaction?

a)

ROLLBACK

b)

UNDO

c)

CANCEL

d)

REVERSE

32.

Which statement saves all changes permanently to the database?

a)

SAVE

b)

COMMIT

c)

STORE

d)

END

33.

Which keyword is used to join tables vertically?

a)

UNION

b)

JOIN

c)

MERGE

d)

APPEND

34.

Which MySQL statement creates a new user?

a)

ADD USER

b)

CREATE USER

c)

NEW USER

d)

INSERT USER

35.

Which MySQL privilege allows a user to read data?

a)

SELECT

b)

INSERT

c)

DELETE

d)

UPDATE

36.

Which command is used to change user password?

a)

SET PASSWORD

b)

ALTER USER

c)

UPDATE PASSWORD

d)

CHANGE PASSWORD

37.

Which data type is suitable for storing monetary values?

a)

FLOAT

b)

DECIMAL

c)

DOUBLE

d)

INT

38.

What keyword removes duplicate records in a query result?

a)

UNIQUE

b)

ONLY

c)

DISTINCT

d)

FILTER

39.

Which function adds all numeric values?

a)

SUM()

b)

TOTAL()

c)

ADD()

d)

COUNT()

40.

Which keyword is used to join two tables based on a related column?

a)

UNITE

b)

MERGE

c)

JOIN

d)

CONNECT

41.

What command displays the structure of a table?

a)

SHOW TABLE

b)

DESCRIBE

c)

DISPLAY TABLE

d)

VIEW TABLE

42.

Which MySQL command creates a view?

a)

MAKE VIEW

b)

CREATE VIEW

c)

NEW VIEW

d)

ADD VIEW

43.

What command permanently removes all data and structure from a table?

a)

DELETE TABLE

b)

DROP TABLE

c)

CLEAR TABLE

d)

REMOVE TABLE

44.

Which SQL keyword is used to sort data descending?

a)

ORDER DESC

b)

ORDERBY DESC

c)

ORDER BY DESC

d)

SORT DESC

45.

Which clause combines results from multiple SELECT statements?

a)

UNION

b)

JOIN

c)

MERGE

d)

GROUP

46.

Which operator matches a pattern in MySQL?

a)

MATCH

b)

LIKE

c)

EQUAL

d)

SEARCH

47.

Which statement grants privileges to a user?

a)

ALLOW

b)

GRANT

c)

AUTHORIZE

d)

PERMIT

48.

Which statement removes privileges from a user?

a)

REVOKE

b)

REMOVE

c)

DENY

d)

DELETE

49.

Which keyword is used to eliminate duplicates in aggregate results?

a)

UNIQUE

b)

DISTINCT

c)

NO DUPLICATE

d)

EXCLUDE

50.

Which data type is best for storing long text?

a)

TEXT

b)

STRING

c)

VARCHAR

d)

CHAR

51.

Which command changes the name of an existing table?

a)

ALTER TABLE RENAME TO

b)

RENAME TABLE

c)

CHANGE NAME

d)

MODIFY TABLE NAME

52.

Which MySQL function counts only distinct values?

a)

COUNT()

b)

COUNT(DISTINCT)

c)

SUM()

d)

DISTINCTCOUNT()

53.

Which function rounds numbers to the nearest integer?

a)

ROUND()

b)

CEIL()

c)

FLOOR()

d)

TRUNC()

54.

Which function returns the current date?

a)

DATE()

b)

CURDATE()

c)

NOW()

d)

SYSDATE()

55.

Which function returns both current date and time?

a)

DATETIME()

b)

CURRENT()

c)

NOW()

d)

TIME()

56.

What is the default sorting order in ORDER BY clause?

a)

ASC

b)

DESC

c)

NONE

d)

RANDOM

57.

Which function counts non-null values in a column?

a)

SUM()

b)

COUNT()

c)

AVG()

d)

TOTAL()

58.

Which operator combines multiple SELECT results?

a)

UNION

b)

JOIN

c)

MERGE

d)

CONCAT

59.

Which MySQL clause restricts query results to a specific number of rows?

a)

LIMIT

b)

WHERE

c)

GROUP BY

d)

TOP

60.

Which keyword is used to delete a database?

a)

REMOVE DATABASE

b)

DELETE DATABASE

c)

DROP DATABASE

d)

ERASE DATABASE

61.

Which constraint enforces referential integrity?

a)

PRIMARY KEY

b)

UNIQUE

c)

FOREIGN KEY

d)

NOT NULL

62.

Which MySQL statement creates an index?

a)

MAKE INDEX

b)

CREATE INDEX

c)

ADD INDEX

d)

NEW INDEX

63.

Which command removes an index?

a)

DELETE INDEX

b)

DROP INDEX

c)

REMOVE INDEX

d)

CLEAR INDEX

64.

Which keyword is used to check a condition in SQL?

a)

CASE

b)

IF

c)

WHERE

d)

CHECK

65.

Which statement creates a stored procedure?

a)

CREATE PROCEDURE

b)

NEW PROCEDURE

c)

ADD PROCEDURE

d)

MAKE PROCEDURE

66.

Which command executes a stored procedure?

a)

RUN

b)

CALL

c)

EXECUTE

d)

START

67.

Which statement is used to create a trigger?

a)

CREATE TRIGGER

b)

MAKE TRIGGER

c)

NEW TRIGGER

d)

ADD TRIGGER

68.

Which statement permanently removes a trigger?

a)

DROP TRIGGER

b)

DELETE TRIGGER

c)

REMOVE TRIGGER

d)

CLEAR TRIGGER

69.

Which clause is used to rename a column?

a)

RENAME COLUMN

b)

ALTER TABLE CHANGE

c)

CHANGE COLUMN

d)

ALTER TABLE RENAME COLUMN

70.

Which data type is best for true/false values?

a)

BOOLEAN

b)

BIT

c)

TINYINT(1)

d)

ALL OF THE ABOVE

71.

Which function returns the length of a string?

a)

SIZE()

b)

LENGTH()

c)

STRLEN()

d)

CHARCOUNT()

72.

Which operator concatenates two strings in MySQL?

a)

+

b)

CONCAT()

c)

&

d)

||

73.

Which function converts text to uppercase?

a)

UPPER()

b)

UPCASE()

c)

TOUPPER()

d)

CAPS()

74.

Which function extracts a substring from a string?

a)

CUT()

b)

SUBSTRING()

c)

SLICE()

d)

EXTRACT()

75.

Which MySQL statement analyzes and optimizes a table?

a)

ANALYZE TABLE

b)

OPTIMIZE TABLE

c)

CHECK TABLE

d)

REPAIR TABLE