Delete (SQL) - Examples

Examples

Delete rows from table pies where the column flavour equals Lemon Meringue:

DELETE FROM pies WHERE flavour='Lemon Meringue';

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

DELETE FROM trees WHERE height < 80;

Delete all rows from mytable:

DELETE FROM mytable;

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

DELETE FROM mytable WHERE id IN ( SELECT id FROM mytable2 );

Delete rows from mytable using a list of values:

DELETE FROM mytable WHERE id IN ( value1, value2, value3, value4, value5 );

Read more about this topic:  Delete (SQL)

Famous quotes containing the word examples:

    In the examples that I here bring in of what I have [read], heard, done or said, I have refrained from daring to alter even the smallest and most indifferent circumstances. My conscience falsifies not an iota; for my knowledge I cannot answer.
    Michel de Montaigne (1533–1592)

    It is hardly to be believed how spiritual reflections when mixed with a little physics can hold people’s attention and give them a livelier idea of God than do the often ill-applied examples of his wrath.
    —G.C. (Georg Christoph)

    There are many examples of women that have excelled in learning, and even in war, but this is no reason we should bring ‘em all up to Latin and Greek or else military discipline, instead of needle-work and housewifry.
    Bernard Mandeville (1670–1733)