Question: Create both the tables Branch and Supervisor with appropriate attribute names, primary key, foreign key and data type. Insert the above records into Branch and

  1. Create both the tables Branch and Supervisor with appropriate attribute names, primary key, foreign key and data type.
  2. Insert the above records into Branch and Supervisor tables.
  3. Display all the records from Branch and Supervisor (Separately)
  4. Display all the details of Name, City and Salary.
  5. Display the total salary for every city in the supervisor table.
  6. Write a PL/SQL program to display BName from the Branch table for D5.
  7. Write a PL/SQL program to display all the details of Supervisor who is getting more than 1250 salary using cursor.
  8. Update city as Suhar for Supervisor named Jack.
  9. Write a Procedure to receive a Supervisor SId as Input and display all the related values of that Supervisor. (Also write the calling program.)
  1. Delete all the branch details of operations.

----------------------------------------------------------------------------------------------------------------------------

/* Creating tables */ create table Supervisor(Sid int, Name char(10), city char(10), salary int, primary key(Sid)); create table Branch(Bid varchar(2), Bname char(15), Sid int, primary key(Bid), foreign key(Sid) references Supervisor(Sid));

/* Inserting data into tables */ insert into Supervisor values(1234,"Jone","Muscat",2340); insert into Supervisor values(1345,"Ann","Muscat",1200); insert into Supervisor values(1567,"Mary","Dubai",1345); insert into Supervisor values(1655,"Viba","Dubai",1290); insert into Supervisor values(1733,"Jack","Abudhabi",1360);

insert into Branch values("D1","Operations",1234); insert into Branch values("D2","Engg",1345); insert into Branch values("D3","Operations",1567); insert into Branch values("D4","Computer",1234); insert into Branch values("D5","Operations",1733);

/* Query1: Display all records */ select * from Supervisor; select * from Branch;

/* Query2: details of name,city and salary */ select Name,city,salary from Supervisor;

/* Query3: total salary for every city */ select city,sum(salary) as SumOfSalary from Supervisor group by city;

/* Query4: update city as 'suhar' for supervisor named jack */ update Supervisor set city = "suhar" where Name = "Jack";

/* Query5: Delete branch details of operations */ delete from Branch where Bname = "Operations";

Note: As per chegg guidelines i have to answer only 4 subquestions. But i have answered more than that for you. Please kindly post remaining 3 subquestions along with the tables.

-------------------------------------------------------------------------------------------------------------------------------------------------

I want the answer or the Q6 to Q10 -----------------------------------------------------------------------------------------------------------------------------------------------------

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!