January 2019
Beginner
556 pages
14h 19m
English
The DELETE statement is used to remove records from the database. As with UPDATE, there are two ways of deleting: using sub-select or using another table or tables. The sub-select syntax is as follows:
DELETE FROM <table_name> [WHERE <condition>];
Records that follow the condition will be removed from the table. If the WHERE clause is omitted, all of the records will be deleted.
DELETE based on another table is similar to using the FROM clause of the UPDATE statement. Instead of FROM, the USING keyword should be used because FROM is already used in the syntax of the DELETE statement:
car_portal=> DELETE FROM car_portal_app.a USING car_portal_app.b WHERE a.a_int=b.b_int;DELETE 6
The preceding statement will delete all ...
Read now
Unlock full access