CS FundamentalsEasyHCL · Tech Mahindra pattern
Which statement about the SQL command TRUNCATE TABLE is correct?
- A. It removes rows matching a WHERE clause
- B. It removes all rows but keeps the table structure
- C. It removes the table definition along with its data
- D. It only removes rows whose columns are NULL
Correct answer: B. It removes all rows but keeps the table structure
TRUNCATE empties the table and keeps its structure; DROP removes the table itself; DELETE can remove selected rows with WHERE.
More DBMS and SQL questions
- Table Emp(id, name, dept, salary, mgr) rows: (1, 'Asha', 'HR', 50000, NULL), (2, 'Ravi', 'IT', 70000, 1), (3, 'Meena', 'IT', 70000, 2)…
- Table Emp(id, name, dept, salary, mgr) rows: (1, 'Asha', 'HR', 50000, NULL), (2, 'Ravi', 'IT', 70000, 1), (3, 'Meena', 'IT', 70000, 2)…
- Two tables have 6 rows and 4 rows. How many rows does SELECT FROM A, B; (no WHERE clause) return?
- A relation is in 2NF if it is in 1NF and:
- R(A, B, C, D) has functional dependencies A → B and B → C. What is the candidate key of R?
- Which statement about a clustered index is correct?