Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For all tasks below, you are MUST write SQL code in the SQL query view in MYSQL. Examine the following two relations which are
For all tasks below, you are MUST write SQL code in the SQL query view in MYSQL. Examine the following two relations which are part of a database for a company selling horse accessories. Product Product No (PK) P001 P002 P003 P004 P005 Warehouse Warehouse No (PK) W010 W020 W015 W040 W025 Description Riding Hat Jodhpurs Back Support Riding Boots Jacket City London Cambridge York Bedford Nottingham Price 50 20 60 100 150 Address 10 New Road 23 Hills Road 456 Long Road 45 Old Street 56 Bar Hill Assumptions: 1. The products sold by the company are stored in Warehouses. 2. Each warehouse can store many products. 3. Each product can be stored in many warehouses. NOTE: The codes to create the above tables are given in the HorseDB.sg! file. Download the file and execute it. You will need the Product and Warehouse tables before you create the Stock table: Task 1: Create a Stock table which links the product table with the warehouse table and contains the attributes given in the table below. You are expected to give each attribute a relevant name and data type, and to correctly define the primary key and foreign keys: Stock Attribute Attribute 1 Attribute 2 Attribute 3 Attribute 4 Attribute 5 Attribute 6 Description Code used to uniquely identify the Stock. Link to the Product Table. Links to the Warehouse Table. Stock quantity. Aisle Number where stock located in warehouse. Bin Number where stock is located in aisle. Data Type String-5 characters String-5 characters String-5 characters Integer String-5 characters Integer Task 2: Populate the table with at least 5 rows of data. Make sure the data is realistic and the Entity and Referential Integrity Constraint are not violated. You will be marked on the following GOALS: These GOALs are all individual and worth 1 mark. 19.1. The correct use of the CREATE TABLE statement. 19.2. Relevant attribute names. 19.3 Relevant domain types. 19.4. Correctly defined Primary Key. 19.5 Correctly define the Foreign Keys. 19.6. The correct use of the INSERT INTO statement. 19.7. The correct use of the VALUES statement. 19.8. Relevant data inserted into table. 19.9. Demonstrate that the Entity Integrity constraint is not violated. 19.10. Demonstrate that the Referential Integrity constraint is not violated. For these GOALS, the entry into your portfolio MUST contain the SQL code and a screenshot of the resultant table after the code is run.
Step by Step Solution
★★★★★
3.47 Rating (144 Votes )
There are 3 Steps involved in it
Step: 1
Based on the instructions and the goals listed you are required to create a Stock table which links the existing Product and Warehouse tables define r...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started