Bird
0
0

Which of the following is the correct syntax to combine two SELECT queries using UNION ALL in PostgreSQL?

easy📝 Syntax Q12 of 15
PostgreSQL - Set Operations and Advanced Queries
Which of the following is the correct syntax to combine two SELECT queries using UNION ALL in PostgreSQL?
ASELECT name FROM students UNION ALL SELECT name FROM teachers;
BSELECT name FROM students UNIONALL SELECT name FROM teachers;
CSELECT name FROM students UNION ALL FROM teachers;
DSELECT name FROM students UNION ALL SELECT name FROM teachers WHERE;
Step-by-Step Solution
Solution:
  1. Step 1: Check the correct keyword spacing

    The correct keyword is UNION ALL with a space between UNION and ALL.
  2. Step 2: Verify the SELECT statements are complete

    Both queries must be valid SELECT statements with matching column counts and types.
  3. Final Answer:

    SELECT name FROM students UNION ALL SELECT name FROM teachers; -> Option A
  4. Quick Check:

    Correct syntax uses 'UNION ALL' with space [OK]
Quick Trick: Use space between UNION and ALL, both queries must be valid [OK]
Common Mistakes:
  • Writing UNIONALL as one word
  • Missing SELECT in second query
  • Adding WHERE without condition

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes