SHARE
TWEET

Untitled

a guest Dec 16th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Create Table ARTIST(
  2.     NAME VARCHAR(20),
  3.     COUNTRY VARCHAR(20),
  4.    
  5.     PRIMARY KEY (NAME)
  6. );
  7.  
  8. Create Table ART(
  9.     ID SMALLINT,
  10.     TYPE VARCHAR(20),
  11.     CreatedYear SMALLINT,
  12.    
  13.     PRIMARY KEY(ID)
  14. );
  15.  
  16. CREATE TABLE CREATES(
  17.     NAME VARCHAR(20),
  18.     ID SMALLINT,
  19.    
  20.     PRIMARY KEY(NAME,ID),
  21.     FOREIGN KEY(NAME) REFERENCES ARTIST,
  22.    FOREIGN KEY(ID) REFERENCES ART
  23. );
  24.  
  25. INSERT INTO ART VALUES(1,'painting',1999);
  26. INSERT INTO ART VALUES(2,'painting',1999);
  27. INSERT INTO ART VALUES(3,'game',1999);
  28. INSERT INTO ART VALUES(4,'painting',2000);
  29. INSERT INTO ART VALUES(5,'painting',2000);
  30.  
  31. INSERT INTO ARTIST VALUES ('PETER','CHINA');
  32. INSERT INTO ARTIST VALUES ('JOHN','AMERICA');
  33. INSERT INTO ARTIST VALUES ('SAD','AMERICA');
  34.  
  35. INSERT INTO CREATES VALUES('PETER',1);
  36. INSERT INTO CREATES VALUES('PETER',3);
  37. INSERT INTO CREATES VALUES('PETER',4);
  38. INSERT INTO CREATES VALUES('JOHN',5);
  39. INSERT INTO CREATES VALUES ('SAD', 2);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top