SQL/MX 2.x Reference Manual (H06.10+, J06.03+)

SQL/MX Statements
HP NonStop SQL/MX Reference Manual544517-008
2-120
C Examples of DELETE
Remove the row for TIM WALKER from the EMPLOYEE table:
DELETE FROM persnl.employee
WHERE first_name = 'TIM' AND last_name = 'WALKER';
--- 1 row(s) deleted.
Remove from the table ORDERS any orders placed with sales representative 220
by any customer except customer number 1234:
DELETE FROM sales.orders
WHERE salesrep = 220 AND custnum <> 1234;
--- 2 row(s) deleted.
Remove from the table PARTSUPP all suppliers who charge more than $1,600.00
for items that have part numbers in the range 6400 to 6700:
DELETE FROM invent.partsupp
WHERE partnum BETWEEN 6400 AND 6700
AND partcost > 300.00 SERIALIZABLE ACCESS;
--- 3 row(s) deleted.
This DELETE uses SERIALIZABLE access, which provides maximum consistency
but reduces concurrency. Therefore, you should run this statement at a time when
few users need concurrent access to the database.
Remove all suppliers not in Texas from the table PARTSUPP:
DELETE FROM invent.partsupp
WHERE suppnum IN
(SELECT suppnum FROM samdbcat.invent.supplier
WHERE state <> 'TEXAS');
--- 41 row(s) deleted.
This statement achieves the same result:
DELETE FROM invent.partsupp
WHERE suppnum NOT IN
(SELECT suppnum FROM samdbcat.invent.supplier
WHERE state = 'TEXAS');
--- 41 row(s) deleted.
C Examples of DELETE
Remove the row for JOHN WALKER from the EMPLOYEE table:
EXEC SQL DELETE FROM PERSNL.EMPLOYEE
WHERE FIRST_NAME = 'JOHN' AND LAST_NAME = 'WALKER'
SERIALIZABLE ACCESS;