Bird
0
0

Which of the following is the correct syntax to start a CTE in SQL?

easy📝 Syntax Q12 of 15
SQL - Common Table Expressions (CTEs)
Which of the following is the correct syntax to start a CTE in SQL?
AWITH cte_name AS (SELECT * FROM table_name)
BCREATE CTE cte_name SELECT * FROM table_name
CDEFINE cte_name AS SELECT * FROM table_name
DSTART CTE cte_name (SELECT * FROM table_name)
Step-by-Step Solution
Solution:
  1. Step 1: Recall standard CTE syntax

    The correct way to define a CTE is using the WITH keyword followed by the CTE name and AS, then the query in parentheses.
  2. Step 2: Check other options for syntax errors

    Options A, C, and D use incorrect keywords like CREATE, DEFINE, or START which are not valid for CTEs.
  3. Final Answer:

    WITH cte_name AS (SELECT * FROM table_name) -> Option A
  4. Quick Check:

    CTE starts with WITH ... AS (...) = B [OK]
Quick Trick: CTEs always start with WITH keyword [OK]
Common Mistakes:
  • Using CREATE instead of WITH
  • Omitting AS keyword
  • Not enclosing query in parentheses

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes