Answered step by step
Verified Expert Solution
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?
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 @bookStep 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