Title | DM SQL Syntax - Summary Data Management |
---|---|
Author | Mingmiao Liu |
Course | Data Management |
Institution | Singapore Management University |
Pages | 3 |
File Size | 83.7 KB |
File Type | |
Total Downloads | 6 |
Total Views | 44 |
SQL – SyntaxThis note contain the syntax of SQL, it might not covered everything but should be sufficient enough.Familiarise with the syntax and understand how each of them are used. The rest is just all about practising and practising.INSERTINSERT INTO table (col_Name, col_Name) VALUE (col1Value, c...
SQL – Syntax This note contain the syntax of SQL, it might not covered everything but should be sufficient enough. Familiarise with the syntax and understand how each of them are used. The rest is just all about practising and practising.
INSERT INSERT INTO table (col_Name, col_Name) VALUE (col1Value, col2Value, …)
UPDATE UPDATE table SET col_toUpdate = [updateValue] WHERE col_name = [condition for specific row]
DELETE DELETE FROM table WHERE col_name = [condition for specific row]
SELECT SELECT FROM WHERE GROUP BY HAVING ORDER BY LIMIT
Possible function of SELECT SELECT * select every col AS alias name DISTINCT col_name COUNT (*) COUNT (col_name) COUNT (DISTINCT col_name) IF(expression , [true] , [false])
IFNULL([col_1], [display this value if col_1 is null]) AVG(col_name) MAX(col_name) MIN(col_name) SUM(col_name) ROUND([col_name], [how many decimal place])
FROM table t1 INNER JOIN table t2 ON t1.id = t2.id LEFT OUTER JOIN table t2 ON t1.id = t2.id RIGHT OUTER JOIN table t2 ON t1.id = t2.id , table t2 WHERE t1.id = t2.id SUBQUERY
WHERE col_1 = col_2 col_1 > or >= or < or value AVG(col_name) < value MAX(col_name) = value MIN(col_name) >= value SUM(col_name) value SUBQUERY
ORDER BY col_name default is Asc col_name DESC
LIMIT LIMIT number set max limit to the number to row to be output...