sql語句文法多表關聯
To delete a record in a table you use the
DELETE
statement.
要删除表中的記錄,請使用
DELETE
語句。
Be careful. You can delete all records of the table or just a few. Use the
WHERE
condition to specify which records do you want to delete. The syntax is:
小心。 您可以删除表中的所有記錄或僅删除一些記錄。 使用
WHERE
條件指定要删除的記錄。 文法為:
DELETE FROM table_name
WHERE condition;
Here is an example deleting from the table Person the record with Id 3:
這是從表Person中删除ID為3的記錄的示例:
DELETE FROM Person
WHERE Id = 3;
Using DELETE to remove all records from a given table
使用DELETE從給定表中删除所有記錄
DELETE * FROM Person
;
Or depending on your RDBMS you could use the TRUNCATE TABLE statement which deletes all records from a table and depending on your RDBMS may or may not allow rollback. DELETE is DML and TRUNCATE is DDL.
或者根據您的RDBMS,您可以使用TRUNCATE TABLE語句從表中删除所有記錄,并且取決于您的RDBMS是否允許復原。 DELETE是DML,TRUNCATE是DDL。
TRUNCATE TABLE Person;
翻譯自: https://www.freecodecamp.org/news/sql-delete-statement-row-table/
sql語句文法多表關聯