Anki cards for SQL
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
::
- from
- where
- group by
- having
- select
- order by
- 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:
- cities
- id
- name
- inhabitants
- first_name
- last_name
- city_id (foreign key)