Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Class, Do the following tasks in SSMS: Load the MyGuitarShop DB ( unless already loaded ) . See the SQL Scripts Module. Select the MyGuitarShop

Class,
Do the following tasks in SSMS:
Load the MyGuitarShop DB ( unless already loaded). See the SQL Scripts Module.
Select the MyGuitarShop DB in the Object Explorer
Open the query text window via the New Query Tool.
New Query
Add /**/ Comments to your script to include your Name, class, and Assignment Name.
Create the following SQL queries using the specified DML statement in the query window. Comment each step in the script.
Issue the command "Select * from Categories;"
Write an INSERT statement that adds this row to the Categories table:
CategoryName: Saxes
Code the INSERT statement so SQL Server automatically generates the value for the CategoryID column. After this command - do the Select from 5A,
Write an UPDATE statement that modifies the row you just added to the Categories table. This statement should change the CategoryName column to Woodwinds, and it should use the CategoryID column to identify the row. After this command - do the Select from 5A.
Write a DELETE statement that deletes the row you added to the Categories table in Step 5B. This statement should use the CategoryID column to identify the row. After this command - do the Select from 5A.
Write an INSERT statement that adds this row to the Products table:
ProductID: The next automatically generated ID
CategoryID: 4
ProductCode: DGX_640
ProductName: Yamaha DGX 64088-Key Digital Piano
Description: Long description to come.
ListPrice: 799.99
DiscountPercent: 0(this is the default)
DateAdded: Todays date/time.
Use a column list for this statement. After this command - do a Select * from the Products table to see the results.
Write an UPDATE statement that modifies the product you added in Task 5E. This statement should change the DiscountPercent column from 0% to 35%. After this command - do another "Select * from Products"
Run your created script.
Save the displayed results (partial data OK) in a Screen shot.
Save the SqlQuery using SSMS into as a .sql file.
FYI - If data is lost as part of your testing, you can rebuild the DB using the MyGuitarShopDB script.
5PT - Extra Credit - For Steps 5C & 5D, google "sql server get last inserted primary key" and code your update to not use a hard-coded key value, but to use the value of the last inserted primary key the your DB knows.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions