All Exams Test series for 1 year @ ₹349 only
Question

Consider the following two commands C1 and C2 on the relation R from an SQL database :
C1 : drop table R;
C2 : delete from R;
Which of the following statements is TRUE ?
I. Both C1 and C2 delete the schema for R.
II. C2 retains relation R, but deletes all tuples in R.
III. C1 deletes not only all tuples of R, but also the schema for R.

The correct answer is
II and III only

SQL Command Analysis: DROP vs DELETE

This solution analyzes the impact of two SQL commands, $C1: DROP TABLE R;$ and $C2: DELETE FROM R;$, on a database relation $R$.

Understanding C1: $DROP TABLE R;$

  • $DROP TABLE R;$ completely removes the table named $R$ from the database.
  • This action deletes both the table's structure (schema) and all the data (tuples) it contains.
  • The table $R$ ceases to exist after this command.

Understanding C2: $DELETE FROM R;$

  • $DELETE FROM R;$ removes all the rows (tuples) from the table $R$.
  • However, this command leaves the table's structure (schema) intact.
  • The table $R$ still exists but becomes empty.

Evaluating Statement Truthfulness

  • Statement I: Both C1 and C2 delete the schema for R.
    • C1 deletes the schema.
    • C2 does not delete the schema.
    • Therefore, Statement I is False.
  • Statement II: C2 retains relation R, but deletes all tuples in R.
    • C2 deletes all tuples.
    • C2 retains the relation R (its schema).
    • Therefore, Statement II is True.
  • Statement III: C1 deletes not only all tuples of R, but also the schema for R.
    • C1 deletes all tuples.
    • C1 deletes the schema for R.
    • Therefore, Statement III is True.

Conclusion on Statements

Based on the analysis, statements II and III are true.

Was this answer helpful?

Important Questions from SQL

  1. In SQL, _______ is an Aggregate function.

  2. Match the following -

    List IList II
    (a)DDL(i)LOCK TABLE
    (b)DML(ii)COMMIT
    (c)TCL(iii)Natural Difference
    (d)Binary operation(iv)REVOKE
  3. In SQL, which of the following command is used to modify a column in a table?

  4. Which of the following keyword is used to eliminate duplicate records in SQL?

  5. _______ SQL command changes one or more fields in a record.

Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App