Deleting Data

This lesson discusses how to delete data in MySQL.

We'll cover the following

Deleting Data

We can delete rows from a table using the DELETE statement. A delete statement deletes an entire row and not individual columns. If changing a particular column value for a row is desired, use the UPDATE statement, which we will cover next. Also realize that deleting all the rows of a table doesn’t delete the table itself.

Example Syntax

DELETE FROM table

WHERE col3 > 5

ORDER BY col1

LIMIT 5;

Connect to the terminal below by clicking in the widget. Once connected, the command line prompt will show up. Enter or copy and paste the command ./DataJek/Lessons/13lesson.sh and wait for the MySQL prompt to start-up.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.