What is the primary clause used to retrieve data from a table in SQL?
GET
FETCH
SELECT
RETRIEVE
Which type of subquery is used to check if a value exists in a list of values returned by another query?
EXISTS Subquery
IN Subquery
Nested Subquery
Correlated Subquery
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.
There is no difference; they are interchangeable.
IN checks for existence in a list, while EXISTS checks for existence in a table.
IN compares values, while EXISTS checks for the presence of rows.
What is the purpose of the 'OR' operator in a SQL WHERE clause?
It negates a condition.
It limits the number of rows returned.
It selects rows where both conditions are true.
It selects rows where at least one condition is true.
To modify existing data in a table, which SQL statement would you use?
MODIFY
CHANGE
UPDATE
ALTER
How would you sort results in descending order by the 'date_created' column?
SORT BY date_created DESC
SORT BY date_created ASC
ORDER BY date_created ASC
ORDER BY date_created DESC
You want to find customers who have placed orders in the last month. You have two tables: 'Customers' and 'Orders'. Which subquery type would be most efficient to achieve this?
Any of the above would be equally efficient.
In which scenario would a subquery be a more suitable choice than a JOIN operation?
When you need to combine data from multiple tables based on a common column.
When you need to sort 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.
In a SQL query, what does the logical operator 'AND' do?
It combines two conditions, and both conditions must be true for the row to be included.
It sorts the results in descending order.
It combines two conditions, and at least one condition must be true for the row to be included.
Which SQL clause is used to sort the result set?
SORT BY
SORT
ORDER BY
ORDER