Advertisement
Guest User

Untitled

a guest
Nov 20th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. Table company {
  2. id int PK
  3. address_id int
  4. name varchar
  5. }
  6.  
  7. Table department {
  8. id int PK
  9. name varchar
  10. parent_department_id int
  11. company_id int
  12. }
  13.  
  14. Table address {
  15. id int PK
  16. street varchar
  17. house_number varchar
  18. apartment_number int
  19. zip_code varchar
  20. country varchar
  21. }
  22.  
  23. Table email {
  24. id int PK
  25. value varchar
  26. }
  27.  
  28. Table telephone {
  29. id int PK
  30. value varchar
  31. type varchar
  32. }
  33.  
  34. Table employee {
  35. id int PK
  36. first_name varchar
  37. last_name varchar
  38. }
  39.  
  40. // tabele n:m
  41.  
  42. Table employee_emial_link {
  43. id int PK
  44. employee_id int
  45. email_id int
  46. }
  47.  
  48. Table employee_telephone_link {
  49. id int PK
  50. employee_id int
  51. telephone_id int
  52. }
  53.  
  54. Ref: company.address_id > address.id
  55.  
  56. Ref: department.parent_department_id > department.id
  57. Ref: department.company_id > company.id
  58.  
  59. Ref: employee_emial_link.employee_id > employee.id
  60. Ref: employee_emial_link.email_id > email.id
  61.  
  62. Ref: employee_telephone_link.employee_id > employee.id
  63. Ref: employee_telephone_link.telephone_id > telephone.id
  64.  
  65. // Ref: orders.user_id > users.id
  66.  
  67. // Ref: order_items.order_id > orders.id
  68.  
  69. // Ref: order_items.product_id > products.id
  70.  
  71. // Ref: products.merchant_id > merchants.id
  72.  
  73. // Ref: users.country_code > countries.code
  74.  
  75. // Ref: merchants.admin_id > users.id
  76.  
  77. // Ref: merchants.country_code > countries.code
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement