Advertisement
absorr

final ourput 1

Mar 3rd, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.99 KB | None | 0 0
  1. SQL> CREATE TABLE stephensow1_final_Dept (
  2. 2 Dept_Code CHAR(5) PRIMARY KEY, Dept_Name VARCHAR2(32),
  3. 3 Dept_Phone VARCHAR2(16), College_Name VARCHAR2(32));
  4.  
  5. Table created.
  6.  
  7. SQL>
  8. SQL> CREATE TABLE stephensow1_final_Advisor (
  9. 2 Advisor_ID CHAR(5) PRIMARY KEY, Advisor_LName VARCHAR2(16),
  10. 3 Advisor_Office VARCHAR2(4), Advisor_Bldg VARCHAR2(32),
  11. 4 Advisor_Phone VARCHAR2(16), Dept_Code CHAR(5));
  12.  
  13. Table created.
  14.  
  15. SQL>
  16. SQL> ALTER TABLE stephensow1_final_Advisor ADD CONSTRAINT stephensow1_final_fk1
  17. 2 FOREIGN KEY (Dept_Code) REFERENCES stephensow1_final_Dept(Dept_Code)
  18. 3 INITIALLY DEFERRED DEFERRABLE;
  19.  
  20. Table altered.
  21.  
  22. SQL> CREATE TABLE stephensow1_final_Student (
  23. 2 Stu_Num CHAR(6) PRIMARY KEY, Stu_LName VARCHAR2(16),
  24. 3 Stu_Major VARCHAR2(5), Stu_GPA NUMBER(1, 2),
  25. 4 Stu_Hours NUMBER(3), Stu_Class VARCHAR2(10),
  26. 5 Advisor_ID CHAR(5), Dept_Code CHAR(5));
  27.  
  28. Table created.
  29.  
  30. SQL>
  31. SQL> ALTER TABLE stephensow1_final_Student ADD CONSTRAINT stephensow1_final_fk2
  32. 2 FOREIGN KEY (Dept_Code) REFERENCES stephensow1_final_Dept(Dept_Code)
  33. 3 INITIALLY DEFERRED DEFERRABLE;
  34.  
  35. Table altered.
  36.  
  37. SQL>
  38. SQL> ALTER TABLE stephensow1_final_Student ADD CONSTRAINT stephensow1_final_fk3
  39. 2 FOREIGN KEY (Advisor_ID) REFERENCES stephensow1_final_Advisor(Advisor_ID)
  40. 3 INITIALLY DEFERRED DEFERRABLE;
  41.  
  42. Table altered.
  43.  
  44.  
  45.  
  46.  
  47.  
  48. SQL> INSERT INTO stephensow1_final_Dept VALUES ('ACCT', 'Accounting', '4356', 'Business Admin');
  49.  
  50. 1 row created.
  51.  
  52. SQL> INSERT INTO stephensow1_final_Dept VALUES ('MKTG', 'Marketing', '4378', 'Business Admin');
  53.  
  54. 1 row created.
  55.  
  56. SQL> SET DEFINE OFF;
  57. SQL> INSERT INTO stephensow1_final_Dept VALUES ('MATH', 'Mathematics', '3420', 'Arts & Sciences');
  58.  
  59. 1 row created.
  60.  
  61. SQL> SET DEFINE ON;
  62. SQL> INSERT INTO stephensow1_final_Dept VALUES ('CS', 'Computer Science', '5234', 'Informatics');
  63.  
  64. 1 row created.
  65.  
  66. SQL> INSERT INTO stephensow1_final_Dept VALUES ('IS', 'Business Informatics', '3951', 'Informatics');
  67.  
  68. 1 row created.
  69.  
  70.  
  71. SQL> INSERT INTO stephensow1_final_Advisor VALUES ('001', 'Grastand', 'T201', 'Torre Building', '2115', 'ACCT');
  72.  
  73. 1 row created.
  74.  
  75. SQL> INSERT INTO stephensow1_final_Advisor VALUES ('002', 'Gentry', 'T228', 'Torre Building', '2123', 'MKTG');
  76.  
  77. 1 row created.
  78.  
  79. SQL> INSERT INTO stephensow1_final_Advisor VALUES ('003', 'Tillery', 'T356', 'Torre Building', '2159', 'MKTG');
  80.  
  81. 1 row created.
  82.  
  83. SQL> INSERT INTO stephensow1_final_Advisor VALUES ('004', 'Chen', 'J331', 'Jones Building', '3209', 'MATH');
  84.  
  85. 1 row created.
  86.  
  87. SQL> INSERT INTO stephensow1_final_Advisor VALUES ('005', 'Lewis', '5132', 'Griffin', '1603', 'CS');
  88.  
  89. 1 row created.
  90.  
  91. SQL> INSERT INTO stephensow1_final_Advisor VALUES ('006', 'Zang', '3452', 'Griffin', '3512', 'IS');
  92.  
  93. 1 row created.
  94.  
  95. SQL> INSERT INTO stephensow1_final_Advisor VALUES ('007', 'Goh', '5612', 'Griffin', '7922', 'IS');
  96.  
  97. 1 row created.
  98.  
  99.  
  100. SQL> INSERT INTO stephensow1_final_Student VALUES ('211343', 'Stephanos', 'Accounting', 3.87, 75, 'Junior', '001', 'ACCT');
  101.  
  102. 1 row created.
  103.  
  104. SQL> INSERT INTO stephensow1_final_Student VALUES ('200128', 'Smith', 'Accounting', 2.78, 45, 'Sophomore', '001', 'ACCT');
  105.  
  106. 1 row created.
  107.  
  108. SQL> INSERT INTO stephensow1_final_Student VALUES ('199876', 'Jones', 'Marketing', 2.31, 117, 'Senior', '002', 'MKTG');
  109.  
  110. 1 row created.
  111.  
  112. SQL> INSERT INTO stephensow1_final_Student VALUES ('200888', 'Ortiz', 'Marketing', 3.45, 113, 'Senior', '003', 'MKTG');
  113.  
  114. 1 row created.
  115.  
  116. SQL> INSERT INTO stephensow1_final_Student VALUES ('223456', 'McKulski', 'Statistics', 3.58, 87, 'Junior', '004', 'MATH');
  117.  
  118. 1 row created.
  119.  
  120. SQL> INSERT INTO stephensow1_final_Student VALUES ('123984', 'Thomas', 'CIT', 2.5, 93, 'Senior', '005', 'CS');
  121.  
  122. 1 row created.
  123.  
  124. SQL> INSERT INTO stephensow1_final_Student VALUES ('995133', 'Thompson', 'BIS', 2.4, 58, 'Junior', '006', 'IS');
  125.  
  126. 1 row created.
  127.  
  128. SQL> INSERT INTO stephensow1_final_Student VALUES ('367181', 'Meyers', 'BIS', 2.3, 63, 'Junior', '007', 'IS');
  129.  
  130. 1 row created.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement