DELETE FROM films;
I'm surprised databases makes it so easy to just delete an entire table. I think the command should be DELETE FROM films YES-I-KNOW-WHAT-I-AM-DOING; DELETE FROM films;
I'm surprised databases makes it so easy to just delete an entire table. I think the command should be DELETE FROM films YES-I-KNOW-WHAT-I-AM-DOING;If you really want to just delete everything, just do WHERE 1=1.
At which point we could just say all SQL should have a WHERE clause.
(You could always set autocommit=false, which forces you to explicitly commit or rollback every action, but that has its own baggage)
Delete with WHERE is sufficiently slow in MSSQL we have to do batched deletes, but I can't recall offhand if that holds for whole table deletion as well.
It's not enabled by default out of the box, but some companies do override their configuration to enable it for new sessions, iirc Facebook did this.
[1] https://dev.mysql.com/doc/refman/8.4/en/mysql-tips.html#safe...
[2] https://dev.mysql.com/doc/refman/8.4/en/server-system-variab...