Advertisement
salahgo

Untitled

Jan 21st, 2014
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE TABLE Dep
  2. (Deptno NUMBER(2) PRIMARY KEY,
  3. Dname VARCHAR2(30) UNIQUE CHECK (Dname = UPPER(Dname)) NOT NULL);
  4.  
  5. CREATE TABLE Etudiant
  6. (Stdno NUMBER(8) PRIMARY KEY,
  7. Sname VARCHAR2(30),
  8. Deptno NUMBER(2),
  9. CONSTRAINT fk_dep FOREIGN KEY (Deptno)
  10. REFERENCES Dep(Deptno));
  11.  
  12. CREATE TABLE cours
  13. (coursno NUMBER(3) PRIMARY KEY ,
  14. cname VARCHAR2(20) ,
  15. cmax NUMBER(2) ,
  16. deptno NUMBER(2) ,
  17. CONSTRAINT fk_cours foreign KEY (deptno)
  18. references dep(deptno));
  19.  
  20. CREATE TABLE Inscription
  21. (Stdno NUMBER(8) references Etudiant(Stdno),
  22.  coursno NUMBER(3) references cours(coursno),
  23.  grade NUMBER(2),
  24.  CONSTRAINT pk_inscri PRIMARY KEY (Stdno, coursno));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement