SQL · Question 3 · Easy
Which SQL command removes all rows from a table but keeps the table structure, and is classified as a DDL command?
- DELETE
- DROP
- ALTER
- TRUNCATE
Answer and explanation
Answer: D. TRUNCATE
Explanation: TRUNCATE is DDL and removes all rows while the table definition stays. DELETE is DML and removes rows one by one (optionally with WHERE), and DROP removes the table itself.
Previous: Table Employee: id | name | dept | salary 1 | Asha | HR | 30000 2 | Ravi | IT… · Next: Which constraint ensures that all non-NULL values in a column are distinct…
Practise sql
Try a fresh set of sql questions with an explanation after every answer, free and without signing up: SQL practice. Or sit a full placement mock test.
More sql questions
- Which SQL clause is used to filter groups formed by GROUP BY, for example to…
- Table Employee: id | name | dept | salary 1 | Asha | HR | 30000 2 | Ravi | IT…
- Which constraint ensures that all non-NULL values in a column are distinct…
- Table Employee: id | name | dept | salary 1 | Asha | HR | 30000 2 | Ravi | IT…
- Table Employee: id | name | dept | salary 1 | Asha | HR | 30000 2 | Ravi | IT…
- Table Employee: id | name | dept | salary 1 | Asha | HR | 30000 2 | Ravi | IT…
- Table Employee: id | name | dept | salary 1 | Asha | HR | 30000 2 | Ravi | IT…
- Using a table Employee(id, name, dept, salary), which of the following queries…
- Table Employee: id | name | dept | salary 1 | Asha | HR | 30000 2 | Ravi | IT…
- Table Employee: id | name | dept | salary 1 | Asha | HR | 30000 2 | Ravi | IT…
More technical & programming practice
Operating Systems · Computer Networks · Software Engineering · Cloud & DevOps · GenAI Basics · Pseudo-code · C Programming · Java
LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge