TRUNCATE
The TRUNCATE TABLE
command deletes the data within a table. Unlike DROP
, it keeps the table's structure, indexes, and dependencies. If we wanted to remove all data entries from a table in a database while keeping the table albums structure but not the entries, we would use the SQL command below.
TEXT/X-SQL
1TRUNCATE TABLE albums;
2
3-- Check table with a query
4SELECT * FROM albums;
