Learn How to Delete Data Rows using Delete Statement in SQL

PnTutorials by Pradnyankur Nikam
Youtube
Related Topic
:- Database Management

In this lecture we will learn about using DELETE statement in SQL. As the name suggests DELETE statement is used to delete the data rows in a table. The DELETE statement can delete one or multiple data rows from a table. WHERE clause is used to specify the data row to be deleted. DELETE statement without WHERE clause will delete all the data rows in the table. Here are the examples DELETE statements, DELETE FROM tablename; DELETE FROM tablename WHERE column1 = value; Select the "school" database, "USE school;" Run a simple SQL statement to display all the data rows in students2 table using SQL statement, "SELECT * FROM students2;" Currently the 'students2' table have 58 data rows. Lets delete a data record having studentid 6; The SQL statement will be, "DELETE FROM students2 WHERE studentid = 6;" Now if we run the SQL statement again to display all the data rows in 'students2' table, "ELECT * FROM students2;" You can see the studentid 6 is gone. and total data rows are 57. 

Comments