Table creation statement for database model


USING ORACLE 11G

Present table creation statements (consisting of constraints) for Database Model. Present them all in a single script file.

Also present a document explaining what test data you employed to test your constraints. This would be data that you aren't including in your insert data for this assignment because you were using it to make sure the constraints were working (that is, as long as everything is working correctly, the database won't accept it).

Question1) Make a database based on the below model.

1296_data base structure.jpg

Save your table creation statements as a script (you'll be submitting this script). Your script must follow the diagram exactly. Be sure to comprise the necessary constraints.

Question2) Make sample data. (See below for some sample data)  Save the scripts that load the data. Test the constraints with appropriate data. The data will be used for the reports described next.

Question3) Make SQL scripts for the assigned reports.

Format: Submit the code to make the tables, insert the sample data, and make reports as scripts. You should submit the code as scripts that the instructor can run from an SQL prompt on an Oracle DBMS. Your submission must include a description of the scripts, their actions, and the order in which they should be run. Your code should not have any "side effects" (that is, it must not do anything not listed in the assignment description, and all of its actions should be explained in program header).

The code for each part should be submitted as a single text file for that part.
Criteria:

i) Well-written code
ii) Code meets requirements
iii) Good test data

--------------------------------------------------------
--  File created - Saturday-March-30-2013  
--------------------------------------------------------
  DROP TABLE "FACULTY" cascade constraints;
  DROP TABLE "STUDENT" cascade constraints;
--------------------------------------------------------
--  DDL for Table FACULTY
--------------------------------------------------------

  CREATE TABLE "FACULTY"
   (    "FACULTYID" VARCHAR2(6),
    "FACULTYNAME" VARCHAR2(45),
    "OFFICETELEPHONENUMBER" VARCHAR2(15),
    "OFFICENUMBER" NUMBER(5,0)
   ) ;
--------------------------------------------------------
--  DDL for Table STUDENT
--------------------------------------------------------

  CREATE TABLE "STUDENT"
   (    "STUDENTID" VARCHAR2(6),
    "STUDENTNAME" VARCHAR2(45),
    "FACULTYID" VARCHAR2(6),
    "HOMETELEPHONENUMBER" VARCHAR2(15),
    "HOMEADDRESS" VARCHAR2(45),
    "ENROLMENTSTATUS" VARCHAR2(15)
   ) ;

---------------------------------------------------
--   DATA FOR TABLE FACULTY
--   FILTER = none used
---------------------------------------------------
REM INSERTING into FACULTY
Insert into FACULTY (FACULTYID,FACULTYNAME,OFFICETELEPHONENUMBER,OFFICENUMBER) values ('FAC101','John Breto','83289428492',81);
Insert into FACULTY (FACULTYID,FACULTYNAME,OFFICETELEPHONENUMBER,OFFICENUMBER) values ('FAC102','Agasi Henry','89498340949',24);
Insert into FACULTY (FACULTYID,FACULTYNAME,OFFICETELEPHONENUMBER,OFFICENUMBER) values ('FAC103','Peter William','89489489844',90);
Insert into FACULTY (FACULTYID,FACULTYNAME,OFFICETELEPHONENUMBER,OFFICENUMBER) values ('FAC104','Francis David','98439834982',12);
Insert into FACULTY (FACULTYID,FACULTYNAME,OFFICETELEPHONENUMBER,OFFICENUMBER) values ('FAC105','Victor Beni','98904094099',21);

---------------------------------------------------
--   END DATA FOR TABLE FACULTY
---------------------------------------------------


---------------------------------------------------
--   DATA FOR TABLE STUDENT
--   FILTER = none used
---------------------------------------------------
REM INSERTING into STUDENT
Insert into STUDENT (STUDENTID,STUDENTNAME,FACULTYID,HOMETELEPHONENUMBER,HOMEADDRESS,ENROLMENTSTATUS) values ('STU101','Million Cint','FAC102','98498438934','36, Green Road, NY','Enrolled');
Insert into STUDENT (STUDENTID,STUDENTNAME,FACULTYID,HOMETELEPHONENUMBER,HOMEADDRESS,ENROLMENTSTATUS) values ('STU102','Nilson Stephen','FAC104','98438948943','12, Yellow Road, SYR','Not Enrolled');
Insert into STUDENT (STUDENTID,STUDENTNAME,FACULTYID,HOMETELEPHONENUMBER,HOMEADDRESS,ENROLMENTSTATUS) values ('STU103','Queen Berth','FAC102','45345345345','45, Red Road, FL','Enrolled');
Insert into STUDENT (STUDENTID,STUDENTNAME,FACULTYID,HOMETELEPHONENUMBER,HOMEADDRESS,ENROLMENTSTATUS) values ('STU104','Xavier Ester','FAC101','98489345893','54, Yellow Road, NY','Enrolled');
Insert into STUDENT (STUDENTID,STUDENTNAME,FACULTYID,HOMETELEPHONENUMBER,HOMEADDRESS,ENROLMENTSTATUS) values ('STU105','Benny Jenny','FAC105','89348348488','90, Rose Road, NY','Enrolled');
Insert into STUDENT (STUDENTID,STUDENTNAME,FACULTYID,HOMETELEPHONENUMBER,HOMEADDRESS,ENROLMENTSTATUS) values ('STU106','George Stephen','FAC103','8948438348','120, White Palace, NY','Enrolled');

---------------------------------------------------
--   END DATA FOR TABLE STUDENT
---------------------------------------------------

--------------------------------------------------------
--  Constraints for Table STUDENT
--------------------------------------------------------

  ALTER TABLE "STUDENT" ADD CONSTRAINT "STUDENT_PK" PRIMARY KEY ("STUDENTID", "FACULTYID") ENABLE;

  ALTER TABLE "STUDENT" MODIFY ("STUDENTID" NOT NULL ENABLE);

  ALTER TABLE "STUDENT" MODIFY ("STUDENTNAME" NOT NULL ENABLE);

  ALTER TABLE "STUDENT" MODIFY ("FACULTYID" NOT NULL ENABLE);

  ALTER TABLE "STUDENT" MODIFY ("HOMETELEPHONENUMBER" NOT NULL ENABLE);

  ALTER TABLE "STUDENT" MODIFY ("HOMEADDRESS" NOT NULL ENABLE);

  ALTER TABLE "STUDENT" MODIFY ("ENROLMENTSTATUS" NOT NULL ENABLE);
--------------------------------------------------------
--  Constraints for Table FACULTY
--------------------------------------------------------

  ALTER TABLE "FACULTY" ADD CONSTRAINT "FACULTY_PK" PRIMARY KEY ("FACULTYID") ENABLE;

  ALTER TABLE "FACULTY" MODIFY ("FACULTYID" NOT NULL ENABLE);

  ALTER TABLE "FACULTY" MODIFY ("FACULTYNAME" NOT NULL ENABLE);
--------------------------------------------------------
--  DDL for Index STUDENT_PK
--------------------------------------------------------

  CREATE UNIQUE INDEX "STUDENT_PK" ON "STUDENT" ("STUDENTID", "FACULTYID")
  ;
--------------------------------------------------------
--  DDL for Index FACULTY_PK
--------------------------------------------------------

  CREATE UNIQUE INDEX "FACULTY_PK" ON "FACULTY" ("FACULTYID")
  ;

--------------------------------------------------------
--  Ref Constraints for Table STUDENT
--------------------------------------------------------
ALTER TABLE "STUDENT" ADD CONSTRAINT "STUDENT_FACULTY_FK1" FOREIGN KEY ("FACULTYID")
  REFERENCES "FACULTY" ("FACULTYID") ENABLE;

Request for Solution File

Ask an Expert for Answer!!
PL-SQL Programming: Table creation statement for database model
Reference No:- TGS0876

Expected delivery within 24 Hours