From e048dc363e3b33f1ff1b21b360029b89fbba85d9 Mon Sep 17 00:00:00 2001 From: Jadoo Date: Sat, 17 Aug 2024 03:16:57 +0330 Subject: [PATCH] first commit --- css/style.css | 90 ++++++++++++++ index.html | 248 +++++++++++++++++++++++++++++++++++++ sections/basics/index.html | 46 +++++++ 3 files changed, 384 insertions(+) create mode 100644 css/style.css create mode 100644 index.html create mode 100644 sections/basics/index.html diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000..562647d --- /dev/null +++ b/css/style.css @@ -0,0 +1,90 @@ +* { + padding: 0; + margin: 0; +} +body { + width: 100vw; +} +.container { + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; +} + +.cheats { + display: grid; + border-radius: 1px red solid; + grid-template-columns: 1fr 1fr; +} +.section { + border: 1px grey solid; + border-radius: 10px; + box-shadow: 0px 0px 15px -3px rgba(0, 0, 0, 0.1); + margin: 5px; + padding: 5px; +} + +h1 { + margin: 25px; +} + + +.title { + background: rgba(128, 128, 128, 0.2); + background: linear-gradient( + 0deg, + rgba(128, 128, 128, 0) 0%, + rgba(128, 128, 128, 0.2) 100% + ); +} +.title a,.title { + display: flex; + align-items: center; + align-content: center; + padding-left: 5px; + + border-radius: 9px; + + user-select: none; + text-decoration: none; +} + +.title i { + font-size: 25px; + margin-right: 5px; + padding: 5px; + +} +.contents { + display: grid; + text-align: center; + padding: 5px; + font-family: "Noto Sans Mono", monospace; +} + +.contents div p { + width: 100%; + text-align: justify; + margin-left: 15px; + padding: 5px 0; +} +.col-5 { + grid-template-columns: 1fr 1fr 1fr 1fr 1fr; +} +.col-4 { + grid-template-columns: 1fr 1fr 1fr 1fr; +} + +.col-3 { + grid-template-columns: 1fr 1fr 1fr; +} +.col-2 { + grid-template-columns: 1fr 1fr; +} + +@media screen and (max-width: 950px) { + .cheats { + grid-template-columns: 1fr; + } +} diff --git a/index.html b/index.html new file mode 100644 index 0000000..490aa8d --- /dev/null +++ b/index.html @@ -0,0 +1,248 @@ + + + + + + + + + + + + + + Document + + +
+

SQL Cheat Sheet

+ +
+

+ We use Sqlite and the Sakila Sample database [kaggle.com].
+

+

The diagram of database is:

+

+ +

+
+ +
+
+ +
+
+

select

+

from

+

where

+
+
+

group by

+

having

+

oerder by

+

limit

+
+
+

=

+

!=

+

<

+

>

+
+
+

<=

+

>=

+

True

+

False

+
+
+

not

+

in

+

between

+
+
+
+ +
+
+ +

Aggregate Functions

+
+
+
+

min()

+

max()

+

avg()

+
+
+

count()

+

median()

+

mode()

+

stddev()

+
+
+

w/group by

+

w/ having

+

w/ distinct

+
+
+
+ +
+
+ +

String Manipulation

+
+
+
+

concat()

+

replace()

+

reverse()

+

trim()

+
+
+

upper()

+

lower()

+

len()

+

str()

+
+
+

wildcards (%)

+

like / ilike

+
+
+
+ +
+
+ +

Date Manipulation

+
+
+
+

day()

+

month()

+

year()

+

getdate()

+
+
+

date_add()

+

datediff()

+

date_trunc()

+

date_format()

+
+
+
+ +
+
+ +

Joins

+
+
+
+

inner join

+

left join

+

outer join

+

self join

+
+
+

anti join

+

joining on multiple keys

+

joining on a condition

+
+
+
+ +
+
+ +

Cleaning & Transformation

+
+
+
+

cast()

+

coalesce()

+

case when

+

ifnull()

+
+
+

iff()

+

listagg()

+

except

+
+
+

Union

+

Union All

+

Intersect

+

Minus

+
+
+
+ +
+
+ +

Window Functions

+
+
+
+

sum()

+

count()

+

avg()

+

max()

+

min()

+
+
+

row_number()

+

rank()

+

denserank()

+

lead()

+

lag()

+
+
+

over( ...

+

partition by<

+

order by

+

)

+
+
+
+ +
+
+ +

Advanced

+
+
+
+

CTEs

+

UDFs

+

Data Modeling

+

Subqueries

+
+
+
+
+
+ + diff --git a/sections/basics/index.html b/sections/basics/index.html new file mode 100644 index 0000000..a8daff2 --- /dev/null +++ b/sections/basics/index.html @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + SQL::Basics + + +
+ +

Select all tables in sql lite

+

+            .tabels
+        
+

+ show all contents of albums. +

+

+            select * from album;
+        
+ + +
+ +