all repos — notes @ 972d0b30154c86443b0ccd410a897cec230adb29

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`