Professional Documents
Culture Documents
http://flic.kr/p/ar4nLn
What are you going
to learn about today?
• MySQL database
programming
• Relational DB model
• How to write SQL queries
http://flic.kr/p/8JpkTg
Database (DB): Organized collection of data
http://flic.kr/p/ar4nLn
use of a DB
Why use a DBMS?
• DB client tools
– Example: MySQL Workbench
• Code using DB library
– Lib example: Java Database Connectivity (JDBC)
Relational Model Concepts
http://en.wikipedia.org/wiki/File:Relational_model_concepts.png
Example Tables
Authors
AuthorID FirstName LastName YearBorn
1 Ayn Rand 1905
2 Peter Benchley 1940
Publishers AuthorISBN
PublisherID PublisherName ISBN AuthorID
1 Bobbs Merrill 0452273331 1
2 Random House 0452011876 1
1400064562 2
Titles
ISBN Title EditionNumber YearPublished Description PublisherID
0452273331 The Fountainhead 1 1943 … 1
0452011876 Atlas Shrugged 1 1957 … 2
1400064562 Jaws 1 1973 … 2
Primary versus Foreign Keys
• Relational DBs
• CRUD to SQL mapping
– JOIN operation
• JDBC programming
• Watch out for race
conditions!
http://flic.kr/p/YSY3X