Introduction to MySQL NELINET October 28th, 2005
Preliminary Definitions MySQL: An Open Source, Enterprise-level, multi-threaded, relational database management system that stores and retrieves data using the Structured Query Language Structured Query Language (SQL): A standardized query language for getting information from a relational database. Relational Database: A database that stores data in the form of relational tables as 0pposed to flat files. Database Management System (DBMS): A system that manages relational databases; A collection of programs that enabling the storage, modification, and extraction of information from a database.
Cells, Rows, Tables and Databases Cell -- a single (scalar) value.
Cells, Rows, Tables and Databases Row -- a group of scalar values representing a single instance of an object or event.
Cells, Rows, Tables and Databases Table -- a series of rows describing separate objects or events.
Cells, Rows, Tables and Databases Database -- a collection of related tables describing various facets of a group of objects or events.
Relations -- One to One
Relations -- One to Many
Relations -- Many to Many
Database Design Sketch out your data and how the different pieces of data should be grouped and how they relate to one another. In fact, you can save yourself a great deal of frustration down the road if you take the time to think things through before you get started actually building the database. Literally draw it out in a diagram before you start!
Database Design - 1st Normal Form Each table should have a column that identifies a row (primary key). No two rows can be identical. Groups of cells should never repeat. Each column must have a unique name. Each column must contain scalar values.
Database Design - 2nd Normal Form Each cell in a row must depend on the primary key.
Database Design - 3rd Normal Form No cell that is dependent on the primary key can be used to control another non-primary key cell.
A Bad Data Model... Do we have a primary key? Do we have normality problems?
A Better Data Model...
Work Break!! Lets think about pizza...