Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
49 views1 page

Delete

The DELETE statement is used to delete rows from one or more tables. For a single table, the DELETE statement deletes rows that meet the optional WHERE condition, and can be ordered and limited. For multiple tables, rows are deleted from each table that meet the specified conditions without ordering or limiting. Privileges and locks may affect the use of DELETE or TRUNCATE TABLE to delete all rows from a table.

Uploaded by

Irwan Bros
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views1 page

Delete

The DELETE statement is used to delete rows from one or more tables. For a single table, the DELETE statement deletes rows that meet the optional WHERE condition, and can be ordered and limited. For multiple tables, rows are deleted from each table that meet the specified conditions without ordering or limiting. Privileges and locks may affect the use of DELETE or TRUNCATE TABLE to delete all rows from a table.

Uploaded by

Irwan Bros
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

Syntax:

Single-table syntax:
DELETE
[WHERE
[ORDER
[LIMIT

[LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name


where_condition]
BY ...]
row_count]

Multiple-table syntax:
DELETE [LOW_PRIORITY] [QUICK] [IGNORE]
tbl_name[.*] [, tbl_name[.*]] ...
FROM table_references
[WHERE where_condition]
Or:
DELETE [LOW_PRIORITY] [QUICK] [IGNORE]
FROM tbl_name[.*] [, tbl_name[.*]] ...
USING table_references
[WHERE where_condition]
For the single-table syntax, the DELETE statement deletes rows from
tbl_name and returns a count of the number of deleted rows. This count
can be obtained by calling the ROW_COUNT() function (see
http://dev.mysql.com/doc/refman/5.5/en/information-functions.html). The
WHERE clause, if given, specifies the conditions that identify which
rows to delete. With no WHERE clause, all rows are deleted. If the
ORDER BY clause is specified, the rows are deleted in the order that is
specified. The LIMIT clause places a limit on the number of rows that
can be deleted.
For the multiple-table syntax, DELETE deletes from each tbl_name the
rows that satisfy the conditions. In this case, ORDER BY and LIMIT
cannot be used.
where_condition is an expression that evaluates to true for each row to
be deleted. It is specified as described in
http://dev.mysql.com/doc/refman/5.5/en/select.html.
Currently, you cannot delete from a table and select from the same
table in a subquery.
You need the DELETE privilege on a table to delete rows from it. You
need only the SELECT privilege for any columns that are only read, such
as those named in the WHERE clause.
As stated, a DELETE statement with no WHERE clause deletes all rows. A
faster way to do this, when you do not need to know the number of
deleted rows, is to use TRUNCATE TABLE. However, within a transaction
or if you have a lock on the table, TRUNCATE TABLE cannot be used
whereas DELETE can. See [HELP TRUNCATE TABLE], and [HELP LOCK].
URL: http://dev.mysql.com/doc/refman/5.5/en/delete.html

You might also like