Question

In: Computer Science

List department name, employee id, and employee name for all employees in department name order. Repeat...

  1. List department name, employee id, and employee name for all employees in department name order.
  2. Repeat for department #10 only.
  3. List the course ID, course name, section, instructor name, day, time, and room for all course sections.
  4. List the course ID, course name, section, student ID, and student name for CRN 1003. Display the list in ascending order of student last and first names.

DROP TABLE registration;
DROP TABLE sections;
DROP TABLE courses;
DROP TABLE students;
DROP TABLE instructors;


CREATE TABLE courses (
   cid varchar2(9) NOT NULL,
   cname varchar2(50) NOT NULL,
   credits number(1) DEFAULT 3,
   prereq varchar2(9),
   CONSTRAINT pk_courses PRIMARY KEY (cid)
);

INSERT INTO courses VALUES ('IS 201','Java Programming',3,null);
INSERT INTO courses VALUES ('IS 202','C++ Programming',3,'IS 201');
INSERT INTO courses VALUES ('IS 301','Web Design',3,null);
INSERT INTO courses VALUES ('IS 331','Business Applications',3,null);
INSERT INTO courses VALUES ('IS 401','Database Design',3,'IS 331');
INSERT INTO courses VALUES ('IS 413','SQL Programming',3,'IS 401');


CREATE TABLE students (
   sid char(9) NOT NULL,
   lname varchar(30) NOT NULL ,
   fname varchar2(30) NOT NULL ,
   gender char(1) NOT NULL ,
   addr varchar2(50) NOT NULL ,
   city varchar2(20) NOT NULL ,
   state char(2) NOT NULL ,
   zip varchar2(10) NOT NULL ,
   phone varchar2(14) NULL ,
   birthdate date NULL ,
   tuitionRate number(7, 2) NOT NULL ,
   creditsEarned number(3) NOT NULL ,
   CONSTRAINT pk_students PRIMARY KEY (sid)
);

INSERT INTO students VALUES ('100000001','Lee','George','M','15 Merchant Street','Honolulu','HI','96818','808-524-3333','01-MAY-1965',5000.00,47);
INSERT INTO students VALUES ('100000002','Yamamoto','Bill','M','3432 Birch Street','Honolulu','HI','96814','808-522-2212','03-JUN-1958',5000.00,12);
INSERT INTO students VALUES ('100000003','Carver','Hillary','F','22 Aardvark Avenue','Washington','DC','10101','800-212-3246','23-AUG-1991',5000.00,69);
INSERT INTO students VALUES ('100000004','King','Linda','F','341 Kaapahu Road','Paauilo','HI','96776',NULL,'01-SEP-1998',4399.00,6);
INSERT INTO students VALUES ('100000005','Rollings','Willie','M','1221 Ala Moana Blvd','Honolulu','HI','96814',NULL,NULL,4888.00,0);
INSERT INTO students VALUES ('100000006','Alexander','Wanda','F','93-123 Old Mill Road','Honokaa','HI','96727','808-776-2313','02-OCT-1997',5000.00,99);
INSERT INTO students VALUES ('100000007','Carver','Bill','M','33 Richards Street','Honolulu','HI','96813',NULL,'22-OCT-1990',5000.00,0);
INSERT INTO students VALUES ('100000008','DeLuz','Bob','M','102 Orleans Ave','San Francisco','CA','97745','808-555-3324','01-MAR-1998',5000.00,14);
INSERT INTO students VALUES ('100000009','Lee','Lisa','F','45 Fong Avenue','San Francisco','CA','97767','808-333-3432','21-APR-1997',5000.00,26);
INSERT INTO students VALUES ('100000010','Garcia','Sherrie','F','2 S. Beretania','Honolulu','HI','96817','808-663-4453','03-DEC-1997',5000.00,29);
INSERT INTO students VALUES ('100000011','Kamaka','Oscar','M','34 Kapolani Blvd','Honolulu','HI','96813','808-533-3332','12-FEB-1998',5000.00,0);

CREATE TABLE instructors (
   inId char(9) NOT NULL,
   iLname varchar2(30) NOT NULL,
   iFname varchar2(30) NOT NULL,
   rank varchar2(10) NOT NULL,
   office varchar2(10) NULL,
   phone varchar2(20) NULL,
   salary number(8,2) DEFAULT 0,
   CONSTRAINT pk_instructors PRIMARY KEY (inID)
);

INSERT INTO instructors VALUES ('200000001','Souza','Edward','Lecturer','LM101','808-533-4241',5000.00);
INSERT INTO instructors VALUES ('200000002','Tenzer','Laurie','Associate','LM102','808-533-4244',5000.00);
INSERT INTO instructors VALUES ('200000003','Otake','Bill','Assistant','MR101','808-533-4247',5800.00);

CREATE TABLE sections (
   crn char(4) NOT NULL,
   cid varchar2(9) NOT NULL,
   section char DEFAULT 'A',
   inId char(9) NOT NULL,
   days varchar2(10) DEFAULT 'TBA',
   time varchar2(16) DEFAULT 'TBA',
   room varchar2(10) NULL,
   CONSTRAINT pk_sections PRIMARY KEY (crn),
   CONSTRAINT fk_inid_sections FOREIGN KEY (inid) REFERENCES instructors(inid),
   CONSTRAINT fk_cid_sections FOREIGN KEY (cid) REFERENCES courses(cid)
);

INSERT INTO sections VALUES ('1000','IS 201','A','200000003','MWF','08:00 - 08:50','CL100');
INSERT INTO sections VALUES ('1001','IS 201','B','200000003','MWF','09:00 - 09:50','CL100');
INSERT INTO sections VALUES ('1002','IS 201','C','200000001','TTh','08:00 - 09:15','CL102');
INSERT INTO sections VALUES ('1003','IS 301','A','200000002','TTh','09:30 - 10:45','CL340');
INSERT INTO sections VALUES ('1004','IS 301','B','200000002','MWF','09:00 - 09:50','CL340');
INSERT INTO sections VALUES ('1005','IS 413','A','200000001','MWF','09:00 - 09:50','CL230');


CREATE TABLE registration (
   crn char(4) NOT NULL,
   sid char(9) NOT NULL,
   CONSTRAINT pk_registration PRIMARY KEY (crn,sid),
   CONSTRAINT fk_crn_registration FOREIGN KEY (crn) references sections(crn),
   CONSTRAINT fk_sid_registration FOREIGN KEY (sid) references students(sid)
);

INSERT INTO registration VALUES ('1000','100000001');
INSERT INTO registration VALUES ('1003','100000001');
INSERT INTO registration VALUES ('1005','100000001');
INSERT INTO registration VALUES ('1001','100000002');
INSERT INTO registration VALUES ('1004','100000002');
INSERT INTO registration VALUES ('1005','100000003');
INSERT INTO registration VALUES ('1002','100000004');
INSERT INTO registration VALUES ('1003','100000004');
INSERT INTO registration VALUES ('1005','100000004');
INSERT INTO registration VALUES ('1000','100000005');
INSERT INTO registration VALUES ('1003','100000005');
INSERT INTO registration VALUES ('1002','100000008');
INSERT INTO registration VALUES ('1004','100000008');
INSERT INTO registration VALUES ('1002','100000009');
INSERT INTO registration VALUES ('1005','100000009');
INSERT INTO registration VALUES ('1002','100000010');
INSERT INTO registration VALUES ('1005','100000010');
INSERT INTO registration VALUES ('1000','100000011');
INSERT INTO registration VALUES ('1003','100000011');
INSERT INTO registration VALUES ('1005','100000011');
commit;

Solutions

Expert Solution

for the ist query i think you have missed copying one table

There is no such data like department name, employee name, employee_ID

if you mean instructor as an employee i have written the query. If not upload the table again

query 3

SELECT courses.cid, courses.cname,sections.section, instructors.iLname, instructors.iFname,sections.days,sections.time, sections.room from sections join courses on sections.cid= courses.cid join instructors on sections.inid= instructors.inid

query 4

SELECT courses.cid, courses.cname,sections.section,students.sid, students.lname, students.fname ,registration.crn from registration join sections on registration.crn= sections.crn join courses on sections.cid= courses.cid join students on registration.sid = students.sid where registration.crn ='1003' order by students.lname, students.fname asc

query 1

SELECT inid,iLname, iFname, office from instructors order by office asc

----------------------------------------------------------------------------------------------------------------------------------------------------------------------

please find the attachment for the output


Related Solutions

Develop an algorithm to implement an employee list with employee ID ,name designation and department using...
Develop an algorithm to implement an employee list with employee ID ,name designation and department using link list and perform the following operation on the list i)add employee details based on department ii)remove employee details iv)count the number of employee in each department
Employee ID First Name Last Name email Title Address Extension Department Department ID Hiring Date Department...
Employee ID First Name Last Name email Title Address Extension Department Department ID Hiring Date Department Phone # 0001 John Smith jsmith Accountant 1300 West st 5775 Accounting 2100 8/1998 407-366-5700 0002 Brian Miller badams Admin Assistant 1552 Palm dr 5367 Human resource 2300 4/1995 407-366-5300 0003 James Miller miller Inventory Manager 2713 Buck rd 5432 Production 2520 8/1998 407-366-5400 0004 John Jackson jackson_sam Sales Person 433 tree dr 5568 Sales 2102 6/1997 407-366-5500 0005 Robert Davis Davis Manager 713...
Write a program of doubly Circular linked list to maintain records of employees. Take employee ID,...
Write a program of doubly Circular linked list to maintain records of employees. Take employee ID, name and salary as data of each employee. Search a particular record on ID and display the previous and next records as well. Whichever ID it give, it should display all the records because of being circular. Code needed in Java.
The system will accept the employee ID, the employee name and his/her gross salary.
The system will accept the employee ID, the employee name and his/her gross salary.Based on the gross salary provided, if it is equal to or greater than OMR 2500, the system should apply a tax rate of 6% when calculating the income tax otherwise a tax rate of 4% should be applied when calculating.calculate the income tax and the net salary,If (gross salary > = 2500)          Tax rate = 6%Else     Tax rate = 4%Income tax = Net salary = 
implementing linked list using c++ Develop an algorithm to implement an employee list with employee ID,...
implementing linked list using c++ Develop an algorithm to implement an employee list with employee ID, name, designation and department using linked list and perform the following operations on the list. Add employee details based on department Remove employee details based on ID if found, otherwise display appropriate message Display employee details Count the number of employees in each department
The overseeing surveyor did not advise the HR department when an employee resigned. All employees are...
The overseeing surveyor did not advise the HR department when an employee resigned. All employees are paid by direct credit to their bank accounts unless any variations are notified to the HR department. In this particular case the employee’s salary continued to be paid into her bank account for a further two months. Discuss a control that should have prevented the situation and the audit risk that exists if the situation is not discovered. Investigate and discuss a substantive audit...
You are given a list of all employees. You group the names by department (Logistics, Sales,...
You are given a list of all employees. You group the names by department (Logistics, Sales, IT, Human Resource). Suppose you select all employees in Sales. What type of sampling method did you use to select the employees? Explain your reasoning.
List customer id, customer full name (Last name, full name, state) for those customers that have...
List customer id, customer full name (Last name, full name, state) for those customers that have ordered more than once. List customers (order id, customer id, and customer last name) that had more than 2 -- products in their order. Order your result based on customer id followed by order id SQL SERVER DATABASE
Create a query that shows the last name, employee ID, hours worked, and overtime amount owed...
Create a query that shows the last name, employee ID, hours worked, and overtime amount owed for hourly employees who earned overtime during week 2. Overtime is paid at 1.5 times the normal hourly rate for all hours worked over 40. Note that the amount shown in the query should be just the overtime portion of the wages paid. Also, this is not a totals query- amounts should be shown for individual workers. QBE grid template. This is the exact...
Implement an Employee class that includes data fields to hold the Employee’s ID number, first name,...
Implement an Employee class that includes data fields to hold the Employee’s ID number, first name, last name, and hourly pay rate (use of string datatype is not allowed). Create an array of five Employee objects. Input the data in the employee array. Write a searchById() function, that ask the user to enter an employee id, if its present, your program should display the employee record, if it isn’t there, simply print the message ”Employee with this ID doesn’t exist”....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT