Write a script that creates a cursor for a result set

Assignment Help Database Management System
Reference no: EM131049344

Lab Assignment

Exercises

1. Write a script that creates a cursor for a result set that consists of the ProductName and ListPrice columns for each product with a list price that's greater than $700. The rows in this result set should be sorted in descending sequence by list price. Then, the script should print the product name and list price for each product so it looks something like this:

Gibson SG, $2517.00
Gibson Les Paul, $1199.00

2. Write a script to declare and use a cursor for the following SELECT statement. Use a WHILE loop to fetch each row in the result set. Omit the INTO clause to fetch directly to the Results tab.

SELECT LastName, AVG(ShipAmount) AS ShipAmountAvg
FROM Customers JOIN Orders
ON Customers.CustomerID = Orders.CustomerID
GROUP BY LastName;

3. Modify the solution to exercise 2 to fetch each row into a set of local variables. Use the PRINT statement to return each row in the format "Name, $0.00" to the Messages tab.

Reference no: EM131049344

Questions Cloud

What is the net present value of investment opportunity : You work for a small, local telecommunications company. In five years, the company plans to undertake a major upgrade to its servers and other IT infrastructure. Management estimates that it will need up to $450,000 to cover all related costs; Using ..
What is the break-even probability of collection : On each non delinquent sale Cast Iron receives revenues with a present value of $1,240 and incurs costs with a present value of $1,090. Assume there is no possibility of repeat orders and that the probability of successful collection from the custome..
What is the present value of a five year annuity : What is the present value of a five year annuity of $3,000 if the interest rate is 12% and the first payment is made today? $9,655.65 $10,814.33 $12,112.05 $13,200.00
Bonds outstanding that are selling at par value : Jack's Construction Co. has 80,000 bonds outstanding that are selling at par value. Bonds with similar characteristics are yielding 8.6 percent. The company also has 4 million shares of common stock outstanding.
Write a script that creates a cursor for a result set : Write a script that creates a cursor for a result set that consists of the ProductName and ListPrice columns for each product with a list price that's greater than $700.
At what price is the stock selling : Favored stock will pay a dividend this year of $2.88 per share. Its dividend yield is 8%. At what price is the stock selling? (Do not round intermediate calculations.)
Maturity of the bonds-what is the price of the bond now : Several years ago, Castles in the Sand Inc. issued bonds at face value of $1,000 at a yield to maturity of 5.8%. Now, with 5 years left until the maturity of the bonds, the company has run into hard times and the yield to maturity on the bonds has in..
What was plylers equity multiplier : Assuming that all Plyler’s sales are on credit, what was the company’s Days Sales Outstanding in 2015? (For balance sheet accounts, use the average of the beginning and end-of-year balances). What was Plyler’s Equity Multiplier for 2015?
Explain what the wacc means : BUS 420 - Corporate Finance - Explain what the WACC means, how can you use it in decisions, and do you think that you got a reasonable estimate.

Reviews

Write a Review

Database Management System Questions & Answers

  Knowledge and data warehousing

Design a dimensional model for analysing Purchases for Adventure Works Cycles and implement it as cubes using SQL Server Analysis Services. The AdventureWorks OLTP sample database is the data source for you BI analysis.

  Design a database schema

Design a Database schema

  Entity-relationship diagram

Create an entity-relationship diagram and design accompanying table layout using sound relational modeling practices and concepts.

  Implement a database of courses and students for a school

Implement a database of courses and students for a school.

  Prepare the e-r diagram for the movie database

Energy in the home, personal energy use and home energy efficiency and Efficient use of ‘waste' heat and renewable heat sources

  Design relation schemas for the entire database

Design relation schemas for the entire database.

  Prepare the relational schema for database

Prepare the relational schema for database

  Data modeling and normalization

Data Modeling and Normalization

  Use cases perform a requirements analysis for the case study

Use Cases Perform a requirements analysis for the Case Study

  Knowledge and data warehousing

Knowledge and Data Warehousing

  Stack and queue data structure

Identify and explain the differences between a stack and a queue data structure

  Practice on topic of normalization

Practice on topic of Normalization

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd