Question 04 of 04

DML Modifications, Pattern Matching & Record Deletion

Write SQL statements to perform: 1. Delete record of supplier whose SID is 204001. 2. Delete all records of suppliers whose city starts with a capital letter (e.g. 'D%'). 3. Find supplier names which have 'lk' in any position. 4. Find supplier names where 'R' is in the second position. 5. Find supplier names starting with 'V' and ending with 'A'. 6. Change city of all suppliers to 'BOMBAY'. 7. Change city of supplier 'Vandana' to 'Goa'. 8. Delete all records of supplier table.

C++
-- 1. Delete supplier whose SID is 204001
DELETE FROM Supplier WHERE SID = 204001;

-- 2. Delete suppliers whose city starts with 'D' (capital D)
DELETE FROM Supplier WHERE city LIKE 'D%';

-- 3. Find supplier names having 'lk' in any position
SELECT Sname FROM Supplier WHERE Sname LIKE '%lk%';

-- 4. Find supplier names where 'R' is in the second position
SELECT Sname FROM Supplier WHERE Sname LIKE '_R%';

-- 5. Find supplier names starting with 'V' and ending with 'A'
SELECT Sname FROM Supplier WHERE Sname LIKE 'V%A';

-- 6. Change city of all suppliers to 'BOMBAY'
UPDATE Supplier SET city = 'BOMBAY';

-- 7. Change city of supplier 'Vandana' to 'Goa'
UPDATE Supplier SET city = 'Goa' WHERE Sname = 'Vandana';

-- 8. Delete all records from Supplier table
DELETE FROM Supplier;
Question 4 of 4