Create a PL/SQL procedure that takes department ID as an input
and prints
the details of all the students including the Student ID
(represented as StuID), name,
and the description of the major that they are currently enrolled
in. You may use the
following procedure template:
CREATE OR REPLACE PROCEDURE
Student_Major (I_deptID IN Student.DeptID%type)
AS
CURSOR c1 is ...
...
BEGIN
...
END Student_Major;
The source code for stored procedure is given below:
create or replace procedure Student_Major(i_deptid IN
Student.DeptID%type)
is
StuID Student.StuID%type;
Name Student.Name%type;
Major Student.Major%type;
CURSOR c_student is
SELECT StuID, Name, major FROM student where
DeptID=i_deptid;
BEGIN
dbms_output.put_line('StuID' || ' ' || 'Name' || ' ' ||
'Major');
dbms_output.put_line('----------------------------------------');
OPEN c_student;
LOOP
FETCH c_student into StuID, Name, Major;
EXIT WHEN c_student%notfound;
dbms_output.put_line(StuID || ' ' || Name || ' ' ||
Major);
END LOOP;
CLOSE c_student;
END Student_Major;
Source code screen shot is given below:
The schema of Student table is given below:
Student table contains the following records:
Output screen shot is given below:
Create a PL/SQL procedure that takes department ID as an input and prints the details of...
PL/SQL gap-fill question:
For the following stored procedure, please fill in the missing
information in the underlined areas:
create or replace procedure get_items_shipped_capt as
cursor list_items(cid in captain.capt_id%type) is
select item.item_no,_____________________ ,weight from
item,shipment_line,shipment
where item.item_no = ____________________________ and
shipment_line.shipment_id = shipment.shipment_id and
shipment.capt_id = ___________;
cursor all_captains is
select capt_id
from captain;
TB constant char(1) := CHR(9);
begin
for cp in _____________ loop
dbms_output.put_line(Captain ID: '||cp.capt_id);
dbms_output.new_line;
dbms_output.put_line('Item
Number'||TB||'Description'||TB||'Weight');
dbms_output.put_line('=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
=+=+');
for det in list_items(______________) loop
dbms_output.put_line(det.item_no||TB||det.description||TB||
det.weight);
end...
2. write a SQL procedure called min max that takes department name as input and returns maximum and minimum salary of the department. Test your procedure running following queries: set @dept-"History". # @dept is a MariaDB local variable CALL min_max(@dept,@minv,@maxv) select @dept as department,@minv as minsalary, @maxv as maxsalary:
Write appropriate PL/SQL statements to create a procedure to check that no section has more students than the capacity of the classroom in which the section is scheduled. Display the course_id, sec_id, semester, year, building, and room_number for the sections that have more students than the capacity of the classroom in which the section is scheduled. The following are the tables needed: classroom (building, room_number, capacity) section (course_id, sec_id, semester, year, building, room_number, time_slot_id) takes (student_id, course_id, sec_id, semester, year,...
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....
QUESTION B1. (7 marks) This question assumes the following relational schema Employee (employeeNumber, lastName, firstName, DOB, HireDate, Position Salary, Dept) Primary Key: employeeNumber Foreign key: Dept refers to DeptID in Department Department (DeptID, DeptName, DeptLocation) Primary Key: DeptID You have been given the following MySQL stored procedure: CREATE PROCEDURE Find_EmployeeName (IN employeeNo INT (11), OUT employeeName VARCHAR (60)) BEGIN SELECT concat(firstName, '', lastName) INTO employeeName FROM employees WHERE employeeNumber employeeNo; END (a) (2 marks) Name the two types of parameters...
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....
For Python 3.7+.
TEST THE CODE WITH THE FOLLOWING GLOBAL CODE AFTER
YOU'RE DONE:
print('\nStart of A2 Student class demo ')
s1 = Student('David Miller', major = 'Hist',enrolled = 'y',
credits = 0, qpoints = 0)
s2 = Student('Sonia Fillmore', major = 'Math',enrolled = 'y',
credits = 90, qpoints = 315)
s3 = Student('A. Einstein', major = 'Phys',enrolled = 'y', credits
= 0, qpoints =
0)
s4 = Student('W. A. Mozart', major = 'Mus',enrolled = 'n', credits
= 29, qpoints...
I need help for part B and C
1) Create a new project in NetBeans called Lab6Inheritance. Add a new Java class to the project called Person. 2) The UML class diagram for Person is as follows: Person - name: String - id: int + Person( String name, int id) + getName(): String + getido: int + display(): void 3) Add fields to Person class. 4) Add the constructor and the getters to person class. 5) Add the display() method,...
In this phase of the project you will create an ERD based upon the following requirements and business rules. Limit your ERD to entities and relationships based on the business rules showed here. In other words, do not add realism to your design by expanding or refining the business rules. However, make sure you include all attributes needed that would permit the model to be successfully implemented, including all primary and foreign keys. 1. Trinity College (TC) is divided into...
Question 1.Write a SQL statement for each of the following
questions based on the above tables (50 Points).
1) Create “Enrollment” table.
2) Change the credits of “Database” course from 2 to 3.
3) List the course titles (not Course_No) and grades John Doe
had taken.
4) Calculate average of Café Balance, and name new field as
Average Balance.
5) Create a roster for “Database” course (list student ID, last
name, first name, major, and status for each student enrolled...