MyCalendar.sql 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. create database MyCalendar;
  2. use MyCalendar;
  3. drop table user;
  4. drop table menu;
  5. drop table user_menu;
  6. drop table room;
  7. drop table room_schedule;
  8. -- 用户表
  9. create table user(
  10. id int primary key auto_increment,
  11. name varchar(8) not null,
  12. loginName varchar(32) not null,
  13. password varchar(16) not null,
  14. tel varchar(14) not null,
  15. email varchar(32) not null,
  16. create_date datetime not null
  17. );
  18. insert into user(id,name, loginName, password, tel, email, create_date) values(1,'吾同树','jin', '123' ,'15102751852', 'jins321@gmail.com','2014-04-26 22:07:37');
  19. insert into user(id,name, loginName, password, tel, email, create_date) values(2,'天仙姐姐','jie', '123' ,'15105201314', '5201314@qq.com','2014-04-26 22:07:37');
  20. -- 菜单表
  21. create table menu(
  22. id int primary key auto_increment,
  23. name varchar(32) not null,
  24. price float not null,
  25. state int not null
  26. );
  27. INSERT INTO `menu` (`id`,`name`,`price`,`state`) VALUES (1,'鱼香肉丝',12,1);
  28. INSERT INTO `menu` (`id`,`name`,`price`,`state`) VALUES (2,'粉蒸排骨',15,2);
  29. INSERT INTO `menu` (`id`,`name`,`price`,`state`) VALUES (3,'土豆回锅肉',15,3);
  30. INSERT INTO `menu` (`id`,`name`,`price`,`state`) VALUES (4,'红烧肉',20,3);
  31. INSERT INTO `menu` (`id`,`name`,`price`,`state`) VALUES (5,'韭菜炒鸡蛋',12,3);
  32. INSERT INTO `menu` (`id`,`name`,`price`,`state`) VALUES (6,'青椒肉丝',12,1);
  33. INSERT INTO `menu` (`id`,`name`,`price`,`state`) VALUES (7,'麻辣豆腐',15,1);
  34. INSERT INTO `menu` (`id`,`name`,`price`,`state`) VALUES (8,'辣子鸡丁',15,1);
  35. INSERT INTO `menu` (`id`,`name`,`price`,`state`) VALUES (9,'地三鲜',10,3);
  36. INSERT INTO `menu` (`id`,`name`,`price`,`state`) VALUES (10,'剁椒鱼头',30,2);
  37. INSERT INTO `menu` (`id`,`name`,`price`,`state`) VALUES (11,'毛豆牛肉',18,1);
  38. INSERT INTO `menu` (`id`,`name`,`price`,`state`) VALUES (12,'千张肉丝',15,3);
  39. -- 订单表
  40. create table user_menu(
  41. id int primary key auto_increment,
  42. userid int not null,
  43. menuid int not null,
  44. state int not null,
  45. order_date datetime not null,
  46. create_date datetime not null
  47. );
  48. INSERT INTO `user_menu` (`userid`,`menuid`,`state`,`order_date`,`create_date`) VALUES (1,1,1,now(),'2014-04-26 22:09:49');
  49. INSERT INTO `user_menu` (`userid`,`menuid`,`state`,`order_date`,`create_date`) VALUES (1,3,1,SUBDATE(now(),INTERVAL 1 DAY),'2014-04-26 22:09:49');
  50. INSERT INTO `user_menu` (`userid`,`menuid`,`state`,`order_date`,`create_date`) VALUES (1,2,1,ADDDATE(now(),INTERVAL 1 DAY),'2014-04-29 00:09:20');
  51. INSERT INTO `user_menu` (`userid`,`menuid`,`state`,`order_date`,`create_date`) VALUES (1,4,2,now(),'2014-04-26 22:09:49');
  52. INSERT INTO `user_menu` (`userid`,`menuid`,`state`,`order_date`,`create_date`) VALUES (1,5,2,SUBDATE(now(),INTERVAL 1 DAY),'2014-04-26 22:09:49');
  53. INSERT INTO `user_menu` (`userid`,`menuid`,`state`,`order_date`,`create_date`) VALUES (1,6,2,ADDDATE(now(),INTERVAL 1 DAY),'2014-04-29 00:09:20');
  54. -- 会议室表
  55. create table room(
  56. id int primary key auto_increment,
  57. name varchar(32) not null
  58. );
  59. insert into room(id,name) values(1,'会议室一');
  60. insert into room(id,name) values(2,'会议室二');
  61. insert into room(id,name) values(3,'会议室三');
  62. insert into room(id,name) values(4,'会议室四');
  63. create table room_schedule(
  64. id int primary key auto_increment,
  65. subject varchar(256) not null,
  66. roomid int not null,
  67. userid int not null,
  68. start datetime not null,
  69. end datetime not null,
  70. create_date datetime not null
  71. );
  72. INSERT INTO `room_schedule` (`subject`,`roomid`,`userid`,`start`,`end`,`create_date`) VALUES ('羽毛球赛程讨论会',1,2,ADDDATE(now(),INTERVAL "1 4" DAY_HOUR),ADDDATE(now(),INTERVAL "1 5" DAY_HOUR),'2014-04-29 00:09:20');
  73. INSERT INTO `room_schedule` (`subject`,`roomid`,`userid`,`start`,`end`,`create_date`) VALUES ('全球环境保护会议',1,1,ADDDATE(now(),INTERVAL "1 2" DAY_HOUR),ADDDATE(now(),INTERVAL "1 3" DAY_HOUR),'2014-04-29 00:09:20');
  74. INSERT INTO `room_schedule` (`subject`,`roomid`,`userid`,`start`,`end`,`create_date`) VALUES ('国庆假期出游动员大会',1,1,SUBDATE(now(),INTERVAL "1 2" DAY_HOUR),SUBDATE(now(),INTERVAL "1 1" DAY_HOUR),'2014-04-29 00:09:20');
  75. INSERT INTO `room_schedule` (`subject`,`roomid`,`userid`,`start`,`end`,`create_date`) VALUES ('XX项目评审',1,1,now(),ADDDATE(now(),INTERVAL "2" HOUR),'2014-04-29 00:09:20');