Answered step by step
Verified Expert Solution
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 A 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 A Write a DELETE statement that deletes the row you added to the Categories table in Step B This statement should use the CategoryID column to identify the row. After this command do the Select from A Write an INSERT statement that adds this row to the Products table: ProductID: The next automatically generated ID CategoryID: ProductCode: DGX ProductName: Yamaha DGX Key Digital Piano Description: Long description to come. ListPrice: DiscountPercent: this is the default DateAdded: Todays datetime 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 E This statement should change the DiscountPercent column from to 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. PT Extra Credit For Steps C & D google sql server get last inserted primary key" and code your update to not use a hardcoded key value, but to use the value of the last inserted primary key the your DB knows.
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 A
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 A
Write a DELETE statement that deletes the row you added to the Categories table in Step B This statement should use the CategoryID column to identify the row. After this command do the Select from A
Write an INSERT statement that adds this row to the Products table:
ProductID: The next automatically generated ID
CategoryID:
ProductCode: DGX
ProductName: Yamaha DGX Key Digital Piano
Description: Long description to come.
ListPrice:
DiscountPercent: this is the default
DateAdded: Todays datetime
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 E This statement should change the DiscountPercent column from to 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.
PT Extra Credit For Steps C & D google sql server get last inserted primary key" and code your update to not use a hardcoded 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
Get Instant Access with AI-Powered 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