Posted on One min read

A cheatsheet. Enough said.

show databases;

select database();

show tables;

create table cats (cid CHAR(20), name CHAR(30), breed CHAR(20), age INTEGER, cuteness REAL)

insert into cats (cid, name, breed, age, cuteness)
values (1, 'coolcat', 'garfield', 999, 3.14159265953)

delete
from cats cat
where cat.name = 'gary'

update cats cat
set cat.age = cat.age + 1, cat.cuteness = cat.cuteness + 999
where cat.cid = 1
// where clause is applied first
// can use >=

create table students (sid CHAR(20),
                        name CHAR(30),
                        login CHAR(30),
                        age INTEGER,
                        gpa REAL,
                        UNIQUE (name, age),
                        CONSTRAINT StudentKey PRIMARY KEY (sid)
                        )