1. Home
  2. Data Science
  3. SQL for Data Analysis
  4. How does SELECT * FROM a JOIN b USING (id) differ from the…

Added 30 Nov -0001

How does SELECT * FROM a JOIN b USING (id) differ from the same join written with ON a.id = b.id?

  1. USING retains only the columns that both of the joined tables share
  2. USING requires the join columns to carry identical names and NOT NULL
  3. The join column appears once, so an unqualified id becomes unambiguous Correct answer
  4. The join column appears twice, once per table, exactly as it does with ON

Correct answer

C. The join column appears once, so an unqualified id becomes unambiguous

22 views

MCQSEXAM

Explanation

USING names the join columns once, so the result has a single merged column and an unqualified reference to it resolves without ambiguity; with ON both columns survive and must be qualified. USING also suppresses the duplicate key that SELECT * would otherwise expose. The columns must share a name, but neither has to be declared NOT NULL for the join to work.

Reference

Asked in: NTS, PPSC IT, Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is C? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More SQL for Data Analysis MCQs

Practise all SQL for Data Analysis MCQs

Similar MCQs