In which scenario would a subquery be a more suitable choice than a JOIN operation?
When you need to sort data from multiple tables based on a common column.
When you need to combine data from multiple tables based on a common column.
When you need to update data in one table based on data from another table.
When you need to filter data based on a condition that involves a separate query.
You want to select the department with the highest average salary. What SQL clause would you use to filter the grouped results based on the calculated average salary?
HAVING
LIMIT
ORDER BY
WHERE
Which data type would be most suitable for storing a person's last name in a SQL database?
VARCHAR
DATE
INTEGER
DECIMAL
What is the result of SELECT NOW(); in SQL?
SELECT NOW();
Current date
Current time
Current date and time
An error message
What is the function of the SQL 'WHERE' clause?
To filter records based on a specified condition
To order the results of a query
To limit the number of rows returned by a query
To group rows with the same value in a certain column
What is the key difference between the IN and EXISTS operators when used with subqueries?
IN is used for single values, while EXISTS is used for multiple values.
IN checks for existence in a list, while EXISTS checks for existence in a table.
There is no difference; they are interchangeable.
IN compares values, while EXISTS checks for the presence of rows.
What type of join returns all rows from the left table, even if there are no matching rows in the right table?
RIGHT JOIN
INNER JOIN
FULL JOIN
LEFT JOIN
Which keyword is used in conjunction with the UPDATE statement to specify the conditions for updating rows?
WHEN
CONDITION
IF
What is the difference between CURDATE() and NOW() in SQL?
CURDATE()
NOW()
CURDATE() returns the current date, NOW() returns the current time.
CURDATE() returns the current date, NOW() returns the current date and time.
CURDATE() returns the current date and time, NOW() returns the current date.
They are interchangeable.
Which comparison operator means 'not equal to' in SQL?
<
!=
<>
=