DataBase.sql 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. + selectionGroup[]
  39. + selection[]
  40. + comment[]
  41. */
  42. create table if not exists store
  43. (
  44. store_Id bigint not null primary key,
  45. postion varchar(100) not null,
  46. name varchar(50) not null,
  47. star int
  48. );
  49. create table if not exists goods
  50. (
  51. goods_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 selection_group
  57. (
  58. selection_group_id bigint not null primary key,
  59. name varchar(50) not null
  60. );
  61. create table if not exists selection
  62. (
  63. selection_id bigint not null primary key,
  64. name varchar(50) not null,
  65. price float(13,2)
  66. );