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

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.

主站蜘蛛池模板: 阿克陶县| 闽清县| 原阳县| 望奎县| 织金县| 黑龙江省| 莫力| 桂东县| 江门市| 新营市| 利川市| 鹿泉市| 新田县| 高阳县| 嵊州市| 文山县| 台东县| 新绛县| 全南县| 雅安市| 霍林郭勒市| 舞阳县| 滨州市| 东明县| 尉氏县| 汤原县| 交口县| 武乡县| 酉阳| 伊宁市| 韩城市| 余干县| 长丰县| 寿光市| 朝阳市| 台州市| 绥中县| 车致| 屯昌县| 含山县| 祥云县|