GDC Class Notes

Class Notes of Graduate Diploma in Computing in Unitec

SQL Notes

SQL constraint / 约束

  1. Not Null
  2. Default
  3. Unique
  4. PK
  5. Foreign Key
  6. Check Constraint

Data Integrity

  1. Entity, nu duplicate rows
  2. Domain, enforce valid entries by restricting the type, format, range of value
  3. Referential Integrity, rows cannot be deleted which are used by other records
  4. User-defined Integrity

Nomalization

1NF

  • pk,
  • no repeating, if repeating, split to more than 1 tables

2NF

  • meet 1NF
  • no partial dependences

3NF

  • meet 2nf
  • all non-primary fields are dependent on pk

SQL Comparison Operatoes

= is like ==

SQL Logical Operators

  • All
  • And
  • Any
  • Between
  • Exists
  • in
  • Like
  • Not
  • or
  • is Null

References