Create a pl-sql procedure - print out names of employees

Assignment Help Database Management System
Reference no: EM13870163

Suppose you have created tables in assignment 1 as follows

Tables:
Company(cid, cname, city, state) /* city is the company's location, cname is company name */
Employee(eid, ename, street, city, state, salary, cid) /* city is where the employee lives*/
Manages(eid, mid) /* mid is manager's ID*/

Sol:

drop table manages;
drop table employee;
drop table company;

create table company(
cid integer,
cname varchar(30),
city varchar(30),
state varchar(20),
primary key (cid));

create table employee(
eid integer,
ename varchar(30),
street varchar(30),
city varchar(30),
state varchar(20),
salary number,
cid integer,
primary key (eid),
foreign key (cid) references company(cid));

create table manages(eid integer,
mid integer,
primary key(eid,mid),
foreign key(eid) references employee(eid),
foreign key(mid) references employee(eid));

--- assume the following rows been inserted
insert into company values(1, 'First Bank Corp', 'baltimore', 'MD');
insert into company values(2, 'Verizon', 'DC', 'DC');

insert into employee values(1, 'alice','123 street', 'baltimore', 'MD',55000,1);
insert into employee values(2, 'bob','23 street', 'DC', 'DC',80000,1);
insert into employee values(3,'jeff','33 street', 'DC','DC',60000,2);
insert into employee values(4,'susan','33 street', 'DC','DC',80000,2);
insert into employee values(5,'eric','1 street', 'DC', 'DC',90000,2);
insert into employee values(6,'andy','2 street', 'baltimore', 'MD',70000,2);

insert into manages values(2,1);
insert into manages values(3,4);
insert into manages values(4,5);
insert into manages values(6,4);

Please write PL/SQL program for the following problems.

Problem 1: Please create a PL/SQL procedure that given a company name, print out names of employees working at that company. Test your procedure with a company name you have in your company table.

Problem 2: Please create a PL/SQL function get_manager that returns the manager's mid given the name of an employee. If an employee does not have a manger, return a null value. Please write an anonymous PL/SQL program to call this function with some employee name as input, and print out the results. You can assume that each employee has at most one manager.

Reference no: EM13870163

Questions Cloud

Please find this differential equation : y''-y'-2y=sin2x+2eˆ-x     y=? please find this differential equation
Calculating value of revenue by using formula : Define Header files.  Define test()function.Declare revenue() function.Declare predict() function.Declare roundMoney() function.
Determine whether the following series converge or diverge : Determine whether the following series converge or diverge
Create a t account for the allowance for doubtful accounts : Create a T-account for the Allowance for Doubtful Accounts and enter into it the amounts from the above schedule. Then write the T-account in equation format to prove that the above items account for the changes in the account. Record summary journal..
Create a pl-sql procedure - print out names of employees : Create a PL-SQL procedure that a company name, print out names of employees working at that company. Test your procedure with a company name you have in your company table.
Could you sit in a restaurant and eat by yourself : Can you be alone? Be honest! How long could you go without your phone, TV, the Internet, music, or even a book or magazine before you start to crawl out of your skin? Could you sit in a restaurant and eat by yourself
What is the mimimum expected payment government must make : Suppose the government seeks to find the best it can do (in terms of minimizing expected costs in a dominant strategy mechanism). What is the mimimum expected payment the government must make?
Explain your opinion on behaviorist treatment : After watching the video and reading this week's selections, indicate one specific area in the practice of psychology where behaviorist treatment is valid.
What is the psychological immune system : According to Dan Gilbert, what is Synthetic Happiness? What is the Psychological Immune System? How can it help us to deal with our Barriers? Summarize what Dan Gilbert is trying to prove

Reviews

Write a Review

Database Management System Questions & Answers

  Systems administrator for your school

Using the Web, identify the chief information officer, chief information security officer, and systems administrator for your school. Which of these individuals represents the data owner? Data custodian

  Use sql to create database

Use SQL to create the following database; to including referential integrity. You may NOT use the GUI for this part of the exercise. COURSE ( CourseNu, CourseName, CreditHrs).

  What are the data entities of this enterprise

Consider a student club or organization in which you are a member. What are the data entities of this enterprise? List and define each entity

  Drawing a diagram of the data structures

Drawing a diagram of the data structures will help you figure out what you are deallocating as you write your dictionary_free function. This should help you avoid memory leaks.

  Explain data for each candidate of eight constituencies

supplies % of votes each candidate is likely to receive, based on popularity rating. Actual number of votes received is that percentage of General votes. You should enter data for each candidate in each of the eight constituencies.

  Draw an entity relationship diagram

Draw an entity relationship diagram (ERD) for the following situation: A company has a number of employees. Each employee is identified by an Employee_Id. The company wants to store Employee_Name, Employee_Address, and Employee_BirthDate in the d..

  Identify the potential sale and department store transaction

Evaluate whether the use of a distributed DBMS structure is appropriate and identify the optimization techniques that should be factored in to enhance the operations of the database in your design.

  How many different orders are possible

How many different orders are possible if a customer can order at most one hamburger, one fish sandwich, and one beverage but can order less?

  Display the students for each class in the main form

Create a new custom form that contains a subform, the main from will contain the classes and the subform will contain the students , when the user navigate the classes from the main form, the subform will display the students for each class in the..

  Create an erd for this video store case

Create an ERD for this video store case. Turn in an ERD with appropriate relationship sentences. You can use drawing tools in MS Word or MS Visio to create your ERD. Make sure your relationship sentences are consistent with your relationship in yo..

  Estimate the height of the b plus tree

Estimate the height of the B+ tree. (Giving a range of heights is fine.) Also estimate the amount of memory needed to store the tree, including leaves but not including the posting lists themselves.

  Draw an er diagram for database scenario

Draw an ER diagram for database scenario. Design a set of 3NF tables for your database scenario.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd