The SQL statement to delete the data is very simple, as long as we specify the table to be deleted, such as we want to delete the data in the T_DEBT and T_person tables, then execute the following SQL statement:
DELETE FROM T_Debt;DELETE FROM T_Person;
Because the Fperson field in the T_debt table is a foreign key to the FName field of the table T_person, you must first delete the data in the T_DEBT table before you can delete the data in T_person.
Perform a SELECT * from T_DEBT View the data changes in the T_DEBT table.
Execute the SELECT * from T_person after executing this SQL statement to view the data changes in the T_person table.
You can see that all rows of data in the table have been deleted, and there is no data in t_debt and T_person.
Beginners tend to confuse the drop TABLE statement with the delete, although both names have "delete" two words, but the DELETE statement simply deletes the rows of data in the table, and the structure of the table exists, and the drop TABLE statement will not only delete the rows of data in the table, It also removes the structure of the table. An image can be likened to a DELETE statement that simply "eats up the meal in the bowl," while the drop TABLE statement "eats up the bowl and smashes the bowl." If we execute "DROP table T_person" Then the database system will report "data table T_person not present" when executing "SELECT * Fromt_person" again.
The DELETE statement above deletes all the data in the table, so what if we just want to delete the data rows we specified? Like the UPDATE statement, the DELETE statement also provides a where statement to filter the data so that only rows that meet the filter criteria are deleted.
Simple data removal