Presentation is loading. Please wait.

Presentation is loading. Please wait.

Web Programming Week 3 Old Dominion University

Similar presentations


Presentation on theme: "Web Programming Week 3 Old Dominion University"— Presentation transcript:

1 Web Programming Week 3 Old Dominion University
Department of Computer Science CS 418/518 Fall 2008 Michael L. Nelson 9/08/08

2 LAMP Chapters 3, 10 of textbook Quick review of relational databases
more info: Quick review of relational databases normalization referential integrity Basic MySQL commands

3 “Graphic Novel” Super Heroes (from chapter 10)

4 1NF add primary key to tables eliminate repeating columns
each attribute is atomic

5 2NF satisfy 1NF create separate tables for data duplicated across rows

6 3NF satisfy 2NF create separate tables for any transitive or partial dependencies see note on p. 283 on why good/evil is not in a separate table

7 That’s About as Far As We’ll Go
Other normal forms are possible (BCNF, 4NF, 5NF) take a database class if you’re interested Referential integrity a foreign key (“link”) into another table is no longer valid “404 Errors” are bad in databases and should not happen how bad is a function of the data itself…

8 MySQL Hierarchy server=mln-web.cs.odu.edu database=classiccars
database=superheroes table 1 table 2 table 1 table 2 table 3 table 3

9 Manipulating Tables & Databases
CREATE - create new databases, tables ALTER - modify existing tables DELETE - erase data from tables DESCRIBE - show structure of tables INSERT INTO tablename VALUES - put data in table UPDATE - modify data in tables DROP - destroys table or database (values + structure) more:

10 Native MySQL Data Types
Unlike Perl, PHP and other civilized languages, MySQL is big into data types: many examples in chapter 3, 10

11 SQL Query Form SELECT [fieldnames] FROM [tablenames] WHERE [criteria]
ORDER BY [fieldname to sort on] [DESC] LIMIT [offset, maxrows] more: look at chapters 3 and 10 for code examples


Download ppt "Web Programming Week 3 Old Dominion University"

Similar presentations


Ads by Google