This Study Resource Was: SQL SCRIPT 1: Create A Stored Procedure SHOWSTATE That Has A Parameter of Two-Character State

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

SQL SCRIPT 1: Create a stored procedure SHOWSTATE() that has a parameter of two-character state

code ( eg. NY, CA, NJ) that will list all information about the customer who lives in a particular state.
Refer to the CUSTOMER table. The state code can be in lower or uppercase supplied in the parameter.
Use CA to test your stored procedure.

Hint: Use LIKE and UPPER in your stored procedure.

m
er as
co
eH w
o.
rs e
ou urc
o
aC s
vi y re
ed d
ar stu
is
Th
sh

This study source was downloaded by 100000829178195 from CourseHero.com on 11-22-2021 01:40:53 GMT -06:00

https://www.coursehero.com/file/86023000/assgn8docx/
SQL SCRIPT 2: Formulate a stored procedure DISPLAYTRANS() that will display the corresponding sales
transaction based on the transaction number passed. Display transaction number, sales date, product
code, description, unit, quantity. Use TR000039 to test the output of your script.

m
er as
co
eH w
o.
rs e
ou urc
o
aC s
vi y re
ed d
ar stu
is
Th
sh

This study source was downloaded by 100000829178195 from CourseHero.com on 11-22-2021 01:40:53 GMT -06:00

https://www.coursehero.com/file/86023000/assgn8docx/
m
er as
co
eH w
o.
rs e
SQL SCRIPT 3: Create a user-defined function GET_TOTAL_PAYMENT() that will get the total payment
ou urc
made for each transaction. A transaction number parameter will be included when the function is
called. Use TR000092 to test your function.
o

SQL SCRIPT 4: Create a stored procedure PAYMENT_SHORT that will display the transaction number,
aC s

customer name, total sales, total payment, and the difference between total sales and total payment.
vi y re

This stored procedure has no parameters.

In this procedure you will use a different set of views that you have created to extract total sales
depending on the correct unit price to be used based on effectivity date and sales date.
ed d
ar stu

Create these views first before using it inside your stored procedure.NO NEED TO DISPLAY THE CONTENT
OF THESE VIEWS.

To display output of the requirement, include GET_TOTAL_PAYMENT user-defined function that you
is

have created in item 3. TRANSNO should serve as the parameter AND NOT TR000092
Th
sh

This study source was downloaded by 100000829178195 from CourseHero.com on 11-22-2021 01:40:53 GMT -06:00

https://www.coursehero.com/file/86023000/assgn8docx/
Powered by TCPDF (www.tcpdf.org)

You might also like