Showing posts with label tables. Show all posts
Showing posts with label tables. Show all posts

Thursday, June 11, 2015

Databases

What is the difference between data and information? 

  • Data - random content, no context
  • Information - data within a context, data with MEANING
Database Anatomy
  • Table
    • Columns - topics/headers/descriptors of data
      • Field
    • Rows - individual instances of data
      • Records
Primary key - unique identifies (each record must be unique)
Foreign Key - relating information in other table

Table Relationships

One to oneBoth tables can have only one record on either side of the relationship. Each primary key value relates to only one (or no) record in the related table. Most one-to-one relationships are forced by business rules and don't flow naturally from the data. In the absence of such a rule, you can usually combine both tables into one table without breaking any normalization rules.
       -e.g. Spouses are 1 to 1 records. You can only have 1 spouse.



One to manyThe primary key table contains only one record that relates to none, one, or many records in the related table.
       -e.g. Parent-child relationships are one-to -many, as parents can have many children

Many to many - Each record in both tables can relate to any number of records (or no records) in the other table. Many-to-many relationships require a third table, known as a bridge table, because relational systems can't directly accommodate the relationship.
         -e.g. Students can take many courses, and courses can have many students

Integrity Rules

Entity Integrity - Each entity has a unique key

Referential Integrity - Foreign key value is null or matches primary key values in related table

Database Efficiency

Normalization  - reduces repetitive entries an makes the design and structure of the database as efficient as possible. There are multiple levels to this normalization (1 NF, 2 NF, 3 NF)

1 NF 
  • Eliminates duplicative columns from the same table.
  • Identifies each row with a unique column (the primary key
    • Steps
      • Eliminate repeating groups
      • Identify primary key
      • Identify all dependencies

2 NF
  • It is in 1 NF
  • There are no partial dependencies
    • Steps
      • Start with 1 NF formula
      • Write each key component w/ partial dependency) on separate line
      • Write original (composite) key on last line
      • Each component is new table
      • Write dependent attributes after each key

3 NF

  • It is in 2 NF
  • There are no transitive dependencies
    • Steps
      • Start with 2NF format
      • Break off the TP pieces and create separate tables

Tuesday, June 2, 2015

HTML Lists & Tables

Unordered Lists:

  • tag: ul
    • For Example
      < h3 > This list is unordered < /h3 >
      < ul type = "square" >
      < li >Read Book< /li >
      < li > Discuss Topic < /li >
      < /ul >
Ordered Lists:
  • tag: ol
    • For Example
      < h3 > Work your way through these items: < /h3 >
      < ol >
      < li >Read Book< /li >
      < li > Discuss Topic < /li >
      < /ol >
Nested Lists:
  • For Example: (note HTML ignores white space. We are using spaces to help us see where nesting is happening)
    < h3 > Work your way through these items < /h3 >
    < ol >
    < li >Read Book< /li >
           < ul >
                   < li > The Giver
                   < li > 1984
                   < li > Animal Farm
            < /ul >
    < li > Discuss Topic < /li >
           < ul >
                   < li > Dystopia
                   < li > How the past viewed the present vs. how the present really is
                   < li > Government Surveillance
           < /ul >
    < /ol >
Tables:
  • < table > - starts/stops table
  • < tr > - creates table row
  • < td > - creates an individual cell
    • For Example:
      < table >
      < tr >
      < td > The Giver

< td > 1984 < /td >
< td > Animal Farm < /td >
< /tr >
< /table >
  • To add table border:
    • < table border = "_" >
    REMEMBER TO CLOSE ALL TAGS! Working with lists and tables creates more tags, and can lead to confusion. Be sure to close all tags before moving on.