SQL查詢初學者指南讀書筆記(一)關聯式資料庫和SQL介紹,初學者指南讀書筆記

來源:互聯網
上載者:User

SQL查詢初學者指南讀書筆記(一)關聯式資料庫和SQL介紹,初學者指南讀書筆記

PART I:Relational Databases and SQL


Chapter2, Ensuring Your Database Structure IsSound.

資料庫設計準則

 

什麼是關聯式資料庫

RDBMS (A Relational database management systems)關聯式資料庫

Tables

Tables are the mainstructures in the database. Each table always represents a

single, specificsubject.

 

Fields

A field is thesmallest structure in the database, and it represents a characteristic

of the subject ofthe table to which it belongs.

 

Records

A record representsa unique instance of the subject of a table.

 

Keys

Keysare special fields that play very specific roles within a table.eg.

  • primary key
  • foreign key

 

主鍵的最主要作用是保證資料記錄的唯一性,就是說主鍵約束要保證在一個資料庫表裡的所有的資料記錄都是不同的個體,例如:社會安全號碼碼可以保證一個人在大陸範圍內是一個獨立的個體(弄錯了的不算),即一個社會安全號碼碼不能標識兩個人或兩個社會安全號碼碼標識一個人。所以主鍵是從現有的資料裡分析出來的,不是設計人員隨意加上去的。

 

Relationships

  • one-to-one
  • one-to-many
  • many-to-many

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.