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

  Create a simple query for each table that returns

Create a simple query for each table that returns all of the columns and all of the rows for each table. Write a query that displays each part that has been purchased by Huffman Trucking Company

  Problem 1- customers with certain list patternsnbspproblem

problem 1- customers with certain list patternsnbspproblem descriptionnbsp you are provided with four tables in

  Object approach improve the systems development process

How is the object approach different from the data and process approaches to systems development? And how can the object approach improve the systems development process

  How could those redundancies lead to anomalies

What problem would you encounter if you wanted to produce a listing by city? How would you solve this problem by altering the file structure?

  Convenient database system

In short, there is a need for a more convenient database system. The machine on which the database is currently running is powerful enough to host the database server. The database should be accessible from four checkout stations that process rent..

  Implement a database based on the provided er diagram

Analyse and comprehend a provided ER diagram and Database Schema - To implement a database based on the provided ER diagram and Database Schema.

  Converting from an erd to a table design

Converting from an ERD to a table design. Computer-aided software engineering applications that help improve the productivity of information systems professional working on large projects.

  Difference a database administrator and a database architect

Describe the differences between a database administrator and a database architect. How is your organization structured to handle the functions of these roles

  Write down subquery to sort result in descending order

Write down your subquery MAX_CALC_SAL. Name columns in result JOB_TITLE and JOB_TOTAL, and sort result on JOB_TOTAL in descending order.

  List and explain the defined business rules

The Relational Data Model (RDM) which corresponds to the ERD in the format shown below. The RDMMUSTidentify all primary keys, alternate keys and foreign key constraints. Raw SQL Create Table script dumps from a modeling tool, or SQL Server WILL NO..

  Erp systems based on size

ERP systems or Enterprise Resource Planning consists of many processes working in unison to aid the business in function and profitability. The system is designed to streamline processes and information for the entire company it is being utilized ..

  Create a gantt chart illustrating the project tasks

Write clearly and concisely about Systems Analysis and Development topics using proper writing mechanics and technical style conventions.

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