Skip to content

Instantly share code, notes, and snippets.

@overthemike
Created March 4, 2020 21:15
Show Gist options
  • Save overthemike/6ad745861c7e147d5ebdf3109bdc6dd1 to your computer and use it in GitHub Desktop.
Save overthemike/6ad745861c7e147d5ebdf3109bdc6dd1 to your computer and use it in GitHub Desktop.
-- INSERT
INSERT INTO tablename (column1, column2, column3)
VALUES
('value1', 'value2', 'value3'),
('value4', 'value5', 'value6');
-- UPDATE
UPDATE tablename
SET
column1 = 'value1'
column2 = 'value2'
WHERE
field = 'value';
-- DELETE
DELETE FROM tablename
WHERE field = 'value';
-- SELECT
SELECT column1, column2
FROM tablename
WHERE field = 'value'
LIMIT 10;
-- AGGREGATE
SELECT column1, AVG(column2)
FROM tablename
GROUP BY
column1;
-- JOINS
SELECT t1.column1, t2.column2
FROM table1 t1
LEFT JOIN table2 t2 ON t1.column1 = t2.column1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment