NEW
Font size
WorksheetsMYSQL
Total questions: 80
Worksheet time: 40mins
What does SQL stand for?
Structured Question Language
Simple Query Language
Structured Query Language
Sequential Query Language
Which command is used to create a new database?
MAKE DATABASE
ADD DATABASE
CREATE DATABASE
BUILD DATABASE
Which data type is used to store variable-length strings?
char
varchar
text
blob
Which keyword is used to delete a table from a database?
REMOVE
DELETE
ERASE
DROP
What does the PRIMARY KEY do in a table?
Increases performance
Avoids null values
Uniquely identifies each row
Creates a new table
What command displays all tables in the current database?
SHOW TABLES
LIST TABLES
DISPLAY TABLES
SELECT * FROM database
How do you insert a row into a table named 'student'?
ADD TO student VALUES (...)
INSERT VALUES INTO student (...)
INSERT INTO student VALUES (...)
PUT INTO student VALUES (...)
Which clause is used to filter records?
ORDER BY
WHERE
LIMIT
SELECT
Which operator checks for a range of values?
LIKE
IN
BETWEEN
=
What does % represent in a LIKE pattern?
One character
Any number of characters
Numbers only
Wildcard for integers
Which command is used to modify existing records in a table?
EDIT
MODIFY
UPDATE
ALTER
How do you remove duplicate entries in a SELECT query?
REMOVE
DISTINCT
UNIQUE
NO DUPLICATE
What will ORDER BY salary DESC do?
Sort salaries alphabetically
Sort by default
Sort in ascending order
Sort salaries in descending order
Which function returns the number of records in a table?
COUNT()
LENGTH()
SUM()
MAX()
What does NOW() return?
System date only
Current timestamp
Current user's name
Nothing
Which clause is used to group records in SQL?
GROUP BY
SORT BY
COLLATE
AGGREGATE BY
Which clause filters grouped data?
WHERE
HAVING
SELECT
LIMIT
What keyword is used to create a foreign key?
FOREIGN
EXTERNAL
PARENT
LINK
Which join returns matching records from both tables?
LEFT JOIN
RIGHT JOIN
CROSS JOIN
INNER JOIN
What is the purpose of UNION in SQL?
Combines tables vertically
Adds columns
Joins tables on keys
Deletes duplicate records
What does AUTO_INCREMENT do?
Makes field unique
Increases salary
Automatically increases numeric values
Repeats values
Which constraint ensures values are not duplicated?
NOT NULL
CHECK
UNIQUE
DEFAULT
What does VIEW represent in SQL?
A function
A stored procedure
A virtual table
A backup
Which clause limits the number of records returned?
RESTRICT
LIMIT
STOP
COUNT
Which function returns the average of a numeric column?
AVG()
MEAN()
AVERAGE()
SUM()
What does the DECIMAL(3,2) data type mean for gpa?
3 digits with no decimals
Up to 3 digits total, 2 after the decimal
3 digits before and after decimal
2 digits total, 3 after the decimal
What happens to the gpa field here?
It defaults to 0
It throws an error if gpa is NOT NULL
It gets NULL
It stores "Not Assigned"
This query will fetch students whose names...
End with 'A'
Contain 'A'
Start with 'A'
Are exactly 'A'
This query returns...
Total salary of all employees
Total salary of managers
Average salary of managers
Number of managers
What does this query do?
Deletes column with id 5
Deletes the employee with emp_id 5
Deletes all employees
Deletes entire table
What does this query do?
Creates a new table
Adds a column named department
Deletes a column
Renames the table
The result of this query will...
Sort by job_desc
Show all employees randomly
Show employees with highest salary at top
Show employees with lowest salary at top
This query returns...
Total employees
Sum of HR salaries
Count of HR employees
All HR employees
This Query Will..
Decrease salary
Increase salary for all engineers
Add 5000 to all salaries
Change job_desc
This query retrieves employees with salary...
Less than 2,000,000
More than 3,000,000
Exactly 2,000,000 or 3,000,000
Between 2M and 3M inclusive
This returns employees who are...
HR or Admin
Not HR or Admin
Only HR
Only Admin
What does AUTO_INCREMENT do here?
Sets default address
Prevents null values
Auto-increments branch_id for each insert
Makes column unique only
This query will...
Remove salary
Format salary with commas
Convert salary to string
Round salary to nearest 10
What is returned?
Time only
Current date
Time since login
Today's weekday
This returns...
Total salary
Count of employees in each job_desc
Average salary
Employee list
This will...
Limit salaries
Display 5 random rows
Display first 5 rows
Skip 5 rows
What is emp_br?
A new table
A function
A stored procedure
A virtual table (view)
This is an example of...
Inner join
Right join
Left join
Cross join
This returns...
First salary
Average salary
Lowest salary
Highest salary
If salary has a CHECK(salary > 100000), this will...
Insert successfully
Insert and ignore check
Throw an error
Insert 100000 instead
This query returns names where...
i is the first letter
i is the second letter
i is the third letter
i is at the end
This query will...
Remove branch_id data only
Delete branch_id column
Delete entire table
Add branch_id
What does this return?
Number of words in name
Employee age
Length of each name
Job description
What will this return?
Lowercase names
Encrypted names
Uppercase names
NULLs
What does this query do?
Joins columns
Joins on key
Combines both tables including duplicates
Removes duplicate entries
What does this query return?
All employees
Employees working in Chennai and Mumbai, ordered by salary
Employees from Coimbatore only
All branches
Which job roles will be displayed?
All job roles
Job roles having more than one employee with salary above 25L
Only MANAGER
None, query will fail
This query returns...
Most recently hired employee
Employee with oldest hire date
Employees without hire date
Employee ID with max salary
This query will show...
Branches without employees only
Branches with number of employees, including those with 0
Only joined data
Branches where emp_id > 10
What will this query return?
All employees
Employee with minimum salary
Employee with maximum salary
Employees with NULL salary
What is this query used for?
Formatting salaries
Getting employees without branch assigned
Displaying employee count
Fetching branches with salary
What is the output here?
All job roles
Job roles with average salary above 25L in 20L–50L range
All salaries
No output
Purpose of this query?
Sort by job
Classify employees based on salary
Group by job_desc
Assign bonus
Output of this query?
All engineers
Engineer with max salary
NULL
Error due to subquery
What is emp_with_branch?
A physical table
A virtual table (view)
A function
A trigger
This query fetches...
Employees in all branches
Employees without valid branch assignment
Branch names
All records
What is this checking?
Salary difference by job
Total salary
Average salary
Highest paid employee
Output of this query?
Total employees hired
Employees hired in 2022 by branch
Employees hired after 2022
Nothing
What does this subquery do?
Nothing
Counts total branches
Counts employees per branch
Filters employees
What is displayed here?
Total company salary
Top 2 job roles by total salary
Highest paid employee
Top 2 branches
What is the output of this query?
Branches with employees
Branches that have no employees assigned
Employees without branch
Employees in multiple branches
This nested query gives...
All job types
Job with highest number of employees
Employee with max salary
Employee count < 2
This query filters employees whose salary is...
Less than any HR salary
Greater than all HR salaries
Equal to HR
Only HR employees
What does this subquery fetch?
Engineer with max salary
Engineer with min salary
All engineers
All employees
The output of this query shows...
Only CEO
Count of job roles with avg salary above 25L
Top 2 salaries
All salaries
Highest branch
Branches with high paid employees
Branches with no one earning above 15L
Employee list
Employee list
What is happening here?
All salaries updated
Engineers get a 1L hike
Engineers get a 1L hike
No update
This returns employees whose salary is...
Less than all
Greater than average salary of MANAGER
Only CEO
Less than average
What does this view store?
Engineers with all salaries
Engineers with salary above 25L
All employees
Managers only
This returns...
All salaries
Only highest
Only lowest
Only managers
This filters...
All branches
Branch names ending with "ai"
Engineer list
NULL branches
What is this query doing?
Group by month
Tagging employee based on hire month
Filtering salary
Filtering salary
This returns...
Employees in view
Employees not part of view emp_with_branch
All employees
Branch list
What will this return?
Branch with most employees
Branch with least employees
All branches
Error
Who is returned by this query?
3rd highest paid employee
3rd lowest
Highest
Highest
