天天看点

sql语句语法多表关联_SQL Delete语句-如何删除行或表,语法示例

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语句语法多表关联