From 6c95a84ce800485c6ac494244ef5c49c4bd1d42e Mon Sep 17 00:00:00 2001 From: Piyush-Linux Date: Tue, 16 Jul 2024 12:24:00 +0530 Subject: [PATCH] cheat-SQL --- cheat/sql.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 cheat/sql.md 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