DataBase.sql 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. drop database if exists ShoppingWebsite;
  2. create database if not exists ShoppingWebsite;
  3. use ShoppingWebsite;
  4. /* node stuctor
  5. userAccount
  6. + cart
  7. + user_cart[]
  8. + collect
  9. + user_collect[]
  10. */
  11. create table if not exists userAccount
  12. (
  13. email varchar(50) not null primary key,
  14. password varchar(16) not null,
  15. permission_id bigint
  16. );
  17. create table if not exists user_cart
  18. (
  19. user_email varchar(50) not null,
  20. addin_time datetime not null,
  21. mun int not null
  22. );
  23. create table if not exists user_collect
  24. (
  25. user_email varchar(50) not null,
  26. addin_time datetime not null,
  27. goodId bigint not null
  28. );
  29. /* node stuctor
  30. store
  31. + goods[]
  32. + selections
  33. + selectionGroup[]
  34. + selection[]
  35. + comments
  36. + comment[]
  37. */
  38. create table if not exists store
  39. (
  40. store_Id bigint not null primary key,
  41. postion varchar(100) not null,
  42. store_name varchar(50) not null,
  43. star int
  44. );
  45. create table if not exists goods
  46. (
  47. goods_Id bigint not null primary key,
  48. store_Id bigint not null,
  49. postion varchar(100) not null,
  50. goods_name varchar(50) not null,
  51. star int
  52. );
  53. create table if not exists selection_group
  54. (
  55. selection_group_Id bigint not null primary key,
  56. goods_Id bigint not null,
  57. selection_group_name varchar(50) not null
  58. );
  59. create table if not exists selection
  60. (
  61. selection_Id bigint not null primary key,
  62. selection_group_Id bigint not null,
  63. selection_name varchar(50) not null,
  64. price float(13,2) not null
  65. );
  66. create table if not exists comment
  67. (
  68. selection_Id bigint not null,
  69. user_email varchar(50) not null,
  70. comment_time datetime not null,
  71. comment_text text not null
  72. );