As we continue to explore databases and ideas, this project will help you practice model databases and relationships, as well as help you get started on your capstone project.
First, you will expand your CompanyDatabase to have Departments, Products and Orders. You will be crafting queries for these new tables.
After that, this weekend is the next big push your final project, work on the HTML and CSS; As well as the database schema.
Objectives
Work with Foreign Keys
Craft Queries
Requirements
Add a few tables and foreign keys to an existing database
Explorer Mode
[x] In your Company Database, add a table named:
C#: Departments. Give this table a few columns
Ruby: departments. Give this table a few columns
[x] Add a Foreign key named:
C# DepartmentId to your Employee Table
Ruby: department_id to your employees table
[x] Add tables named:
C#: Products and Orders. Give each table a few columns
Ruby: products and a orders. Give each table a few columns
[x] In our company, 1 Order can have many Products and 1 Product can have many Orders. This will be a Many-to-Many relationship. Create the tables and foreign keys needed for this to happen
[x] Create queries that can do the following:
[x] Given a department id, give me all employees in the department
[x] Given a department name, give me the phone extensions
[x] Find all orders that contain the product id of 2
[x] Given an order id, display on the OrderNumber, and all the product names
[x] Inserts a new product
[x] Creates a new order
[x] Adds a product to an order
[x] Adds a new employee to a department
[x] Updating a employee's department
[x] Removing a product from an order
[x] Turn in the above queries as a gist
[x] Work on your final project HTML. DO not sleep on this. You have the time and resources to get a good bit of this done this weekend.
[x] Complete your first draft of your database schema for your final project.
As we continue to explore databases and ideas, this project will help you practice model databases and relationships, as well as help you get started on your capstone project.
First, you will expand your CompanyDatabase to have
Departments
,Products
andOrders
. You will be crafting queries for these new tables.After that, this weekend is the next big push your final project, work on the HTML and CSS; As well as the database schema.
Objectives
Requirements
Explorer Mode
[x] In your Company Database, add a table named:
Departments
. Give this table a few columnsdepartments
. Give this table a few columns[x] Add a Foreign key named:
DepartmentId
to yourEmployee
Tabledepartment_id
to youremployees
table[x] Add tables named:
Products
andOrders
. Give each table a few columnsproducts
and aorders
. Give each table a few columns[x] In our company, 1
Order
can have manyProducts
and 1Product
can have manyOrders
. This will be a Many-to-Many relationship. Create the tables and foreign keys needed for this to happen[x] Create queries that can do the following:
2
OrderNumber
, and all the product names[x] Turn in the above queries as a gist
[x] Work on your final project HTML. DO not sleep on this. You have the time and resources to get a good bit of this done this weekend.
[x] Complete your first draft of your database schema for your final project.
Adventure Mode
Epic Mode
Additional Resources
Recommended Practice: