Skip to content

Instantly share code, notes, and snippets.

Last active September 27, 2021 00:01
Show Gist options
  • Save JayGwod/615e847ee9b9b4c17b0c1f465bbaefd5 to your computer and use it in GitHub Desktop.
Save JayGwod/615e847ee9b9b4c17b0c1f465bbaefd5 to your computer and use it in GitHub Desktop.
[Django E-commerce Project v2 Part 1 - Database Design]#django #database

Field Names

  1. Unique, descriptive name that is meaningful
  2. Accurate, clear, and unambiguous
  3. minimum number of words
  4. Avoid word that convey physical characteristics
  5. Avoid where possible acronyms and abbreviations

Ideal Fields

  • Represents a distinct characteristic of the subject of the table
  • Should contains a single value
  • Cannot be deconstructed into smaller components
  • Avoid a calculated or concatenated values
  • Unique within the entire database structure

Elements of the Ideal Table:

  1. Represents a single subject, which can be an object or event
  2. It has a primary key
  3. It does not contain multipart or multivalued fields
  4. It does not contain calculated fields
  5. It does not contain unnecessary duplicate fields
  6. contains only an absolute minimum amount of redundant data

Candidate Key:

  • Field / fields that uniquely identifies a single instance

Candiadate Key Conformality:

  • It cannot be a multipart field
  • It must contain unique values
  • It cannot contain Nulls
  • Its value cannot cause a breach of the organization's security or privacy rules
  • is not optional in whole or in part
  • Uniquely and exclusively identify each record in the table
  • Exclusively identify the value of each field within a given record
  • Its value can be modified only in rare or extreme cases

Table Relationships

  • Establishes a connection between a pair of tables
  • Helps to further refine table structures and minimize redundant data
  • Mechanism that enables you to draw data from multiple tables simultaneously

M:N Relationships:

  • many-to-many relationship has an inherent peculiarities
  • must address before you can effectively use the data from the tables
  • can cause duplications in the returned datasets
  • duplicate data will exist within both tables

What is subject database?

A subject database is a collection of specialized information with a narrow focus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment