Question

In: Computer Science

You have been given the following specifications for a simple database about the requests for software...

You have been given the following specifications for a simple database about the requests for software that staff members make for their units (note that primary keys are shown underlined, foreign keys in bold). You should run your SQL to demonstrate that it works correctly, and paste in the statements used plus the output from Oracle.

LAB (RoomNo, Capacity)

SOFTWARE (SoftwareID, SoftwareName, Version)

REQUEST (SoftwareID, RoomNo, RequestDate, TeachingPeriod, Progress)

Based on the table specifications provided, answer the following questions.

a. Give the SQL to create the LAB and SOFTWARE tables. Choose appropriate data types. None of the attributes should be allowed to be null. Include the primary key constraints.

b. Give the SQL to create the REQUEST table. Use appropriate data types, and include the primary key and foreign key constraints. Referential integrity should be set such that if a lab is deleted from the database, any requests that exist for that lab are also deleted.

c. Give the SQL to add a record to each of the tables: LAB, SOFTWARE and REQUEST. Make up your own data (you may wish to add lab 350.2.006 to the LAB table for testing in part (e) later).

d. Give the SQL to create a constraint to the REQUEST table to restrict the possible values of Progress to the following 5: Requested, Installed, Function Testing, User Acceptance Testing, and Deployed.

e. Give the SQL to record the fact that the capacity of lab 350.2.006 has increased by 5.

Solutions

Expert Solution

drop table request;
drop table lab;
drop table software;


create table lab
(
    roomNo varchar2(50),
    Capacity int,
    CONSTRAINT lab_pk PRIMARY KEY (roomNo)
);

insert into lab values ('500',50);
insert into lab values ('600',50);
insert into lab values ('700',50);
insert into lab values ('800',50);

create table software
(
    SoftwareId varchar2(50),
    SoftwareName varchar2(50),
    Version varchar2(50),
    CONSTRAINT software_pk PRIMARY KEY (SoftwareId)
);

insert into software values ('1','Oracle','5.2');
insert into software values ('2','SQL Server','5.2.3');
insert into software values ('3','MySQL','5.2.1.2');

create table request
(
    softwareId varchar2(50),
    roomNo varchar2(50),
    RequestDate date,
    TeachingPeriod varchar2(50),
    Progress varchar2(50),
    CONSTRAINT software_fk FOREIGN KEY (SoftwareId) REFERENCES software(SoftwareId),
    CONSTRAINT room_fk FOREIGN KEY (roomNo) REFERENCES lab(roomNo)
);

insert into request values ('1', '500', sysdate ,'102', 'None');
insert into request values ('2', '600', sysdate ,'102', 'None');

select * from lab;
select * from software;
select * from request;


Related Solutions

You have been given the following specifications for a simple database about the requests for software...
You have been given the following specifications for a simple database about the requests for software that staff members make for their units (note that primary keys are shown underlined, foreign keys in bold). You should run your SQL to demonstrate that it works correctly, and paste in the statements used plus the output from Oracle. LAB (RoomNo, Capacity) SOFTWARE (SoftwareID, SoftwareName, Version) REQUEST (SoftwareID, RoomNo, RequestDate, TeachingPeriod, Progress) Based on the table specifications provided, answer the following questions. Each...
University ITS maintains a database about the requests for software that staff members make for their...
University ITS maintains a database about the requests for software that staff members make for their units before each teaching period (e.g. Semester 1, Semester 2). A unit may need several items of software, installed in multiple labs. Labs are housed across the various buildings of the university, with each lab having a unique room number (e.g. Lab 245.3.062 is located in building number 245, name Science & Computing). Each piece of software is requested individually for a lab and...
You are asked to design a relational database for a simple course registration software application for...
You are asked to design a relational database for a simple course registration software application for your school. The relational database must have the following information about the student, the course, and the registration, respectively StudentID, FirstName, LastName, DataOfJoining, and Major CourseNumber, CourseName,InstructorName, StartDate, EndDate, NumberOfCredits ReferenceID, StudentID,CourseID, DateOfRegistration Apply the following constrains while designing the database Each student in the database must be uniquely identifiable Each course listed in the database must be have unique CourseNumber Each course registration...
Metal Holdings Inc. You have been assigned the task of creating a simple relational database using...
Metal Holdings Inc. You have been assigned the task of creating a simple relational database using SQLite database by the owner of “Metal Holdings” who is in the business of selling industrial metals to customers (mostly wholesale suppliers) who buy from the company. Your goal is to design and build a database that would be responsible for: Managing a product table containing all metals which at a minimum should provide information such as name, description and price of each metal...
You have been given the following information about a motel for the coming year:                             &
You have been given the following information about a motel for the coming year:                                                   (A)            Occupancy Forecast         75% (B)            Rooms department variable cost per occupied room is estimated to be     $7.75                                        (C)            Owners' investment          $800,000 (D)            Desired after tax yield on owners' investment        15% (E)             Current income tax rate                  30% (F)             The motels fixed costs for the coming year were anticipated to be                 825,000                                   (G)            The motel has this many rooms available to rent     100...
You have been hired as a research assistant and are given the following data about another...
You have been hired as a research assistant and are given the following data about another economy Corporate income tax $20000 Profits $44000 Rent $25000 Indirect business taxes $21000 Business profits $75000 Plant and equipment   $2,400 Net foreign factor imports $-5,900 Interest $22,185 Social security contribution $65,000 Transfer payments $80,000 Wages $900    Personal taxes $175 Calculate the GDP using the factor payment approach. Show work. ___________________  
You have been given the following information about the production of Usher Co. and are asked...
You have been given the following information about the production of Usher Co. and are asked to provide the plant manager with information for a meeting with the vice president of operations. Standard Cost Card Direct materials (5 pounds at $4 per pound) $20.00 Direct Labor (0.8 hours at $10) 8.00 Variable Overhead (0.8 hours at $3 per hour) 2.40 Fixed Overhead (0.8 hours at $7 per hour) 5.60 $36.00 The following is a variance report for the most recent...
Split the main function given into multiple functions. You have been given a very simple program...
Split the main function given into multiple functions. You have been given a very simple program that performs basic operations (addition, subtraction, editing) on two randomly generated integer vectors. All functionality has been included in main, causing code segments to be repeated as well as diminishing the readability. Rewrite the program by grouping calculations and related operations into functions. In particular, your program should include the following functions. InitializeVectors: This is a void function that initializes the two vectors by...
You have been given the following per unit information about the production of Gillian Inc., and...
You have been given the following per unit information about the production of Gillian Inc., and are asked to provide the plant manager with information for a meeting with the vice-president of operations: Standard Quantity Standard Price Actual Quantity Actual Price Direct materials 5 kg $3 / kg 5.5 kg $2.80 / kg Direct labour 1.5 hours $18 / hour 1.0 hours $16 / hour Production data, both budgeted and actual, for the year are as follows: Description Amount Actual...
Design a simple database to track people and who they voted for. The database should have...
Design a simple database to track people and who they voted for. The database should have 3 tables: A table of candidates A table of registered voters A table of votes The candidate table should provide a listing of all candidates and information about the candidates. The registered voter table should hold all registered voters and any pertinent information about them The vote table should hold vote records for each candidate made by the voters Requirements: The system should not...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT