all repos — notes @ b0d3103384de7258a70952ccef997a4f9b8a5e2d

My notes, written in md and LaTeX

misc/sql.notes.md

# Keys and Tables

  - There is a uniqe primary key for each row
  - Columns are attributes to that row
  - Surrogate keys are primary keys that do not mean
    anything out of the table (i.e IRL)
  - Foreign key links to another table. Its the primary
    key of a particular row of another table
  - Foreign keys can also point to the same table
  - Composite keys are a pair of primary keys that on their
    own might not be uniqe for all the rows but they are
    unique as a pair [36m20s](https://www.youtube.com/watch?v=HXV3zeQKqGY&t=36m20s)
  - Composite keys can also be foreign keys


# SQL
  - USE <db>
  - CREATE TABLE `table_name`