SQL Cheat Sheet
SQL Cheat Sheet
SQL Cheat Sheet
Query 2 : How to Join 2 tables using left join - table-t1 and table t2.
Query 3 : How to Join 2 tables using right join - table-t1 and table t2.
Query 4 : How to Perform full outer join with using t1 and t2 table.
Query 2 : How to intersect the data from table t1 and table t2.
Query 3 : How to Subtract a result set of table t1 from another result set of table t2.
CREATE TABLE t (
id INT PRIMARY KEY,
name VARCHAR NOT NULL,
price INT DEFAULT 0
);
DROP TABLE t ;
TRUNCATE TABLE t;
Query 4 : How to add Check constraint which ensure column1 > 0 and values in
column1 >= column2?
Query 3 : How to Insert rows from One table (t2) to other table t1?
Query 4 : How to Update new value in the column column1 for all rows?
UPDATE t1
SET column1 = new_value;
Query 5 : How to Update values in the column column1, column2 that match the
condition?
UPDATE t
SET column1 = new_value,
column2 = new_value
WHERE condition;
DELETE FROM t1
WHERE condition;
WHEN
EVENT
TRIGGER_TYPE