DataBase.sql 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. + goods[]
  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. count int not null,
  34. );
  35. /* node stuctor
  36. store
  37. + goods[]
  38. + selections
  39. + selectionGroup[]
  40. + selection[]
  41. + comments
  42. + comment[]
  43. */
  44. create table if not exists store
  45. (
  46. store_Id bigint not null primary key,
  47. postion varchar(100) not null,
  48. name varchar(50) not null,
  49. star int
  50. );
  51. create table if not exists goods
  52. (
  53. goods_id bigint not null primary key,
  54. postion varchar(100) not null,
  55. name varchar(50) not null,
  56. star int
  57. );
  58. create table if not exists selection_group
  59. (
  60. selection_group_id bigint not null primary key,
  61. name varchar(50) not null
  62. );
  63. create table if not exists selection
  64. (
  65. selection_id bigint not null primary key,
  66. name varchar(50) not null,
  67. price float(13,2)
  68. );