Hubbry Logo
search
logo

Delete (SQL)

logo
Community Hub0 Subscribers
Write something...
Be the first to start a discussion here.
Be the first to start a discussion here.
See all
Delete (SQL)

In the database structured query language (SQL), the DELETE statement is used to remove one or more records from a table. A subset may be defined for deletion using a condition, otherwise all records are removed. Some database management systems (DBMSs), like MySQL, allow deletion of rows from multiple tables with one DELETE statement (this is sometimes called multi-table DELETE).

Delete rows from table pies where column flavor equals Lemon Meringue:

Delete rows in trees, if the value of height is smaller than 80.

Delete all rows from mytable:

Delete rows from mytable using a subquery in the where condition:

Delete rows from mytable using a list of values:

Suppose there is a simple database that lists people and addresses. More than one person can live at a particular address and a person can live at more than one address (this is an example of a many-to-many relationship). The database only has three tables, person, address, and pa, with the following data:

The pa table relates the person and address tables, showing that Joe, Bob and Ann all live at 2001 Main Street, but Joe also takes up residence on Pico Boulevard.

See all
User Avatar
No comments yet.