From the course: SQL Queries Made Easy

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Delete rows in tables

Delete rows in tables - SQL Tutorial

From the course: SQL Queries Made Easy

Start my 1-month free trial

Delete rows in tables

- [Instructor] In this video, we will learn about the delete statement. It is used to delete rows from our table. It's also a DML statement, and just like other DML statements, it has a WHERE condition, and if the WHERE condition is specified, only those rows satisfying the condition will be deleted. Otherwise, all the rows in the table will be deleted. Now let's look at our table, and we'll delete a few rows from that. SELECT * FROM emp.tab. Now I want to delete this row, with emp number 7,007. So I give DELETE FROM table name, WHERE employee number is 7,007. I'm taking employee number, because that is unique for every row. So now let's see if that has been deleted or not. As you can see, that row has been deleted. This is how we can delete one row at a time, by giving a unique column to identify the rows we want to delete. Now, if I want to delete rows based on another table, I can use subqueries for that. For…

Contents