This action might not be possible to undo. Are you sure you want to continue?
COSC 3480 Lab1
Lab. #1 (Total score: 90, Due date: 9/23/02 (Tuesday))
BestRental is a car rental company that has over 3,000 employees and many outlets. The company owns variety of vehicles in different outlets. The company maintains the vehicles in best condition by checking vehicles regularly. Mechanics check each vehicle as soon as it is returned and write a fault report. The relational schemas for the BestRental database is illustrated as follows: Outlet Attribute clientNo clientName clientStreet clientCity clientState clientZipCode clientTelNo contactName contactEmail Type number(8) varchar2(50) varchar2(40) varchar2(15) varchar2(15) varchar2(9) varchar2(20) varchar2(50) varchar2(100) Constraint pk not null and unique not null AttributeType Constraint outletNo number(8) pk outletStreet varchar2(40) not null outletCity varchar2(15) not null outletState varchar2(15) outletZipCode varchar2(9) outletTelNo varchar2(20) not null and unique managerEmployeeNo number(8) fk
Vehicle AttributeType EmployeeNo Title firstName lastName address homeTelNo ssn DOB Gender Salary DateStarted OutletNo Constraint number(8) pk varchar2(10) not null varchar2(30) not null varchar2(30) not null varchar2(100) varchar2(20) char(12) not null and unique date char M or F number(8,2) not null date not null number(8) fk AttributeType VehLicenseNo VehicleMake VehicleModel Color NumDoors Capacity HireRate OutletNo Constraint varchar2(10) varchar2(15) varchar2(15) varchar2(15) number(1) number(4) number(6,2) number(8) pk not null not null not null >0 and <20 >0 and < $500 fk and not null
RentalAgreement AttributeType Constraint rentalNo number(8) pk dateStart date not null timeStart number(4,2) not null dateReturn date timeReturn number(4,2) mileageBefore number(8) mileageAfter number(8) policyNo number(15) unique and not null insuranceCoverType varchar(10) insurancePremium number(5,2)
FaultReport AttributeType VehicleNo DateChecked TimeChecked Comments EmployeeNo Constraint varchar2(10) pk and fk date pk number(4,2) not null varchar2(50) not null number(8) fk and not null
Note that pk represents a primary key and fk represents a foreign key. Remember that there should be only one primary key but there may be more than one foreign key in a table.
 Remove the not null constraint for Title column in Employee table. make sure you keep all the commands in a file (e. If you do.. fix the error for the program in the Text editor and try it again. Useful Tips for the Labs. Copy and Past your program from the Text editor to SQL*Plus command line. Answer/perform the following questions/tasks: (a) (b) (c) (d) (e) (f) (g) (h) (i) (j) (k) (l) (m) What is the SPOOL command for? Briefly explain it and give an example.  Display all the constraint names AND types for Outlet tables using the SELECT command.  Change the type of “clientZipCode” in Client table to CHAR(9) using the ALTER command.. >0 and <10 for the Capacity column in Vehicle table using the ALTER command.  Add the domain constraint. You can also save the result of your commands using SPOOL command. responses from Oracle) of the commands.  Show an example of DELETE command.  List all the table names you created so far using the SELECT command. VehicleYear to Vehicle table using the ALTER command. DO NOT include the practice commands with errors.. Altering Tables. we will only obtain partial credit for your solution.g. Loading Data COSC 3480 Lab1 In this Lab.g.Creating. 2 .[6x5=30] Show an example of UPDATE command. [6x5=30] Change the salary column type in Employee table to NUMBER(9. Make sure that your insertions do not violate “common sense”. Otherwise. (n) Drop all the tables for the BestRental database.  Add a new column. throughout this course Prepare your program (SQL) using the Text editor such as Note Pad. If the program works.  Load all the tables for the BestRental database with at least one record for each table using the INSERT command.2) using the ALTER command. you will implement the relational database for BestRental based on the given schemas.  If you finished all the above exercises. a script file) before you lose them. Make sure you implement all the necessary integrity constraints for the database.  You need to turn in: • The printed copy of Oracle commands and results (e.  What is the HOST command for? Briefly explain it and give an example. Save your text file regularly before you lose what you have typed. save the program.  Create all the tables based on the given schemas for BestRental database and display the structure of each table after you created it using Oracle SQL*Plus.