Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask DBMS Expert


Home >> DBMS

Question 1:

Write an anonymous block that places a substitution variable (&) into a local variable of type varchar2. You will need to convert the types and round them to nearest tens unit.  For example 84.4555 would be 84.5. You should check the value entered in the local variable and output different messages depending on the value provided.  The anonymous block is a simple grade calculator with the following rules.

 

If value less than 44.5 output the following message "Resulting Grade for VALUE marks is 'F'"

 

If value is between 44.5 and 49.4 output the following message "Resulting Grade for VALUE marks is 'IS'"

 

If value is between 49.5 and 64.4 output the following message "Resulting Grade for VALUE marks is 'C'"

 

If value between 64.5 and 74.4 output the following message "Resulting Grade for VALUE marks is 'B'"

 

If value is between 74.5 and 84.4 output the following message "Resulting Grade for VALUE marks is 'A'"

 

If value is between 84.5 and 100 output the following message "Resulting Grade for VALUE marks is 'HD'"

 

If the value does not fall in the range of 0 - 100 print an error message "ONLY MARKS BETWEEN 0 AND 100 ACCEPTED)"

 

Question 2:

 

Write an anonymous block that meets the following specification:

 

  1. Using an explicit cursor, retrieve each row from the i_car table.
  2. Create a local variable that inherits the structure of the i_car table (using %ROWTYPE attribute). Place each row returned into this variable.
  3. Using an implicit cursor, calculate the number of bookings that belong to each car.
  4. Display the car registration, car group name, model name and the number of bookings for all the cars that have two or more bookings.
  5. If the car has no bookings sum up the number of cars without bookings.
  6. At the end of the run display a message "There are VALUE cars that have no bookings recorded".

 

Question 3:

Create a bound/host (or global) variable named G_NEWCOST.

 

Write an anonymous block that declares two local variables: A3_COST and B3_COST. The data types of these two variables should be the same as the data type of the column cost in i_car table. Also declare a constant called DEPRECIATION with value 15.25 to be used for deprecation calculation.

 

In your BEGIN section, write two SELECT queries to obtain value of the cost column where car_group_name is 'A3' and 'B3' and assign the corresponding values to A3_COST and B3_COST variables.

 

Now use the IF-THEN statement to compare the two variables to find out which one has a highest value. Calculate the new cost by using constant DEPRECIATION to calculate the new value (total cost * (100 - DEPRICATION)) to the higher value and assign the new value to bound/host variable G_NEWCOST.

 

Display a message in the following format from your code block:  "The car group CARGROUP has total cost of $TOTALCOST.XX and has been depreciated to $G_NEWCOST.XX"

 

The CARGROUP should display the highest car group (A3 or B3 depending on values).

 

The TOTALCOST will be the total calculated in the SELECT query statement.

 

G_NEWCOST will be the derived value after decreasing the cost with the DEPRECIATION value.  Format the G_NEWCOST value to 2 decimal places. 

 

The XX represent the decimal places in the format.

 

Using the PRINT command, output the value in the host variable (G_NEWCOST) after the anonymous block has run.

 

Question 4:

Write a PL/SQL solution that displays the registration and the maximum and the minimum miles travelled by a car during the rental period for all the bookings where the booking has been paid for.

The output from the anonymous block will be two messages.  One message will display the information for the maximum miles driven and one for the minimum miles driven in the following format.

 

"The maximum miles driven was MAXIMUM by car REGISTRATION over DAYS day's"

 

"The minimum miles driven was MINIMUM by car REGISTRATION over DAYS day's"

 

Where MAXIMUM is the maximum miles calculated from the bookings table.

 

MINIMUM is the minimum miles calculated in the bookings table.

 

DAYS is the rental_period for the maximum and minimum miles travelled in the booking table.

 

 

Your program must use at least one explicit cursor and must NOT use any aggregate functions, for example SUM, MAX, COUNT, etc.

DBMS, Programming

  • Category:- DBMS
  • Reference No.:- M91371819
  • Price:- $60

Guranteed 36 Hours Delivery, In Price:- $60

Have any Question?


Related Questions in DBMS

Analytic reportpurpose the purpose of this task is to

Analytic Report: Purpose: The purpose of this task is to provide students with practical experience in working in teams to write a Data Analytical report to provide useful insights, pattern and trends in the chosen/given ...

Sqlwrite a select statement that returns one column from

SQL Write a SELECT statement that returns one column from the Vendor table named Full Name. Create this column from the VendorContactFName and VendorContactLName columns. Format it as follows: last name, comma, first nam ...

Answer the following question explain the difference

Answer the following Question : Explain the difference between a database management system (DBMS) and a database. Are Microsoft Access, SQL Server, and Oracle examples of databases or database management systems (DBMS)?

Question as explained throughout this course entity

Question: As explained throughout this course, entity relationship modeling is a critical element of database design. If the database is not properly modeled, it is unlikely that the database will be properly developed. ...

Instructionsfor decades relational databases remained

Instructions For decades, relational databases remained essentially unchanged; data was segmented into specific chunks for columns, slots, and repositories, also called structured data. However, in this Internet of Thing ...

Question 1 a- consider that you are asked to design an

Question: 1. (a)- Consider that you are asked to design an entity relationship diagram based on the below scenario: A university consists of a number of departments (id, d_name) and each department offers some courses. A ...

Quesiton 1 what is data-manipulation language dml there are

Quesiton: 1. What is Data-Manipulation Language (DML)? There are four types of access in DML, explain each one. 2. Assume we have a Library Database consists of the following relations: author(author_id, first_name, last ...

Need an expert in the fields of system design to handle

Need an expert in the fields of system design to handle this project This is a system analysis and design project, not a research project. Refer to the list of deliverables in the instructions in the assignment to make s ...

Question team project submission - submit to the unit 4

Question: Team Project Submission - Submit to the Unit 4 Group Project Area This version of the capstone project assignment is FOR GRADING this week. Submit to the group area the document containing completed Sections On ...

Systems analysis project scenic routes operates a bus

Systems analysis project Scenic Routes operates a bus company that specializes in travelling on secondary roads, rather than Interstate highways. Their slogan is: "It Takes a Little Longer, But It's Scenic." The firm nee ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As