diff --git a/cheat/sql.md b/cheat/sql.md new file mode 100644 index 0000000..0332e34 --- /dev/null +++ b/cheat/sql.md @@ -0,0 +1,27 @@ +# SQL + + + +## Commands + +```sh +\q # To quit the psql: +\l # List all databases +\dv # List all views: +\dt # Lists all tables in a current database. +\du # List all users +``` + +## Database + +```sh +CREATE DATABASE [IF NOT EXISTS] db_name; +DROP DATABASE [IF EXISTS] db_name; + +``` + +## Tabls + +```sh +SELECT * FROM table_name; +``` \ No newline at end of file