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
- 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 Supervisor tables.
- Display all the records from Branch and Supervisor (Separately)
- Display all the details of Name, City and Salary.
- Display the total salary for every city in the supervisor table.
- Write a PL/SQL program to display BName from the Branch table for D5.
- Write a PL/SQL program to display all the details of Supervisor who is getting more than 1250 salary using cursor.
- Update city as Suhar for Supervisor named Jack.
- Write a Procedure to receive a Supervisor SId as Input and display all the related values of that Supervisor. (Also write the calling program.)
- 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
Get step-by-step solutions from verified subject matter experts
