Saturday 1 September 2007

MySQL DB Design Tutorial (Section 3) - Column Constraints & Database Relationships




The following are the list of constraints that can be assigned to columns in MySQL:

  1. Not NULL | NULL (Default vallue) - Primary key (implied)
  2. DEFAULT - Not available in BLOG/TEXT; AUTO_INCREMENT; NULL Values
  3. UNIQUE

Database Relationships
  1. One-to-One (1:1) is when at most one instance of a entity A is associated with one instance of entity B.
  2. One-to-Many (1:N) relationships is when for one instance of entity A, there are zero, one, or many instances of entity B, but for one instance of entity B, there is only one instance of entity A.
  3. Many-to-Many (M:N) relationship is when for one instance of entity A, there are zero, one, or many instances of entity B and for one instance of entity B there are zero, one, or many instances of entity A.

No comments: