DOC PREVIEW
UH COSC 3480 - COSC 3480 Lab. #1

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

PetOwnerClinicStaffAttribute Type ConstraintAttribute Type ConstraintAttribute Type ConstraintPetExaminationAttribute Type ConstraintAttribute Type ConstraintTreatmentAttribute Type ConstraintPenAttribute Type ConstraintPetPenPetTreatmentAttribute Type ConstraintAttribute Type ConstraintPharmacyItemAttribute Type ConstraintItemClinicStockAttribute Type ConstraintAttribute Type ConstraintInvoicePharmClinicStockAttribute Type ConstraintAttribute Type ConstraintAppointmentAttribute Type ConstraintLab. #1 (Total score: 90, Due date: Feb. 7, 2006)You need to turn in:Creating, Altering Tables, Loading Data Oracle Lab #1Lab. #1 (Total score: 90, Due date: Feb. 7, 2006)PerfectPets is a practice that provides private health care for domestic pets throughout America. This service isprovided through various clinics located in the main cities of America. The Director of Perfect Pets is concerned thatthere is a lack of communication within the practice and particularly in the sharing of information and resources acrossthe various clinics. To resolve this problem the Director has requested the creation of a centralized database system toassist in the more effective and efficient running of the practice. The relational schemas for the PerfectPets database isillustrated as follows:1AppointmentInvoicePetPenPetTreatmentAttribute Type ConstraintclinicNo char(5) pkstreet varchar2(40) city varchar2(15)state char(2)zipcode varchar2(9)telNo varchar2(20) not null, uniquefaxNo varchar2(20)mgrStaffNo char(4) fk(Staff)Attribute Type ConstraintstaffNo char(4) pksFName varchar2(30) not nullsLName varchar2(30) not nullsStreet varchar2(40)sCity varchar2(15)sState char(2)sZipCode varchar2(9)sTelNo varchar2(20) not nullDOB dategender charssn char(12) not null, uniqueposition varchar2(20) not nullsalary number >0clinicNo char(5) fk(Clinic), not nullClinic Staff PetOwnerAttribute Type ConstraintownerNo char(5) pkoFName varchar2(30) not nulloLName varchar2(30) not nulloStreet varchar2(40)oCity varchar2(15)oState char(2)oZipCode varchar2(9)oTelNo varchar2(20) not nullclinicNo char(5) fk(Clinic)PetAttribute Type ConstraintpetNo char(6) pkpetName varchar2(30) not nullpetType varchar2(20)petDesc varchar2(40)petDOB datedateRegistered datepetStatus char not nullownerNo char(5) fk(PetOwner)clinicNo char(5) fk(Clinic)Attribute Type ConstraintexamNo char(6) pkexamDate date not nullexamTime number(4,2)examResults varchar2(40) not nullpetNo char(6) fk(Pet)staffNo char(4) fk(Staff)Attribute Type ConstrainttreatNo char(4) pkdescription varchar2(40)cost number(5,2)Attribute Type ConstraintpenNo char(4) pkpenCapacity number default 2, >=1 and <=4penStatus char check ‘A’ or ‘N’, default ‘A’clinicNo char(5) fk(Clinic)Attribute Type ConstraintpenNo char(4) pk1, fk(Pen)petNo char(6) pk2, fk(Pet)dateIn date pk3dateOut datecomments varchar2(40)Attribute Type ConstraintexamNo char(6) pk1, fk(examination)treatNo char(4) pk2, fk(treatment)startDate date not nullendDate date not nullquantity number(4,1)petComments varchar2(40)Attribute Type ConstraintitemNo char(6) pkitemName varchar2(20) not nullitemDesc varchar2(40)itemCost number(4,2) >0Attribute Type ConstraintdrugNo char(3) pkdrugName varchar2(20) not nulldrugDesc varchar2(40)dosage varchar2(20) not nullmethodAdmin varchar(20)drugCost number(4,2) Attribute Type ConstraintitemNo char(6) pk1, fk(Item)clinicNo char(5) pk2, fk(Clinic)inStock number(6)reorderLevel number(6)reorderQty number(6)PharmacyItemClinicStockPharmClinicStockItemPenTreatmentExaminationAttribute Type ConstraintdrugNo char(3) pk1, fk(Pharmacy)clinicNo char(5) pk2, fk(Clinic)inStock number(6) not nullreorderLevel number(6)reorderQty number(6)Attribute Type ConstraintinvoiceNo char(6) pkinvoiceDate date not nulldatePaid datepaymentMethod varchar2(15) not nullownerNo char(5) fk(petOwner)examNo char(6) fk(examination)Attribute Type ConstraintappNo char(6) pkappDate date not nullappTime number(4,2) not nullpetNo char(6) fk(pet)Creating, Altering Tables, Loading Data Oracle Lab #1In this Lab., you will implement the relational database for the database PerfectPets based on the givenschemas (table specifications). Note that pk represents a primary key; fk represents a foreign key; pk1, pk2,…, pkn in a table represents a composite primary key that consists of pk1, pk2, …, pkn. Tips for the Labs. throughout this course Prepare your program (SQL) using the Text editor such as Note Pad. Copy and Past your program from the Text editor to SQL*Plus command line.  If the program works, save the program. Otherwise, fix the error for the program in the Text editor andtry it again.  Keep a text file that contains all your commands. Answer/perform the following questions/tasks: (1) What is the SPOOL command for? Briefly explain it and give an example. [2](2) What is the HOST command for? Briefly explain it and give an example. [2](3) Create all the tables based on the given schemas for PerfectPets database using Oracle SQL*Plus anddisplay the structure of each table after you created it. Make sure you implement all the necessaryintegrity constraints to the database. [30](4) Change the salary column type in Staff table to NUMBER(8,2) using the ALTER command. [2](5) Add the domain constraint, >0 and <500 for the drugCost column in Pharmacy table using the ALTERcommand. [2](6) Change the type of dosage in Pharmacy table to CHAR(20) using the ALTER command. [2](7) Add a new column, staffNo to PetTreatment table using the ALTER command. [2](8) Remove the constraint, salary > 0 in Staff table. [2](9) Display all the constraint names AND types for the Staff table using the SELECT command. [4](10) List all the table names you created so far using the SELECT command. [2](11) Load all the tables for the PerfectPets database with at least one record for each table using the


View Full Document

UH COSC 3480 - COSC 3480 Lab. #1

Download COSC 3480 Lab. #1
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view COSC 3480 Lab. #1 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view COSC 3480 Lab. #1 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?