wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

MYSQL

Total questions: 80

Worksheet time: 40mins

Name
Class
Date
1.

What does SQL stand for?

a)

Structured Question Language

b)

Simple Query Language

c)

Structured Query Language

d)

Sequential Query Language

2.

Which command is used to create a new database?

a)

MAKE DATABASE

b)

ADD DATABASE

c)

CREATE DATABASE

d)

BUILD DATABASE

3.

Which data type is used to store variable-length strings?

a)

char

b)

varchar

c)

text

d)

blob

4.

Which keyword is used to delete a table from a database?

a)

REMOVE

b)

DELETE

c)

ERASE

d)

DROP

5.

What does the PRIMARY KEY do in a table?

a)

Increases performance

b)

Avoids null values

c)

Uniquely identifies each row

d)

Creates a new table

6.

What command displays all tables in the current database?

a)

SHOW TABLES

b)

LIST TABLES

c)

DISPLAY TABLES

d)

SELECT * FROM database

7.

How do you insert a row into a table named 'student'?

a)

ADD TO student VALUES (...)

b)

INSERT VALUES INTO student (...)

c)

INSERT INTO student VALUES (...)

d)

PUT INTO student VALUES (...)

8.

Which clause is used to filter records?

a)

ORDER BY

b)

WHERE

c)

LIMIT

d)

SELECT

9.

Which operator checks for a range of values?

a)

LIKE

b)

IN

c)

BETWEEN

d)

=

10.

What does % represent in a LIKE pattern?

a)

One character

b)

Any number of characters

c)

Numbers only

d)

Wildcard for integers

11.

Which command is used to modify existing records in a table?

a)

EDIT

b)

MODIFY

c)

UPDATE

d)

ALTER

12.

How do you remove duplicate entries in a SELECT query?

a)

REMOVE

b)

DISTINCT

c)

UNIQUE

d)

NO DUPLICATE

13.

What will ORDER BY salary DESC do?

a)

Sort salaries alphabetically

b)

Sort by default

c)

Sort in ascending order

d)

Sort salaries in descending order

14.

Which function returns the number of records in a table?

a)

COUNT()

b)

LENGTH()

c)

SUM()

d)

MAX()

15.

What does NOW() return?

a)

System date only

b)

Current timestamp

c)

Current user's name

d)

Nothing

16.

Which clause is used to group records in SQL?

a)

GROUP BY

b)

SORT BY

c)

COLLATE

d)

AGGREGATE BY

17.

Which clause filters grouped data?

a)

WHERE

b)

HAVING

c)

SELECT

d)

LIMIT

18.

What keyword is used to create a foreign key?

a)

FOREIGN

b)

EXTERNAL

c)

PARENT

d)

LINK

19.

Which join returns matching records from both tables?

a)

LEFT JOIN

b)

RIGHT JOIN

c)

CROSS JOIN

d)

INNER JOIN

20.

What is the purpose of UNION in SQL?

a)

Combines tables vertically

b)

Adds columns

c)

Joins tables on keys

d)

Deletes duplicate records

21.

What does AUTO_INCREMENT do?

a)

Makes field unique

b)

Increases salary

c)

Automatically increases numeric values

d)

Repeats values

22.

Which constraint ensures values are not duplicated?

a)

NOT NULL

b)

CHECK

c)

UNIQUE

d)

DEFAULT

23.

What does VIEW represent in SQL?

a)

A function

b)

A stored procedure

c)

A virtual table

d)

A backup

24.

Which clause limits the number of records returned?

a)

RESTRICT

b)

LIMIT

c)

STOP

d)

COUNT

25.

Which function returns the average of a numeric column?

a)

AVG()

b)

MEAN()

c)

AVERAGE()

d)

SUM()

26.

What does the DECIMAL(3,2) data type mean for gpa?

a)

3 digits with no decimals

b)

Up to 3 digits total, 2 after the decimal

c)

3 digits before and after decimal

d)

2 digits total, 3 after the decimal

27.

What happens to the gpa field here?

a)

It defaults to 0

b)

It throws an error if gpa is NOT NULL

c)

It gets NULL

d)

It stores "Not Assigned"

28.

This query will fetch students whose names...

a)

End with 'A'

b)

Contain 'A'

c)

Start with 'A'

d)

Are exactly 'A'

29.

This query returns...

a)

Total salary of all employees

b)

Total salary of managers

c)

Average salary of managers

d)

Number of managers

30.

What does this query do?

a)

Deletes column with id 5

b)

Deletes the employee with emp_id 5

c)

Deletes all employees

d)

Deletes entire table

31.

What does this query do?

a)

Creates a new table

b)

Adds a column named department

c)

Deletes a column

d)

Renames the table

32.

The result of this query will...

a)

Sort by job_desc

b)

Show all employees randomly

c)

Show employees with highest salary at top

d)

Show employees with lowest salary at top

33.

This query returns...

a)

Total employees

b)

Sum of HR salaries

c)

Count of HR employees

d)

All HR employees

34.

This Query Will..

a)

Decrease salary

b)

Increase salary for all engineers

c)

Add 5000 to all salaries

d)

Change job_desc

35.

This query retrieves employees with salary...

a)

Less than 2,000,000

b)

More than 3,000,000

c)

Exactly 2,000,000 or 3,000,000

d)

Between 2M and 3M inclusive

36.

This returns employees who are...

a)

HR or Admin

b)

Not HR or Admin

c)

Only HR

d)

Only Admin

37.

What does AUTO_INCREMENT do here?

a)

Sets default address

b)

Prevents null values

c)

Auto-increments branch_id for each insert

d)

Makes column unique only

38.

This query will...

a)

Remove salary

