Questenaتمرینی که نشان می‌دهد بعد چه چیزی را مرور کنید
سؤال 11

In PostgreSQL 18, table na has columns (a_id, label) and 3 rows, table nb has columns (b_id, note) and 2 rows, and the two tables share no column name. How many rows does SELECT * FROM na NATURAL JOIN nb; return?

  1. It raises an error because there is no common column
  2. 0
  3. 6پاسخ درست
  4. 3

توضیح

NATURAL builds a USING list from the column names present in both tables; when that list is empty there is no join condition left and the statement degenerates into a Cartesian product of 3 x 2 rows. Expecting an error or zero rows assumes PostgreSQL treats a missing common column as a failure, which is exactly why NATURAL is risky under schema change.

ادامهٔ این آزمون

شروع تمرین
سؤال 11: In PostgreSQL 18, table na has columns (a_id, label) and 3… · SQL: NULL, Joins and Aggregates · Questena