Anki cards for SQL

#sql #anki

TODO: create some cards based on Select Star SQL.

[TOC]


basic INSERT structure

::

INSERT INTO table
(field1, field2, fieldN)
VALUES (value1, value2, valueN)

basic UPDATE structure

::

UPDATE table
SET field1 = new_value1, fieldN = new_valueN
WHERE condition

Don't forget the WHERE!


basic DELETE structure

::

DELETE FROM table
WHERE condition

Don't forget the WHERE!


Order of execution

::

  1. from
  2. where
  3. group by
  4. having
  5. select
  6. order by
  7. limit

How to design a One-To-Many relationship

::
The table that "belongs to" another one stores the ID of an element from the other table as a foreign key.

Example: