SQL DELETE ROW: How to Remove Records from a Table
In SQL, the DELETE statement removes existing records from a table. Use it carefully ÔÇö deleting data is irreversible unless you have a backup. This guide demonstrates removing rows using a sample student_info table.
Complete Python Course with Advance topics:-
SQL Tutorial:-
SQL DELETE Query Example
To delete the student with ID 103:
DELETE FROM student_info WHERE ID = 103;
After execution, only IDs 101 and 102 remain in the table.
Deleting Multiple Rows
You can remove several rows at once using IN or a range condition:
DELETE FROM student_info WHERE ID IN (101, 103);
DELETE FROM student_info WHERE ID BETWEEN 100 AND 102;
Key Points to Remember
- WHERE Clause is Crucial: Without it, DELETE removes all records.
- Backup Your Data: Always back up before a DELETE operation.
- Data Integrity: Deleting rows may affect related data ÔÇö consider foreign key constraints.
Foreign Key Considerations
If a row is referenced by another table via a foreign key, the delete may fail or cascade. With ON DELETE CASCADE, related child rows are deleted automatically. Otherwise, you must delete child rows first.
Practical Tip: Verify Before Deleting
SELECT * FROM student_info WHERE ID = 103;
Running a SELECT with the same condition first confirms exactly which rows will be deleted.
Download New Real Time Projects:- Click here
Complete Advance AI topics:-
Conclusion
Mastering SQL DELETE is essential for database management. Always use a WHERE clause, consider foreign keys, and verify with SELECT first. For more database tips, stay connected with .
sql delete column
delete all data from table sql
sql delete table
sql delete row w3schools
sql delete row example
mysql delete row
delete multiple rows in sql
delete with foreign key sql