Subqueries & CTEs · Question 5 · Easy

Which keyword starts a common table expression (CTE), a named result that the main query can then use like a table?

  1. WITH
  2. HAVING
  3. DECLARE
  4. USING
Answer and explanation

Answer: A. WITH

Explanation: A CTE is written as WITH name AS (SELECT ...) followed by the main query. It exists only for that one statement.

Previous: Table Faculty: fid | name | dept | salary 1 | Anand | CSE | 90000 2 | Bhavna |… · Next: Table Faculty: fid | name | dept | salary 1 | Anand | CSE | 90000 2 | Bhavna |…

Practise subqueries & ctes

Try a fresh set of subqueries & ctes questions with an explanation after every answer, free and without signing up: Subqueries & CTEs practice. Or sit a full placement mock test.

More subqueries & ctes questions

More sql practice

Window Functions · NULL Handling · SQL Functions & CASE · UNION, INTERSECT & EXCEPT · Tables, Keys & Constraints · DML & Transactions · SELECT, WHERE & ORDER BY · SQL Joins

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge