Write a pl/sql program to compute the sum of even number

Assignment Help Database Management System
Reference no: EM13858246

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).

Reference no: EM13858246

Questions Cloud

What were the benefits of this study : How did the author overcome the limitations of doing a qualitative study? What were the benefits of this study
Are international negotiators considered strategic suppliers : Are international negotiators considered strategic suppliers? How do we drive the suppliers to be aligned with your requirements?
Do our children miss anything when they don attend schools : What was your experience when in elementary and middle/high school--did you experience cultural and racial diversity, or a school that was primarily one culture/race? Do our children miss anything when they don't attend culturally diverse schools
Benefits of creating web presence for a small business : What are some of the benefits of creating web presence for a small business, including marketing and increased customer base?
Write a pl/sql program to compute the sum of even number : Write an anonymous PL/SQL program to print out the GPA of John - write a PL/SQL program to compute the sum of even number
What are the primary assumptions each author makes : What is the main point-of-view in each article? What are the primary assumptions each author makes? Which author are you inclined to agree with? Support your choice with scholarly reasoning and cite your evidence
Explain the difference between a policy and a procedure : In your discussion post, Explain the difference between a policy and a procedure. Provide two to three examples of each. Outline one to two ideas for implementing or enforcing policies and procedures
Calculate the log mean temperature difference : Determine the required hydrostatic test pressure according to AS 1210 Clause 5.10.2.1 and compare it to the actual test pressure carried out
Ethical system well inside the boundaries of what is legal : We all need to be ethical in our dealings with others, and often practical ethics means avoiding even the appearance of wrongdoing. It is important to understand the legal limits on behavior, so that we can set our own ethical system well inside ..

Reviews

Write a Review

Database Management System Questions & Answers

  Variation of activity-based costing

Product cost of product U86Y under the company's traditional costing system is closest to - product cost of product M91F under the activity-based costing system

  Produce a distributed data design for enterprise

Produce a distributed data design for this enterprise. Show data fragmentation/partitioning and replication for each regional database location. Indicate what attributes are in each fragment

  Create a database schema that supports the companys business

Create a database schema that supports the company's business and processes. Explain and support the database schema with relevant arguments that support the rationale for the structure.

  Verify the values inserted by using a query

Write INSERT statements for adding the following data to the new table: Verify the values inserted by using a query. Display each distinct agency (each agency only once)

  Relational algebra expressions for names of salespeople

Illustrate relational algebra expressions for names of all salespeople, names of all salespeople having ORDER row and names of salespeople not having ORDER row.

  Consider the er diagram that you designed

Consider the ER diagram that you designed for the Prescriptions-R-X chain of pharmacies in Exercise 2.7. De?ne relations corresponding to the entity sets and relationship sets in your design using SQL.

  Describe the benefits and current trends of data

write a six to eight 6-8 page paper in which youquestion 1. provide an executive overview that addresses the

  If those were for me wed keep them all in two to three

if those were for me wed keep them all in two to three minutes longer he says. but thats not my call-its the

  Create a database with at least one table with ms acces

Create a database with at least one table with MS Access. Add drop-down lists (combo boxes), validation rules, and input masks as required.

  Explain how data is physically stored and accessed

Write clearly and concisely about relational database management systems using proper writing mechanics and technical style conventions.

  Write a select statement that answers this question

Write a SELECT statement that returns these columns - Write a SELECT statement that answers this question: Which customers have ordered more that one product? Return columns:

  Explain the value of utilizing the entity relationship model

Explain the value of utilizing the entity relationship model (ER Model) and the entity relationship diagram (ERD) for relational databases. Is this an advantage or disadvantage. Why

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