Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create Functions: Functions are programmable objects that are used to perform calculations that can be returned to a calling application or integrated into a

imageimage

Create Functions: Functions are programmable objects that are used to perform calculations that can be returned to a calling application or integrated into a result set. Functions can access data and return results, but they cannot make any modifications. In this exercise, you create different types of functions - scalar functions, and Table-valued functions 1. In the query window, you create and use a scalar function to return the total orders placed by the customer 126. Use CUSTOMER_NUM as the argument for the function call. 2. In the existing query window, type, SELECT statement and execute the code to return results from the function 3. In the existing query window, type, highlight, and execute the following code to verify the results of the above two steps: SELECT COUNT(o.ORDER_NUM) FROM CUSTOMER C INNER JOIN ORDERS O ON C.CUSTOMER_NUM = o.CUSTOMER_NUM WHERE O.CUSTOMER_NUM= '126' 4. Open a new query window, type, and execute the code to write an inline table valued function to find the customers who have not placed any orders. 5. Test the function using the following SELECT statement: SELECT c.CUSTOMER NAME FROM CUSTOMER c LEFT OUTER JOIN ORDERS O ON C. CUSTOMER_NUM= o.CUSTOMER_NUM WHERE O.ORDER_NUM IS NULL; 689 G AWN- 75 % 2 3 Eluse Inventory; select from REP; select from CUSTOMER; select from ITEM; select * from ORDERS; select from ORDER_LINE; * 5 /*In the query window, you create and use a scalar function to return the total orders placed by the customer 126. Use CUSTOMER_NUM as the argument for the function call.*/ Results CUSTOMER_NUM 126 260 334 386 440 Messages 502 586 665 713 ITEM NUM CUSTOMER_NAME Toys Galore Brookings Direct The Everything Sh... Johnson's Departm... Grove Historical M... Cards and More Almondton General... Cricket Gift Shop Cress Store DESCRIPTION ON HAND STREET 28 Laketon St. 452 Columbus Dr. 342 Magee St. 124 Main St. 3456 Central Ave. 167 Hale St. 3345 Devon Ave. 372 Oxford St. 12 Rising Sun A... CATEGORY CITY Fullton CA Grove CA Con... CA Nort... CA Fullton CA Mesa CA Almo... CA Grove CA Con... CA STOREHOUSE STATE CREDIT_LIMIT REP_NUM POSTAL CODE BALANCE 90085 1210.25 7500.00 575.00 10000.00 90092 90097 2345.75 90098 879.25 90085 345.00 7500.00 7500.00 5000.00 5000.00 15000.00 90104 5025.75 3456.75 90125 90092 90097 678.90 7500.00 4234.60 10000.00 PRICE 15 30 45 30 45 15 45 30 15

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_2

Step: 3

blur-text-image_3

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

Principles Of Information Security

Authors: Michael E. Whitman, Herbert J. Mattord

7th Edition

035750643X, 978-0357506431

More Books

Students also viewed these Databases questions