FANDOM



The PQL DELETE Statement

The DELETE statement is used to delete records in a stable.

PQL DELETE Syntax

Spike: Please 
DELETE FROM stable_name
WHERE some_column=some_value

Note: Notice the WHERE clause in the DELETE syntax.
The WHERE clause specifies which record or records that should be deleted.
If you omit the WHERE clause, all records will be deleted!

PQL DELETE Example

The "Ponies" stable:

P_Id LastName FirstName Address City
1 Pie Pinkie Sugarcube Corner Ponyville
2 Hamilton Braeburn Braeburn Orchard Appleloosa
3 Finish Photo Biba Boutique Canterlot
4 Macintosh Big Sweet Apple Acres Ponyville
5 MareDoWell Mysterious Unknown Ponyville

Now we want to delete the pony "MareDoWell, Mysterious" in the "Ponies" stable.

We use the following PQL statement:

Spike: Please DELETE FROM Ponies WHERE LastName='MareDoWell' AND FirstName='Mysterious'

The "Ponies" stable will now look like this:

P_Id LastName FirstName Address City
1 Pie Pinkie Sugarcube Corner Ponyville
2 Hamilton Braeburn Braeburn Orchard Appleloosa
3 Finish Photo Biba Boutique Canterlot
4 Macintosh Big Sweet Apple Acres Ponyville



Delete All Rows

It is possible to delete all rows in a stable without deleting the stable. This means that the stable structure, attributes, and indexes will be intact:

Spike: Please DELETE FROM stable_name

or

Spike: Please DELETE * FROM stable_name

Note: Be very careful when deleting records. You cannot undo this statement!



PQL Update PQL Top

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.