Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask DBMS Expert


Home >> DBMS

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.

DBMS, Programming

  • Category:- DBMS
  • Reference No.:- M91535285
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in DBMS

Sql assignmentin these exercises youll enter and run your

SQL Assignment In these exercises, you'll enter and run your own SELECT statements. You will use the MyGuitarShop database for these queries. If you do not already have the MyGuitarShop database, the SQL script and the i ...

Relational database design a given the following business

Relational Database Design A) Given the following business rules, identify entity types, attributes (at least two attributes for each entity, including the primary key) and relationships, and then draw an Entity-Relation ...

Sqlwrite a select statement that returns one column from

SQL Write a SELECT statement that returns one column from the Vendor table named Full Name. Create this column from the VendorContactFName and VendorContactLName columns. Format it as follows: last name, comma, first nam ...

A taking an unnormalised list describe how you would

(a) Taking an unnormalised list, describe how you would normalise it using the normal forms technique and show how the result of this method is used. (b) You are currently in the process of developing a RDBMS for a natio ...

Database design and development assignment -assessment task

Database Design and Development Assignment - Assessment task - 1. Normalization a) Map the ERD, from the sample solution, into a set of relations in at least Third Normal Form (3NF). You must ensure that your relations m ...

Question as explained throughout this course entity

Question: As explained throughout this course, entity relationship modeling is a critical element of database design. If the database is not properly modeled, it is unlikely that the database will be properly developed. ...

Answer the following question explain the difference

Answer the following Question : Explain the difference between a database management system (DBMS) and a database. Are Microsoft Access, SQL Server, and Oracle examples of databases or database management systems (DBMS)?

Analytic reportpurpose the purpose of this task is to

Analytic Report: Purpose: The purpose of this task is to provide students with practical experience in working in teams to write a Data Analytical report to provide useful insights, pattern and trends in the chosen/given ...

Questionsuppose a prolog database exists that gives

Question: Suppose a Prolog database exists that gives information about states and capital cities. Some cities are big, others small. Some states are eastern, others are western. a. Write a query to find all the small ca ...

In this section the student is required to develop a

In this section, the student is required to develop a technical debate based on his/her understanding using available scientific literature. The answer to this question should not exceed three A4 Pages. In the traditiona ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As