Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is the value of @Quantity set by the procedure if it is NULL? Q1-Q7 are based on the table (Books) below & procedure. Q8

What is the value of @Quantity set by the procedure if it is NULL?image text in transcribed

Q1-Q7 are based on the table (Books) below & procedure. Q8 is based on Views and Q9 is based on Triggers. BookID BookAuthor BookTitle BookPrice 1 Michelle Obama Becoming 16.00 2 Maya Angelou Still I Rise 20.00 3 Yuval Noah Harari Sapiens 20.00 4 Coleman Barks The Essential Rumi 10.00 5 James McClintock Lost Antarctica 15.00 CREATE PROC order Books @Title varchar (100) = NULL, @Quantity int = NULL AS DECLARE @P varchar (50), @TotalPrice money, @id int, Author varchar (50) IF @Title IS NULL THROW 50002, 'Book Title cannot be NULL', 1 IF @Quantity IS NULL SET @Quantity = 1 SET @TotalPrice = (SELECT Book Price*@Quantity FROM Books WHERE BookTitle = @ Title) SET @id = (SELECT BOOKID FROM Books WHERE BookTitle = @ Title) SET @Author = (SELECT BookAuthor FROM Books WHERE BOOKID = @id) : SET @P = CONVERT (varchar, @id) + ' ' + @Author + CONVERT (varchar, @TotalPrice) RETURN @P GO DECLARE @book varchar(100) -----first----- EXEC @book = orderBooks @title= 'Still I Rise', @Quantity=2 PRINT @book ---second---- EXEC @book = orderBooks @Title= 'Still I Rise PRINT @book third----- EXEC @book = orderBooks PRINT @book

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

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago