Welcome to your SQL
SQL
Which SQL keyword is used to remove duplicate rows from a result set?
UNIQUE
DISTINCT
REMOVE
DIFFERENT
None
SQL
Which SQL clause is used to filter records?
WHERE
ORDER BY
GROUP BY
HAVING
None
SQL
Which SQL command is used to save all changes made during the transaction?
COMMIT
EXECUTE
APPLY
SAVE
None
SQL
What is the purpose of the EXPLAIN command in SQL?
Explains syntax errors
Shows data
Displays the execution plan of a query
Lists all tables
None
SQL
What does a clustered index do?
Creates a secondary data structure
Sorts and stores data rows in order
Optimizes joins
Prevents duplication
None
SQL
Which of these joins returns all records when there is a match in either table?
INNER JOIN
LEFT JOIN
FULL OUTER JOIN
RIGHT JOIN
None
SQL
What will the query SELECT COUNT(DISTINCT department_id) return?
Total unique department IDs
Total null department IDs
Total employees
Total departments
None
SQL
Which of the following is used to prevent duplicate entries in a table?
CHECK constraint
DEFAULT constraint
UNIQUE constraint
FOREIGN KEY constraint
None
SQL
What does the ON DELETE CASCADE option do?
Prevents deletion
Deletes related rows when a parent row is deleted
Ignores delete operation
Deletes all records in the table
None
SQL
Which of the following can improve query performance?
Using SELECT *
Adding indexes
Removing indexes
Increasing columns
None
SQL
What is a subquery?
A stored procedure
A query that runs independently
A system query
A query inside another query
None
SQL
Which function is used to return the current date in SQL?
DATE()
SYSDATE()
NOW()
CURRENT()
None
SQL
Which SQL statement is used to combine rows from two or more tables?
INTERSECT
COMBINE
JOIN
UNION
None
SQL
What does the GROUP BY clause do?
Filters data
Groups rows with the same values
Sorts data
Deletes duplicates
None
SQL
Which SQL constraint ensures that all values in a column are unique?
FOREIGN KEY
UNIQUE
NOT NULL
PRIMARY KEY
None
SQL
Which SQL statement is used to create a new table?
MAKE TABLE
NEW TABLE
ADD TABLE
CREATE TABLE
None
SQL
Which function returns the average value of a numeric column?
MEDIAN()
MEAN()
SUM()
AVG()
None
What is a foreign key used for?
To allow duplicate records
To encrypt data
To uniquely identify each record
To enforce referential integrity between tables
None
SQL
What is the difference between INNER JOIN and LEFT JOIN?
LEFT JOIN excludes matching rows
Both are the same
INNER JOIN includes unmatched rows
LEFT JOIN includes all rows from the left table
None
SQL
Which keyword is used to rename a column or table in SQL?
ALIAS
RENAME
AS
UPDATE
None
SQL
Which of the following is a valid SQL data type?
Integer
Float
String
Both a and c
None
SQL
What is the purpose of the LIMIT clause?
To filter rows
To count rows
To specify the maximum number of rows to return
To define constraints
None
SQL
Which aggregate function returns the highest value in a column?
UPPER()
MAX()
HIGH()
TOP()
None
SQL
Which SQL keyword is used to sort results?
FILTER
GROUP BY
ORDER BY
SORT
None
SQL
Which of the following statements will delete all rows in a table named ‘students’? a) b) c) d)
CLEAR TABLE students;
DELETE FROM students;
DROP students;
REMOVE * FROM students;
None
Time's up
Common Jobs
Jobs
Referrals
My Profile