Short MySQL Cheatsheet
Command | Description |
---|---|
SHOW DATABASES; |
List all databases |
USE database; |
Choose database on which next commands will be performed |
SHOW TABLES; |
List all tables in the database |
SHOW TABLES LIKE pattern; |
Show tables that match the pattern i.e. permissions% |
DESCRIBE table; |
Show all table column names and their types. |
SELECT column FROM tabel; |
Basic SELECT statement to retieve rows from selected column |
UPDATE table_name SET column_name = new_value WHERE condition; |
Update operation on selected column |
UPDATE posts SET column_name = REPLACE(column_name, 'old_string', 'new_string'); |
Find/Replace operation on selecter column |