What SQL keyword is used to retrieve all columns from a table?
Answer: `SELECT `
What clause is used to filter rows in a query?
Answer: `WHERE`
What clause is used to sort query results?
Answer: `ORDER BY`
What type of join returns only matching records from both tables?
Answer: `INNER JOIN`
What SQL keyword is used for conditional logic within a query?
Answer: `CASE`
What clause is used to specify the table from which data will be retrieved?
Answer: `FROM`
Which operator is used to check if a value is within a specified range?
Answer: `BETWEEN ... AND ...`
How do you retrieve only the top 5 rows in Oracle SQL?
Answer: Use `FETCH FIRST 5 ROWS ONLY`
What type of join returns all records from the left table and matching records from the right table?
Answer: `LEFT JOIN`
What are the three main logical operators in SQL?
Answer: `AND`, `OR`, `NOT`
If a table contains 10,000 rows, how many rows will `SELECT * FROM employees;` return?
Answer: 10,000
What keyword would you use to filter out duplicate values in a result set?
Answer: `DISTINCT`
What is the default sorting order in an `ORDER BY` clause?
Answer: Ascending (`ASC`)
If Table A has 10 rows and Table B has 5 rows, what is the maximum number of rows returned by an INNER JOIN on a non-key column?
Answer: It depends on matching values; if one row in A matches multiple in B, more than 5 rows can be returned.
If `age = 25`, what does `WHERE age < 30 AND age > 40` return?
Answer: No rows, because 25 is not greater than 40.
True or False: The `SELECT` statement is executed before the `ORDER BY` clause in Oracle SQL.
Answer: False – `ORDER BY` is processed last in the logical execution order.
What is the result of `WHERE salary > 5000 AND salary < 5000`?
Answer: No rows are returned, as no value can be both greater and less than 5000 at the same time
If two rows have the same values in the `ORDER BY` column, how does SQL determine their order?
Answer: Oracle does not guarantee order for identical values unless a secondary sort column is specified.
True or False: A `LEFT JOIN` can return more rows than the original left table.
Answer: True – if the right table has multiple matches for a single left-table row, duplicates occur
If `salary = NULL`, what is the result of `WHERE salary = 5000 OR salary = NULL`?
Answer: No rows, because `NULL` cannot be compared with `=`
What happens if you run `SELECT department FROM employees;` but the `department` column doesn’t exist in the table?
Answer: Oracle returns an error: "invalid identifier."
If you filter data using `WHERE last_name = 'O'Reilly'`, what will happen?
Answer: Syntax error due to an unescaped single quote; you should use `WHERE last_name = 'O''Reilly'`
What happens if you use `ORDER BY column_name DESC` but the column contains `NULL` values?
Answer: `NULL` values appear first unless `NULLS LAST` is specified
What happens when a `JOIN` condition is missing?
A Cartesian product is produced, multiplying the row count of both tables.
Given the query `SELECT CASE WHEN salary > 5000 THEN 'High' ELSE 'Low' END AS SalaryGroup FROM employees;`, what happens if `salary` is NULL?
Answer: It falls into the `ELSE` category, returning "Low."