1. Create an PL/SQL anonymous block. Using a “while” loop, display on the console those rows where a quantity of shipments for a project are greater than the average quantity of shipments for that project.
2. Repeat using a FOR loop.
// TABLE INFO : SHIPMENTS(SUPPLIERNO, PARTNO, PROJECTNO, QUANTITY, SHIPDATE, ARRIVEDATE)
Using While
DECLARE
s_sno shipments.supplierno%type;
s_pno shipments.partno%type;
s_projectno shipments.projectno%type;
s_quantity shipments.quantity%type;
s_shipdate shipments.shipdate%type;
s_arriveddate shipments.arriveddate%type;
CURSOR t1cursor IS
SELECT supplierno,partno,projectno,quantity,shipdate,arriveddate
FROM shipments
WHERE quantity>10000;
BEGIN
OPEN t1cursor;
WHILE t1cursor%FOUND LOOP
FETCH t1cursor INTO s_sno,s_pno,s_projectno,s_quantity,s_shipdate,s_arriveddate;
dbms_output.putline(s_sno || s_pno || s_projectno || s_quantity || s_shipdate || s_arriveddate);
ENDLOOP;
END;
Using FOR
DECLARE
s_sno shipments.supplierno%type;
s_pno shipments.partno%type;
s_projectno shipments.projectno%type;
s_quantity shipments.quantity%type;
s_shipdate shipments.shipdate%type;
s_arriveddate shipments.arriveddate%type;
CURSOR t1cursor IS
SELECT supplierno,partno,projectno,quantity,shipdate,arriveddate
FROM shipments
WHERE quantity>10000;
recordpresent shipmnents.quantity%type;
BEGIN
OPEN t1cursor;
FOR recordpresent IN t1cursor LOOP
FETCH t1cursor INTO s_sno,s_pno,s_projectno,s_quantity,s_shipdate,s_arriveddate;
dbms_output.putline(s_sno || s_pno || s_projectno || s_quantity || s_shipdate || s_arriveddate);
ENDLOOP;
END;
1. Create an PL/SQL anonymous block. Using a “while” loop, display on the console those rows where a quantity of shipmen...
1.Write a pl/SQL block that selects all the rows from the A2order table and prints them to screen. THIS CAN BE EASILY DONE USING AGGREGATE FUNCTIONS, BUT YOU MUST NOT USE AGGREGATE FUNCTIONS IN THIS ASSIGNMENT 2. 2.Write a pl/sql block that deletes the orders from the A2order table that were ordered after the order that has the highest order_price (Order_date will tell you when a row was entered). YOU MUST USE BULK OPERATIONS FOR THIS CODE 3. Write a...
PL/SQL Auction Program 1. Create a user xyz, who is the owner of the auction. Create the schema, and package. 2. Create users x1 and x2 who are the participants in the auction. They will need acces to the package. 3. Bid on the same item and record your observations. Verify all scenarios. Upload the files with the missing code and a detailed sample run. AUCTION OWNER.TXT SQL> conn / as sysdba Connected. SQL> drop user xyz cascade; User dropped....
1. Create a PL/SQL program block that determines the top students with respect to GPA. Assume that the database has four tables. Student(SSN, SName, DOB, Major) , Grade(SSN, CNo, Grade(0,1,2,3,4)) and Course table(CNo,CName, Credit Hour), Prerequisite(CNo, PreCNo); Student and couse data ae given in the following SQL statements a. Accept a number n as user input with SQL*Plus telling top n%. b. In a loop get the SName and GPA of the top n% people with respect to GPA. c....
#1) Display Last Name, First Name, DonorId, Fundname, TotalPledged from the donor’s database (you may need to use donor and pledge tables to get the information) for Donor ID 59034. (Your results window should have 3 rows) #2) Display all records from the PurchaseOrderHeader from the AdventureWorks Database that were sold by Employee 261 (Your results window should have 401 rows) #3) Display salesorderid, orderdate, totaldue, and territory name from salesorderheader and salesterritory for all totaldue that are greater than...
need help
Create or edit the SQL statements required to accomplish the following tasks. All columns should have a column name, feel free to create appropriate aliases Use screen shots to ca evidence that each task is completed; include the SQL records before and after statements are executed, as appropriate. Include all work, even if you get errors. Paste your screen shots into a single PowerPoint file pture statements output from the statements, and views of the object explorer when...
Exercise 3 [12.5 marks] Given the Restaurant management system database that contains the following tables (primary keys are underlined and foreign keys are preceded with #): Customer (customerID,customerFirstName,customerLastName,customerAddress) Oreder (orderID,orderDate, #customerID,#menuItemID,#staffID) MenuItem(menuItemID, menuItemName,ingredients,type,availability) Staff(staffID, staffName, staffPhoneNumber, staffRole ) OrderPayment(paymentID,paymentAmount,#orderID,#staffID) 1) Without using DISTINCT, write the SQL query equivalent to the following one:[1.5 marks] SELECT DISTINCT menuItemName FROM MenuItem WHERE type = ‘Vegetarian’ OR availability= ‘Yes’; 2) Express the following queries in SQL: a) Find the number of orders placed by...
Challenge: C# Basics Description: Write a C# console application using .NET Core that utilizes constants, variables, data types, operators, expressions, statements, blocks, and control flow. Purpose: This application provides experience in working with basic language features of C#. It is important when working with a new language to understand how it handles its constants, variables, data types, operators, expressions, statements, blocks, and control flow. A good thing to always do with a new language is to build test applications where...
Within DrJava, create a class called StudentQuizScores and do the following using a do-while loop. 1. You program will read in a student’s first name. The same will be done for the student’s last name. Your program will use respective methods (described below) to accomplish this. 2. Your program will then read in three quiz scores, respectively. This should be done by using the same method three times. This method is described below. 3. Your program will then calculate the...
C# Programming
1-Write a program that generates the following sequence using while loop 2, 3,6,11, 18, 27,... 102 2-A. Repeat 1 using for loop. B. Modify your program in A to skip 27 from that sequence. C. Modify your program in A by using break statement to stop generating the sequence if the generated number is greater than 30 3. Using loops, find the value of f(7) given: fO)-4, f(n) 2f(n-1)+4, where n is Natural number Hint: f(1)-2f(0)+4-2 4+4-12 f12)-2f(1)+4-...