Creating a Database Structure
Why are we creating a Database Structure?
1. Go to cPanel > phpMyAdmin
2. Using the login details we created when making the database 'jasonve1_menu' log into phpMyAdmin
Using this info to create the tables/structure of the database:
§ product_id – int, not null, primary key, autoincrement
§ name – varchar(255), not null
§ dish_id – int, not null, primary key, autoincrement
§ name – varchar(255), not null
§ course_id – int, not null, primary key, autoincrement
§ name – varchar(255), not null
§ products_dishes_id – int, not null, primary key, autoincrement
§ product_id - int, not null, foreign key (Product.product_id)
§ dish_id - int, not null, foreign key (Dish.dish_id)
- Table: products_courses
§ products_courses_id – int, not null, primary key, autoincrement
§ product_id - int, not null, foreign key (Product.product_id)
§ course_id - int, not null, foreign key (Course.course_id)
5. For the first the first table. Create a Table
6. Add in the details for the 2 columns ie.
§ product_id – int, not null, primary key, autoincrement
§ name – varchar(255), not null
6. Do the same for the following
§ products_dishes_id – int, not null, primary key, autoincrement
§ product_id - int, not null, foreign key (Product.product_id)
§ dish_id - int, not null, foreign key (Dish.dish_id)
We have trouble creating a foreign key. So now what?