Introduction to MySQL

NELINET October 28th, 2005

A collection of programs that enabling the storage. Enterprise-level. Database Management System (DBMS): A system that manages relational databases. . 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. and extraction of information from a database.Preliminary Definitions MySQL: An Open Source. modification. multi-threaded.

a single (scalar) value. Rows. 12134 .Cells. Tables and Databases Cell -.

Tables and Databases Row -.1842 . 12135 1310391314 Letter: July 23.a group of scalar values representing a single instance of an object or event. Rows.Cells.

ID 1 21 34 1 21 35 1 21 36 METSID LABEL 1 09031 331 3 Letter: Nov ember 1 8. 1 838 1 31 0391 31 4 Letter: July 23.a series of rows describing separate objects or events. Rows.Cells. Tables and Databases Table -.1 842 1 31 302041 4 Waterloo at Sunset .

Cells. OBJECTS ID METSID LABEL CLINKS METSID COLID COLS ID NAME URL ABSTRACT .a collection of related tables describing various facets of a group of objects or events. Rows. Tables and Databases Database -.

One to One Table1 Record Record Record Record Record Record Record Table2 Record Record Record Record Record Record Record .Relations -.

Relations -.One to Many Table1 Record Record Record Record Record Record Record Table2 Record Record Record Record Record Record Record .

Relations -.Many to Many Table1 Record Record Record Record Record Record Record Table2 Record Record Record Record Record Record Record .

Literally draw it out in a diagram before you start! . 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.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.

No two rows can be identical. Each column must have a unique name.Database Design . Each column must contain scalar values.1st Normal Form Each table should have a column that identifies a row (primary key). . Groups of cells should never repeat.

2nd Normal Form Each cell in a row must depend on the primary key.Database Design . .

.Database Design .3rd Normal Form No cell that is dependent on the primary key can be used to control another nonprimary key cell.

A Bad Data Model.00 $20. INVOICE 65 65 65 65 66 66 LINE 1 2 3 4 1 1 VENDOR COMPANY A COMPANY A COMPANY A COMPANY A COMPANY B COMPANY B PRODUCT WIDGET 1 WIDGET 2 WIDGET 3 WIDGET 4 WIDGET 1 WIDGET 3 QTY 1 3 2 3 1 2 COST $10.00 $10.00 DATE 2/12/02 2/12/02 2/12/02 2/12/02 4/11/02 4/11/02 Do we have a primary key? Do we have normality problems? .00 $17..00 $34.00 $34..

00 $34..A Better Data Model. INVOICE VENDOR 65 COMPANY A 66 COMPANY B DATE 2/12/02 4/11/02 LINEID 121 122 123 124 125 126 INVOICE 65 65 65 65 66 66 LINE 1 2 3 4 1 1 PRODUCT QTY WIDGET 1 1 WIDGET 2 3 WIDGET 3 2 WIDGET 4 3 WIDGET 1 1 WIDGET 3 2 COST $10.00 $17.00 $34.00 $20..00 .00 $10.

.Work Break!! Lets think about pizza. ..

Sign up to vote on this title
UsefulNot useful