Advertisement
Guest User

Untitled

a guest
May 24th, 2022
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. Design A: one table for common elements and N tables for uncommon elements
  2. Table Product
  3. int product_id
  4. string brand_name
  5. number price
  6. number weight
  7. int product_type #1 for fish, 2 for bicycles
  8. int fish_or_bike_id #foreign key into either the fish table or bicycle table
  9.  
  10. Table Fish
  11. int fish_id
  12. bool requires_salt_water
  13.  
  14. Table Bicycle
  15. int bicycle_id
  16. int number_of_spokes
  17.  
  18. Design B: everything in one table, even if it doesn't make sense
  19. Table Product
  20. int product_id
  21. string brand_name
  22. number price
  23. number weight
  24. int product_type #1 for fish, 2 for bicycles
  25. bool requires_saltwater #always False for bicycles
  26. int number_of_spokes #always 0 for fish
  27.  
  28. Design C: no common tables whatsoever
  29. Table Fish
  30. int product_id
  31. string brand_name
  32. number price
  33. number weight
  34. bool requires_salt_water
  35. Table Bicycle
  36. int product_id
  37. string brand_name
  38. number price
  39. number weight
  40. int number_of_spokes
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement