Create db procedures that implements arithmetic operations

Assignment Help Database Management System
Reference no: EM131982946

Assignment

You have been asked to create and test two DB2 procedures: one that implements basic arithmetic operations, and another that retrieves data from a specific table. You will develop a version of each procedure for both the Power Systems and System-z environments.

Upon the completion of this lab, students will have hands-on experience coding SQL PL Procedures in DB2 on multiple platforms.

Deliverables:

Lab Steps

Step 1 DB2 SQL PL Basic Arithmetic Procedure in Power Systems.
Step 2 DB2 SQL PL Basic Arithmetic Procedure in System z.
Step 3 Retrieving data from Student Registration Database in Power Systems.
Step 4 Retrieving data from Student Registration Database in System z.

You should submit to the Dropbox a Word document containing:

SQL PL code for each task

Screenshots of the output from each task (Each screenshot immediately follows the associated code).

iLab Steps

Step 1: SQL PL Basic Arithmetic Procedure

Code a PL/SQL script that will output three variables containing messages. To produce these messages, your procedure should initialize three variables with the values 45, 72, and 6.3. These values will be used to create messages as follows.

The first message will report the result of adding the first two numbers (45 and 72) and then multiplying their sum by the third number (6.3). Format the message as:

The result of (first_num + second_num) * third_num equals tot_val.

An example message, formed using different numbers but following the same approach, would look like this:

The result of (2 + 3) * 4 equals 20

The second message will be constructed in a similar manner, except that now the first number (45) is added to the product of the last two numbers (72 and 6.3). Format the second message as:

The result of first_num + second_num * third_num equals tot_val.

An example message, formed using different numbers but following the same approach, would look like this:

The result of 2 + 3 * 4 equals 14.

The third message should state:

The difference is due to the "Order of Operations."

Sample output:
Lab01_Tsk01 Output:
The result of (2 + 3) * 4 equals 20
The result of 2 + 3 * 4 equals 14
The difference is due to the "Order of Operations."
The result of 2+3*4 equals 14
The difference is due to the "Order of Precedence".
Step 2: Retrieving data from Student Registration Database

This requires use of the Student Registration Database and the columns in the Student Table.

Code a SQL PL procedure that will accept a student id as an input parameter and then retrieve the student's first name, last name, employer, and phone number. This information will be packaged into a message that gets returned from the procedure as an output parameter. The message will be formatted as follows:

[first_name] [last_name] works at [employer] and can be reached at [phone].

For example:

Joe Blowe works at FedEx and can be reached at (773) 555-1212.
However, if the student id entered cannot be found in the table, your output message should be as follows::
The student id n does not exist.

For example:

The student id, 999, does not exist.

Execute the script four times, using the following values: 130, 200, 310, and 909. The last value should result in the message stating that the student id does not exist. (This is a function of the data in the Student table - do not hard-code any specific values in your procedure).

Reference no: EM131982946

Questions Cloud

What is the coupon rate on the bonds : Maxcorp’s bonds sell for $1,200.28. The bond life is 9 years, and the yield to maturity is 8.7%. What is the coupon rate on the bonds?
Organization development and change : 1. Choose a company for study that has gone through a major recent change, turnaround, renewal or transformation.
Defined benefit pension plan for its employees : Melanie Vail Corp. sponsors a defined benefit pension plan for its employees.
The yield to maturity on the bonds has increased : The company has run into hard times and the yield to maturity on the bonds has increased to 10%. What is the price of the bond now?
Create db procedures that implements arithmetic operations : Create and test two DB2 procedures: one that implements basic arithmetic operations, and another that retrieves data from a specific table.
The dividends are expected to grow at constant rate : The dividends are expected to grow at a constant rate of 5 percent per year indefinitely.
Members of the millennial generation : With this in mind, what should Baby-Boomers know about members of the Millennial generation to best manage them in the workplace?
Define the project in the context of mining : Develop skills for expressing the manner in which a principal normally engages with contractors through a tendering process.
What effect do these changes have on employees : What effect do these changes have on employees? What role can HR play in mitigating these effects?

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