You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
INSERT INTO [table_name] (column1, column2, ...)
VALUES (value1, value2, ...);
Select data from a table
SELECT column1, column2, ...
FROM [table_name];
Update data in a table
UPDATE [table_name]
SET column1=value1, column2=value2, ...
WHERE [condition];
Delete data from a table
DELETEFROM [table_name]
WHERE [condition];
MySQL Joins
INNER JOIN
SELECT column1, column2, ...
FROM table1
INNER JOIN table2
ONtable1.column=table2.column;
LEFT JOIN
SELECT column1, column2, ...
FROM table1
LEFT JOIN table2
ONtable1.column=table2.column;
RIGHT JOIN
SELECT column1, column2, ...
FROM table1
RIGHT JOIN table2
ONtable1.column=table2.column;
FULL JOIN (not supported in MySQL, can be simulated)
SELECT column1, column2, ...
FROM table1
LEFT JOIN table2
ONtable1.column=table2.columnUNIONSELECT column1, column2, ...
FROM table1
RIGHT JOIN table2
ONtable1.column=table2.column;
Aggregation Functions
COUNT
SELECTCOUNT(column_name)
FROM [table_name]
WHERE [condition];
SUM
SELECTSUM(column_name)
FROM [table_name]
WHERE [condition];
AVG
SELECTAVG(column_name)
FROM [table_name]
WHERE [condition];
MIN
SELECTMIN(column_name)
FROM [table_name]
WHERE [condition];
MAX
SELECTMAX(column_name)
FROM [table_name]
WHERE [condition];
This cheat sheet provides a quick reference for someone new to MySQL, covering basic commands, CRUD operations, joins, and aggregation functions.