Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. use studydb;
  2. CREATE TABLE buyer
  3. (
  4. buyer_id int primary key auto_increment,
  5. buyer_name varchar(20) not null
  6. );
  7. CREATE TABLE product
  8. (
  9. product_id int primary key auto_increment,
  10. product_name varchar(20) not null
  11. );
  12. CREATE TABLE orders
  13. (
  14. order_id int primary key auto_increment,
  15. buyer_id int not null,
  16. product_id int not null,
  17. qty int not null
  18. );
  19. alter table orders
  20. add foreign key (buyer_id)
  21. references buyer (buyer_id);
  22. alter table orders
  23. add foreign key (product_id)
  24. references product (product_id);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement