官术网_书友最值得收藏!

Deleting data

We will use the DELETE DML statement for deletion of data. The DELETE statement at a minimum expects the name of the table. Similar to the UPDATE statement, it is recommended that the DELETE statement is always used with filter criteria to avoid loss of data.

The DELETE statement should be used when a record has to be permanently removed from the table.

Note

To avoid permanent loss or deletion of data Boolean flags are used to determine if a record is active or inactive (1 or 0). These are called soft deletes and help us retain data in the long run.

Deleting data

In the preceding example, we are deleting the records from the students table that match the criterion of student_id equal to 4. As there is only one record that matches that criterion, that record has been deleted. The recommendations that were made above about how to use the filter criterion apply for the DELETE statement too.

主站蜘蛛池模板: 铁力市| 濮阳市| 双辽市| 黔西县| 米易县| 云浮市| 大洼县| 外汇| 吐鲁番市| 高碑店市| 雷州市| 治县。| 黑龙江省| 桃园县| 临湘市| 定州市| 会昌县| 青河县| 台州市| 内江市| 英超| 西安市| 阳谷县| 古丈县| 双城市| 依安县| 寿宁县| 雷州市| 丹棱县| 宜川县| 清苑县| 泰顺县| 无锡市| 济宁市| 万宁市| 田阳县| 镇赉县| 成安县| 民和| 罗平县| 阳朔县|