b)

Format salary with commas

c)

Convert salary to string

d)

Round salary to nearest 10

39.

What is returned?

a)

Time only

b)

Current date

c)

Time since login

d)

Today's weekday

40.

This returns...

a)

Total salary

b)

Count of employees in each job_desc

c)

Average salary

d)

Employee list

41.

This will...

a)

Limit salaries

b)

Display 5 random rows

c)

Display first 5 rows

d)

Skip 5 rows

42.

What is emp_br?

a)

A new table

b)

A function

c)

A stored procedure

d)

A virtual table (view)

43.

This is an example of...

a)

Inner join

b)

Right join

c)

Left join

d)

Cross join

44.

This returns...

a)

First salary

b)

Average salary

c)

Lowest salary

d)

Highest salary

45.

If salary has a CHECK(salary > 100000), this will...

a)

Insert successfully

b)

Insert and ignore check

c)

Throw an error

d)

Insert 100000 instead

46.

This query returns names where...

a)

i is the first letter

b)

i is the second letter

c)

i is the third letter

d)

i is at the end

47.

This query will...

a)

Remove branch_id data only

b)

Delete branch_id column

c)

Delete entire table

d)

Add branch_id

48.

What does this return?

a)

Number of words in name

b)

Employee age

c)

Length of each name

d)

Job description

49.

What will this return?

a)

Lowercase names

b)

Encrypted names

c)

Uppercase names

d)

NULLs

50.

What does this query do?

a)

Joins columns

b)

Joins on key

c)

Combines both tables including duplicates

d)

Removes duplicate entries

51.

What does this query return?

a)

All employees

b)

Employees working in Chennai and Mumbai, ordered by salary

c)

Employees from Coimbatore only

d)

All branches

52.

Which job roles will be displayed?

a)

All job roles

b)

Job roles having more than one employee with salary above 25L

c)

Only MANAGER

d)

None, query will fail

53.

This query returns...

a)

Most recently hired employee

b)

Employee with oldest hire date

c)

Employees without hire date

d)

Employee ID with max salary

54.

This query will show...

a)

Branches without employees only

b)

Branches with number of employees, including those with 0

c)

Only joined data

d)

Branches where emp_id > 10

55.

What will this query return?

a)

All employees

b)

Employee with minimum salary

c)

Employee with maximum salary

d)

Employees with NULL salary

56.

What is this query used for?

a)

Formatting salaries

b)

Getting employees without branch assigned

c)

Displaying employee count

d)

Fetching branches with salary

57.

What is the output here?

a)

All job roles

b)

Job roles with average salary above 25L in 20L–50L range

c)

All salaries

d)

No output

58.

Purpose of this query?

a)

Sort by job

b)

Classify employees based on salary

c)

Group by job_desc

d)

Assign bonus

59.

Output of this query?

a)

All engineers

b)

Engineer with max salary

c)

NULL

d)

Error due to subquery

60.

What is emp_with_branch?

a)

A physical table

b)

A virtual table (view)

c)

A function

d)

A trigger

61.

This query fetches...

a)

Employees in all branches

b)

Employees without valid branch assignment

c)

Branch names

d)

All records

62.

What is this checking?

a)

Salary difference by job

b)

Total salary

c)

Average salary

d)

Highest paid employee

63.

Output of this query?

a)

Total employees hired

b)

Employees hired in 2022 by branch

c)

Employees hired after 2022

d)

Nothing

64.

What does this subquery do?

a)

Nothing

b)

Counts total branches

c)

Counts employees per branch

d)

Filters employees

65.

What is displayed here?

a)

Total company salary

b)

Top 2 job roles by total salary

c)

Highest paid employee

d)

Top 2 branches

66.

What is the output of this query?

a)

Branches with employees

b)

Branches that have no employees assigned

c)

Employees without branch

d)

Employees in multiple branches

67.

This nested query gives...

a)

All job types

b)

Job with highest number of employees

c)

Employee with max salary

d)

Employee count < 2

68.

This query filters employees whose salary is...

a)

Less than any HR salary

b)

Greater than all HR salaries

c)

Equal to HR

d)

Only HR employees

69.

What does this subquery fetch?

a)

Engineer with max salary

b)

Engineer with min salary

c)

All engineers

d)

All employees

70.

The output of this query shows...

a)

Only CEO

b)

Count of job roles with avg salary above 25L

c)

Top 2 salaries

d)

All salaries

71.

Highest branch

a)

Branches with high paid employees

b)

Branches with no one earning above 15L

c)

Employee list

d)

Employee list

72.

What is happening here?

a)

All salaries updated

b)

Engineers get a 1L hike

c)

Engineers get a 1L hike

d)

No update

73.

This returns employees whose salary is...

a)

Less than all

b)

Greater than average salary of MANAGER

c)

Only CEO

d)

Less than average

74.

What does this view store?

a)

Engineers with all salaries

b)

Engineers with salary above 25L

c)

All employees

d)

Managers only

75.

This returns...

a)

All salaries

b)

Only highest

c)

Only lowest

d)

Only managers

76.

This filters...

a)

All branches

b)

Branch names ending with "ai"

c)

Engineer list

d)

NULL branches

77.

What is this query doing?

a)

Group by month

b)

Tagging employee based on hire month

c)

Filtering salary

d)

Filtering salary

78.

This returns...

a)

Employees in view

b)

Employees not part of view emp_with_branch

c)

All employees

d)

Branch list

79.

What will this return?

a)

Branch with most employees

b)

Branch with least employees

c)

All branches

d)

Error

80.

Who is returned by this query?

a)

3rd highest paid employee

b)

3rd lowest

c)

Highest

d)

Highest