fork(1) download
  1. Create table item
  2. (iname varchar(30) primary key,
  3. itype varchar(30));
  4.  
  5. Create table Cafe
  6. (license numeric(5,0) primary key,
  7. cname varchar(30),
  8. address varchar(30));
  9.  
  10. Create table Client
  11. (cid numeric(5,0) primary key,
  12. name varchar(30),
  13. phone numeric(9,0));
  14.  
  15. Create table Likes
  16. (cid numeric(5,0),
  17. iname varchar(30),
  18. primary key(cid,iname),
  19. foreign key(cid) references Client,
  20. foreign key(iname) references item);
  21.  
  22. Create table Sells
  23. (license numeric(5,0),
  24. iname varchar(30),
  25. price float check(price > 0),
  26. primary key(license,iname),
  27. foreign key(license) references Cafe,
  28. foreign key(iname) references item);
  29.  
  30. Create table Receipt
  31. (cid numeric(5,0),
  32. rno numeric(5,0),
  33. license numeric(5,0),
  34. rdate date,
  35. primary key(cid,rno),
  36. foreign key(cid) references Client,
  37. foreign key(license) references Cafe);
  38.  
  39. Create table Buys
  40. (cid numeric(5,0),
  41. rno numeric(5,0),
  42. iname varchar(30),
  43. amount int check(amount > 0),
  44. primary key(cid,rno,iname),
  45. foreign key(cid) references Client,
  46. foreign key(rno) references Receipt,
  47. foreign key(iname) references item);
Success #stdin #stdout 0s 17184KB
stdin
Standard input is empty
stdout
Standard output is empty