delete from where sql code example
Example 1: delete record by id sql
DELETE FROM table_name WHERE condition;
Example 2: sql delete
DELETE FROM table_name WHERE condition;
DELETE FROM Customers WHERE CustomerName='Mustafa Mbari';
Example 3: sql delete where in select
DELETE FROM tableA
WHERE ROWID IN
( SELECT q.ROWID
FROM tableA q
INNER JOIN tableB u on (u.qlabel = q.entityrole AND u.fieldnum = q.fieldnum)
WHERE (LENGTH(q.memotext) NOT IN (8,9,10) OR q.memotext NOT LIKE '%/%/%')
AND (u.FldFormat = 'Date'));
Example 4: what is delete in sql
DELETE -
-DML COMMAND
-Delete Rows from the table one by one
-We can use where clause with Delete to delete single row
-Delete is slower than truncate
-ROLLBACK is possible with DELETE
DROP-
-DDL COMMAND
-Delete the entire structure or schema
-We can't use where clause with drop
-Drop is slower than DELETE & TRUNCATE
-ROLLBACK IS NOT POSSIBLE WITH DROP
TRUNCATE-
-DDL COMMAND
-Truncate deletes rows at a one goal
-We can't use where clause with Truncate
-Truncate faster than both DELETE & DROP
-Rollback is not possible with Truncate
Example 5: delete from where sql
DELETE FROM my_table;
DELETE FROM my_table WHERE my_id = 12345;
DELETE FROM my_table WHERE my_id IN (SELECT id2 FROM my_table2);