Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask DBMS Expert


Home >> DBMS

Database Problem:

create table student(
sid integer, --- student ID
sname varchar(50), --- student name
primary key (sid));

create table teacher(
tid integer, --- teacher ID
tname varchar(50), ---- teacher name
primary key (tid));

create table class(
cid integer, --- class ID
cname varchar(50),--- class name
year integer, --- year of class
semester varchar(10), -- fall or spring
credit integer, -- number of credit
tid integer, --- teacher id
primary key (cid),
foreign key (tid) references teacher(tid));

create table grades(
sid integer, --- student ID
cid integer, --- product ID
grade integer, --- grade: 4.0:A, 3: B, 2: C, 1:D, 0:F
primary key (sid, cid),
foreign key (sid) references student(sid),
foreign key (cid) references class(cid));

insert into student values (1, 'John');
insert into student values (2, 'Alice');
insert into student values (3, 'Bob');
insert into student values (4, 'Cathy');
insert into student values (5, 'Jeff');

insert into teacher values (1, 'Dr. Chen');
insert into teacher values (2, 'Dr. Smith');

insert into class values(1,'IS 633', 2015, 'fall', 3,1);
insert into class values(2,'IS 633', 2014, 'fall', 3,1);
insert into class values(3,'IS 603', 2015, 'fall', 3,2);
insert into class values(4,'IS 603', 2015, 'spring', 3,2);

insert into grades values(1,1,4);
insert into grades values(2,1,3);
insert into grades values(4,1,2);

insert into grades values(3,2,3);
insert into grades values(5,2,4);

insert into grades values(1,3,4);
insert into grades values(5,3,3);

insert into grades values(2,4,3);
insert into grades values(3,4,2);
insert into grades values(4,4,4);

Problem 1: Please write ONESQL statement to implement each of the following tasks.

Task 1: Return names of classes offered in fall 2015.

Task 2: Return names of classes taught by Dr. Chen in fall 2015.

Task 3:Return the total number of courses offered in spring 2015.

Task 4:Return the number of courses taught by each teacher in the year 2015. Please return tid in the result.

Task 5:Return the tid of teachers who have taught at least 2 courses in 2015.

Task 6: Return the names of students who is taking IS 633 in fall 2015.

Task 7: Return the number of students enrolled in each class. Please include class name, semester, and year in the result.

Task 8: Return the classes with at least 3 students enrolled. Please include name of class, semester, and year in the result.

Problem 2: Please write a PL/SQL program to compute the sum of even numbers 2, 4, 6, 8, ..., 100.

Problem 3: Please write an anonymousPL/SQL program to print out the grade of John in IS 633. Please use implicit cursor and handle exception. You will lose 10 points if you do not use anonymous PL/SQL program. You also cannot hard code student ID and class ID (i.e., your program should work regardless of the rows in the database).

Problem 4:Please write an anonymous PL/SQL program to print out the GPA of John. You will lose 15 points if you do not use anonymous PL/SQL program. You also cannot hard code student ID (i.e., your program should work regardless of the rows in the database).

DBMS, Programming

  • Category:- DBMS
  • Reference No.:- M91519011
  • Price:- $50

Priced at Now at $50, Verified Solution

Have any Question?


Related Questions in DBMS

Suppose that you have designed a database for morgan

Suppose that you have designed a database for Morgan Importing that has the following tables: EMPLOYEE (EmployeeID, LastName, FirstName, Department, Phone, Fax, EmailAddress) STORE (StoreName, City, Country, Phone, Fax, ...

Quesiton 1 what is data-manipulation language dml there are

Quesiton: 1. What is Data-Manipulation Language (DML)? There are four types of access in DML, explain each one. 2. Assume we have a Library Database consists of the following relations: author(author_id, first_name, last ...

Assignment -scenario setup a mock phase 3 clinical trial

Assignment - Scenario: Setup a Mock Phase 3 Clinical Trial for evaluating the efficacy of a Blood Pressure/Weight Loss/ or Muscle Strength Enhancement supplement. Assume that the testing takes place at a physician's offi ...

Question create an erd for the following scenarioa small

Question: Create an ERD for the following scenario. A small company ABC wants a database to keep track of internal company information. Â Given the following information create an ERD. The ABC Company has several departm ...

This assignment is a continuation of this solution the case

This assignment is a continuation of this solution The case study company has received the first report from its enterprise content management (ECM) consultant and now has a documented list of major content requirements ...

Instructionsfor decades relational databases remained

Instructions For decades, relational databases remained essentially unchanged; data was segmented into specific chunks for columns, slots, and repositories, also called structured data. However, in this Internet of Thing ...

In sql developercreate a table userpermissions provide

IN SQL DEVELOPER Create a table UserPermissions (provide create and insert statements code) Document UserName Policy SYSTEM Menu JDOW W2 USAM Permissions SYSTEM W2 JDOW Form 1040 USAM Policy JDOW W2 SYSTEM Write a PL/SQL ...

Backgrounda new training organization called abc

Background A new training organization called ABC TechTraining is opening soon and they have approached you to help design their new database. They have just completed the refurbishment of the premises and are now lookin ...

Question find at least two academic sources that describe

Question: Find at least two academic sources that describe the movement of Enterprise resource planning (ERP) activities to the cloud. Discuss the types of ERP activities that can be conducted in the cloud and the pros a ...

Sqlquery 1 how many products have standard price less than

SQL Query 1. How many products have standard price less than 1000? Query 2: Display all attributes for products made of "Cherry" from Product table w/o referring to column names. Query 3: Display all product names having ...

  • 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