2 2 votes Consider:SQL Statement $\mathbf{1}$$\mathrm{SELECT\ *}$ $\mathrm{FROM\ R}$ $\mathrm{UNION}$ $\mathrm{SELECT\ *}$ $\mathrm{FROM\ R}$;SQL Statement $\mathbf{2}$$\mathrm{SELECT\ *}$ $\mathrm{FROM\ R}$;What is the necessary and sufficient condition for SQL $1$ and SQL $2$ to always produce identical results for table $\mathrm{R}$?No row of $\mathrm{R}$ contains a $\mathrm{NULL}$. $\mathrm{R}$ contains zero rows. $\mathrm{R}$ contains no duplicate rows. $\mathrm{R}$ contains exactly one column. Databases goclasses goclasses-da-dpp goclasses-da-dpp-day-287 goclasses-cs-dpp goclasses-cs-dpp-day-385 databases goclasses-databases-practice-questions database-sql sql + – GO Classes 117 views answer comment Share Follow Print See 1 comment 1 1 comment reply ghosharkoprabho commented Oct 2 reply Follow flag union mai duplicate remove 0 0 replyShare Please log in or register to add a comment.
0 0 votes Therefore the two results differ whenever $\mathrm{R}$ contains duplicate tuples.If $\mathrm{R}$ contains no duplicate rows, removing duplicates changes nothing.Hence,$\mathrm{SQL\ 1}=\mathrm{SQL\ 2}$ exactly when $\mathrm{R}$ has no duplicate rows.So C is both necessary and sufficient.Hence,Answer : $\boxed{\mathrm{C}}$ GO Classes answered Sep 30 GO Classes comment Share Follow 0 reply Please log in or register to add a comment.