Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using the BIKES database structure and file create the BIKES objects. Be sure to create the schema first (then you no longer need the
Using the BIKES database structure and file create the BIKES objects. Be sure to create the schema first (then you no longer need the command). 2. Using the Excel Spreadsheet With Data create all the necessary INSERT statements to populate all 4 tables. 3. You will need to submit a .sql (text file) that includes all your INSERTS and your queries below (do NOT include any screenshots - you .sql code should adequately answer the questions). Demonstrate that each object has data in it 4. /* PRODUCTS Table Data */ 5. /* BRANDS Table Data */ 6. /* CATEGORIES Table Data */ 7. /* STOCKS Table Data */ Complex Queries 8. /* Create a query that shows all the data attributes exactly like the spreadsheet */ Should look something like: Should look something like: Results Messages category_id 6 6 1 2 3 4 5 6 category_name brand_id brand name model year product_name Mountain Bikes Trek 820-2016 9 Trek 2016 Mountain Bikes 5 2016 2016 8 9 2016 3 2016 8 2016 6 6 6 Ritchey Timberwolf Frameset-2016 Surty Wednesday Frameset-2016 Trek Fuel EX 829-2016 Heller Shagamaw Frame-2016 Surty Ice Cream Truck Frameet-2016 Trek Slagh 9. /* Create a query that shows how many bikes (qty) of brands names are in each category name */ Mountain Bikes Mountain Bikes Ritchey Surty Trek Heller Surty Mountain Bikes Mountain Bikes untain Bikes list price product_id quantity store_id 379.99 1 1 27 749.99 2 5 1 999.99 3 6 1 23 1 22 1 2899.99 4 1320.99 469.99 3999.00 1 5 6 0 1 2 3 4 5 6 Children Bicycles Children Bicycles Children Bicycles Comfort Bicycles Comfort Bicycles cles 10./* Create a query that shows category names, brand names and how many each store has */ 1 2 Results Messages 456700 category_name Children Bicycles Children Bicycles store_id 1 1 3 1 1 8 Results 1 1 brand_name aty 84 12 9 3 69 1 1 1 Electra Haro Strider Sun Bicycles Trek Electra Sun Bicycle actra Messages category_name Children Bicycles Children Bicycles Children Bicycles Children Bicycles Children Bicycles Comfort Bicycles Comfort Bicycles Cruisers Bicycles ers Bic 57 27 192 brand_name qty 28 4 3 1 23 19 9 64 3 Electra Haro Strider Sun Bicycles Trek Electra Sun Bicycles Electra Pure 11./* Show total quantity and amount of inventory for each store based upon list price broken out by category of bike and brand. Brand total dollars should look like $12,456.00 */ 11./* Show total quantity and amount of inventory for each store based upon list price broken out by category of bike and brand. Brand total dollars should look like $12,456.00 */ 23 1 1 1 4 Results 56789 store_id 1 1 1 1 1 1 1 10 1 Messages category_name Children Bicycles Children Bicycles Children Bicycles Children Bicycles Children Bicycles Comfort Bicycles Comfort Bicycles Cruisers Bicycles Cruisers Bicycles Criners Bicycles Bicycle brand_name qty brand total Electra 28 Haro 4 Strider 3 1 Sun Bicycles Trek Electra 23 19 Sun Bicycles 9 Electra 64 Pure Cycles 3 $9,249.72 $999.96 $629.97 $109.99 $5,989.77 $14,979.81 $4,243.91 $50,329.27 $1,327.00 Bicycles 11 $5,315.89 7.99 - create schema bikes; /****** Object: Table [production]. [brands] Script Date: 10/31/2021 4:55:23 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO DROP TABLE IF EXISTS [bikes]. [stocks]; CREATE TABLE [bikes]. [stocks] ( [store_id] [int] NOT NULL, [product_id] [int] NOT NULL, [quantity] [int] NULL DROP TABLE IF EXISTS [bikes]. [products]; CREATE TABLE [bikes]. [products] ( [product_id] [int] NOT NULL PRIMARY KEY, [product_name] [varchar] (255) NOT NULL, [brand_id] [int] NOT NULL, [category_id] [int] NOT NULL, [model year] [smallint] NOT NULL, [list_price] [decimal] (10, 2) NOT NULL D DROP TABLE IF EXISTS [bikes]. [brands]; CREATE TABLE [bikes]. [brands] ( [brand_id] [int] NOT NULL PRIMARY KEY, [brand_name] [varchar] (255) NOT NULL DROP TABLE IF EXISTS [bikes]. [categories]; CREATE TABLE [bikes]. [categories]( [category_id] [int] NOT NULL PRIMARY KEY, [category_name] [varchar] (255) NOT NULL ALTER TABLE [bikes] . [products] ADD FOREIGN KEY ([brand_id]) REFERENCES [bikes].[brands] ([brand_id]); ALTER TABLE [bikes]. [products] ADD FOREIGN KEY ( [category_id]) REFERENCES [bikes]. [categories] ([category_id]); ALTER TABLE [bikes]. [stocks] ADD PRIMARY KEY ([store_id], [product_id]); ALTER TABLE [bikes]. [stocks] ADD FOREIGN KEY ([product_id]) REFERENCES [bikes]. [products] ([product_id]); Database Diagrams Tables System Tables File Tables External Tables dbo.customers dbo.DEPARTMENT dbo.employees dbo.offices dbo.orderdetails +dbo.orders dbo.payments dbo.productlines + dbo.products
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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