Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Language is: T-SQL Please create a re-runnable script that creates a table (specified below) and then populates it with some specific values. a. The new

Language is: T-SQL

Please create a re-runnable script that creates a table (specified below) and then populates it

with some specific values.

a. The new tables name is MyProducts

b. Make sure to drop it if it already exists

c. The table has three columns:

i. MyProductsId which is the primary key, an identity and does not allow

nulls

ii. Name which is a NVARCHAR(40) and does not allow nulls

iii. UnitPrice which is a MONEY data type and does not allow null values

d. Insert a row with the following values

i. The MyProductsId must be 5

ii. The name of the product is: Golden Product

iii. The unit price for the product is $999.99

e. Insert the first 10 rows from the Northwind Products table. Ensure the rows have

MyProductId values of 11 20, not their original values of 1-10. Use a query with

an INSERT statement to populate these rows into the MyProducts table.

*This is the original Northwind Products table:

image text in transcribed

>>The database diagrams are shown below:

image text in transcribed

image text in transcribed

ProductID ReorderLevel 10 Discontinued 0 1 1 1 Units OnOrder 0 40 70 2 Unit Price 18.00 19.00 10.00 22.00 25 2 3 0 25 3 4 N N 4 Units In Stock 39 17 13 53 0 120 15 6 ommoon 0 Product Name Chai Chang Aniseed Syrup Chef Anton's Cajun Seasoning Chef Anton's Gumbo Mix Grandma's Boysenberry Spread Uncle Bob's Organic Dried Pears Northwoods Cranberry Sauce Mishi Kobe Niku Ikura 5 Supplierld CategoryID Quantity PerUnit 1 10 boxes x 20 bags 1 1 24 - 12 oz bottles 1 12- 550 ml bottles 2 48 - 6 oz jars 2 2 36 boxes 3 2 12- 8 oz jars 3 7 12-1 lb pkgs. 3 2 12-12 oz jars 6 18-500 g pkgs. 4 8 12 - 200 ml jars 5 6 0 1 21.35 25.00 6 25 0 0 7 O O O O O O 7 10 30.00 40.00 8 0 0 8 9 9 97.00 29 0 0 1 10 10 31.00 31 0 0 Condensed Type Allow Nulls Identity int Order Details Column Name Condensed Type Allow Nulls Identity 8 OrderlD int 9 ProductID int UnitPrice money Quantity smallint Discount real nvarchar(40) Categories Column Name Condensed Type Allow Nulls Identity 9 CategoryID int CategoryName nvarchar(15) Description ntext Picture image int 000000 Products Column Name 8 ProductID Product Name SupplierlD CategoryID QuantityPerUnit UnitPrice UnitsinStock UnitsOnOrder ReorderLevel 00000 int nvarchar(20) money smallint smallint smallint 00000000000 8 Identity Discontinued bit Employee Territories Column Name Condensed Type Allow Nulls Identity 9 Employeeld TerritoryID nvarchar(20) int Customers Column Name Condensed Type Allow Nulls 9 CustomerlD nchar(5) CompanyNa... nvarchar(40) Contact Name nvarchar(30) Contact Title nvarchar(30) Address nvarchar(60) M City nvarchar(15) Region nvarchar(15) PostalCode nvarchar(10) Country nvarchar(15) Phone nvarchar(24) Fax nvarchar(24) OOO |TOO Territories Column Name Condensed Type Allow Nulls Allow Nulls Identity 8 TerritoryID nvarchar(20) TerritoryDescription nchar(50) RegionID int Suppliers Column Name Condensed Type Allow Nulls Identity Suppliers int CompanyName nvarchar(40) ContactName nvarchar(30) Contact Title nvarchar(30) M Address nvarchar(60) City nvarchar(15) Region nvarchar(15) PostalCode nvarchar(10) Country nvarchar(15) Phone nvarchar(24) M Fax nvarchar(24) HomePage ntext 000 Region Column Name Condensed Type Allow Nulls Identity 9 RegionID int RegionDescription nchar(50) 000 CustomerCustomerDemo Column Name Condensed Type Allow Nulls Identity 9 CustomerlD nchar(5) CustomerTypeID nchar(10) Employees Column Name Condensed Type Allow Nulls Identity Employeeld int LastName nvarchar(20) FirstName nvarchar(10) Title nvarchar(30) TitleOfCourtesy nvarchar(25) BirthDate datetime HireDate datetime Address nvarchar(60) City nvarchar(15) Region nvarchar(15) PostalCode nvarchar(10) M Country nvarchar(15) HomePhone nvarchar(24) Extension nvarchar(4) Photo image OOOOOOOOOOOOOOOOOOO Orders Column Name Condensed Type Allow Nulls Identity od 9 OrderD int CustomerlD nchar(5) Employeeld int OrderDate datetime RequiredDate datetime ShippedDate datetime ShipVia int Freight money ShipName nvarchar(40) ShipAddress nvarchar(60) Ship City nvarchar(15) Ship Region nvarchar(15) ShipPostalCode nvarchar(10) Ship Country nvarchar(15) D Customer Demographics Column Name Condensed Type Allow Nulls Identity CustomerTypeID nchar(10) CustomerDesc ntext 000 ntext Notes Reports To PhotoPath int nvarchar(255) Shippers Column Name Condensed Type Allow Nulls Identity 8 ShipperID int CompanyName nvarchar(40) Phone nvarchar(24)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions