DataBase.sql 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. drop database if exists ShoppingWebsite;
  2. create database if not exists ShoppingWebsite;
  3. use ShoppingWebsite;
  4. /* node*/
  5. create table if not exists nodeinfo
  6. (
  7. id bigint not null primary key,
  8. prev_id bigint null,
  9. next_id bigint null,
  10. parent_id bigint null,
  11. child_id bigint null,
  12. obj_type varchar(100) default 'group04.BasicNode'
  13. );
  14. /* node stuctor
  15. userAccount
  16. + cart
  17. + user_cart[]
  18. + collect
  19. + user_collect[]
  20. */
  21. create table if not exists userAccount
  22. (
  23. userId bigint not null,
  24. email varchar(50) not null,
  25. password varchar(16) not null,
  26. permission int not null default 0,
  27. primary key(email,userId)
  28. );
  29. /*goods*/
  30. create table if not exists user_cart
  31. (
  32. user_Cart_Id bigint not null primary key,
  33. mun int not null
  34. );
  35. create table if not exists user_collect
  36. (
  37. user_collect_Id bigint not null primary key,
  38. goodId bigint not null
  39. );
  40. /* node stuctor
  41. store
  42. + goods[]
  43. + selections
  44. + selectionGroup[]
  45. + selection[]
  46. + comments
  47. + comment[]
  48. */
  49. create table if not exists store
  50. (
  51. store_Id bigint not null primary key,
  52. postion varchar(100) not null,
  53. name varchar(50) not null,
  54. star int
  55. );
  56. create table if not exists goods
  57. (
  58. goods_id bigint not null primary key,
  59. postion varchar(100) not null,
  60. name varchar(50) not null,
  61. star int
  62. );
  63. create table if not exists selection_group
  64. (
  65. selection_group_id bigint not null primary key,
  66. name varchar(50) not null
  67. );
  68. create table if not exists selection
  69. (
  70. selection_id bigint not null primary key,
  71. name varchar(50) not null,
  72. price float(13,2)
  73. );