Guest User

Untitled

a guest
Jan 23rd, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. create database workshop_day03;
  2. use workshop_day03;
  3.  
  4. create table customers(
  5. id int unsigned primary key auto_increment,
  6. name varchar (40)
  7. );
  8.  
  9. create table customer_address (
  10. id int unsigned primary key auto_increment,
  11. street varchar(40) not null,
  12. city varchar(40) not null,
  13. cust_id int unsigned,
  14. constraint cust_id_fk foreign key(cust_id) references customers(id)
  15. );
  16.  
  17. create table shipment(
  18. id int unsigned primary key auto_increment,
  19. name varchar(40)
  20. );
  21.  
  22. create table orders(
  23. id int unsigned primary key auto_increment,
  24. item_name varchar(40) not null,
  25. item_quantity int unsigned not null,
  26. cust_id int unsigned not null,
  27. shipment_id int unsigned,
  28. constraint cust_order_id_fk foreign key(cust_id) references customers(id),
  29. constraint shipment_order_id_fk foreign key (shipment_id) references shipment(id)
  30. );
Add Comment
Please, Sign In to add comment