y SQL Designing Databases Happy Meal Example Website
y. SQL Designing Databases Happy Meal Example
�Website for Mc. Donald’s Happy Meal toy collectors �Basic Functionality: ◦ Allow people to create site account ◦ Post info about toys ◦ Look up info about toys ◦ Trade/Post for Sale The Setup
�Database to house individual data �Determine how to organize it �Ea. Piece of info stored: FIELD �Sets of related fields: TABLE �All tables together: DATABASE What Data Must Site Deal In?
�User Info ◦ First Name ◦ Last Name ◦ User ID ◦ Password ◦ Photo ◦ Email Address �Toy Info ◦ Name ◦ Collection ◦ Year ◦ Picture ◦ Toy ID Some Basic Info to Store
�Collection ◦ User ID ◦ Toy ID Way to Link the Two Tables
Translating to My. SQL Creating Actual Database
� Data Types ◦ varchar(40) ◦ varchar(15) ◦ varchar(40) ◦ mediumblob ◦ varchar(40) ◦ ◦ ◦ varchar(40) date mediumblob varchar(15) Select Data Types for Fields
Start the WAMP & Open My. SQL
Create a new DB
�Name it �Set collation to utf 8_general_ci �Press create Create DB
Select the DB (happymeals)
�Fill in info �Press Go Create User Table
�Fill in Fields �Set userid as primary Set Fields in Table
See Results
�Return to DB by clicking happymeal link �Fill in info �Press Go Create Toy Table
�Fill in Fields �Set userid as primary Set Fields in Table
View Results
Create Collection Table
Set Fields
View Results
Access Tables & Print from Print View Option Link
View of Whole DB
View of Individual Tables
- Slides: 23