数据库
Posted shixinzei
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了数据库相关的知识,希望对你有一定的参考价值。
1 /* 2 SQLyog v10.2 3 mysql - 5.5.27 : Database - restrant 4 ********************************************************************* 5 */ 6 7 8 /*!40101 SET NAMES utf8 */; 9 10 /*!40101 SET SQL_MODE=‘‘*/; 11 12 /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 13 /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 14 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=‘NO_AUTO_VALUE_ON_ZERO‘ */; 15 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 16 CREATE DATABASE /*!32312 IF NOT EXISTS*/`restrant` /*!40100 DEFAULT CHARACTER SET utf8 */; 17 18 USE `restrant`; 19 20 /*Table structure for table `admin` */ 21 22 DROP TABLE IF EXISTS `admin`; 23 24 CREATE TABLE `admin` ( 25 `Id` int(4) NOT NULL AUTO_INCREMENT, 26 `LoginName` varchar(20) DEFAULT NULL, 27 `LoginPwd` varchar(20) DEFAULT NULL, 28 PRIMARY KEY (`Id`) 29 ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; 30 31 /*Data for the table `admin` */ 32 33 insert into `admin`(`Id`,`LoginName`,`LoginPwd`) values (1,‘admin‘,‘123456‘); 34 35 /*Table structure for table `functions` */ 36 37 DROP TABLE IF EXISTS `functions`; 38 39 CREATE TABLE `functions` ( 40 `id` int(4) NOT NULL AUTO_INCREMENT, 41 `name` varchar(20) DEFAULT NULL, 42 `parentid` int(4) DEFAULT NULL, 43 `url` varchar(50) DEFAULT NULL, 44 `isleaf` bit(1) DEFAULT NULL, 45 `nodeorder` int(4) DEFAULT NULL, 46 PRIMARY KEY (`id`) 47 ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; 48 49 /*Data for the table `functions` */ 50 51 insert into `functions`(`id`,`name`,`parentid`,`url`,`isleaf`,`nodeorder`) values (1,‘订餐系统管理后台‘,0,NULL,‘\0‘,0),(2,‘餐品管理‘,1,NULL,‘\0‘,1),(3,‘餐品列表‘,2,NULL,‘‘,1),(4,‘餐品类型列表‘,2,NULL,‘‘,2),(5,‘订单管理‘,1,NULL,‘\0‘,2),(6,‘查询订单‘,5,NULL,‘‘,1),(7,‘创建订单‘,5,NULL,‘‘,2),(8,‘订单统计‘,5,NULL,‘‘,3),(9,‘用户管理‘,1,NULL,‘\0‘,3),(10,‘用户列表‘,9,NULL,‘‘,1),(11,‘管理员列表‘,9,NULL,‘‘,2),(12,‘退出系统‘,1,NULL,‘‘,1); 52 53 /*Table structure for table `meal` */ 54 55 DROP TABLE IF EXISTS `meal`; 56 57 CREATE TABLE `meal` ( 58 `MealId` int(4) NOT NULL AUTO_INCREMENT, 59 `MealSeriesId` int(4) DEFAULT NULL, 60 `MealName` varchar(20) DEFAULT NULL, 61 `MealSummarize` varchar(250) DEFAULT NULL, 62 `MealDescription` varchar(250) DEFAULT NULL, 63 `MealPrice` decimal(8,2) DEFAULT NULL, 64 `MealImage` varchar(20) DEFAULT NULL, 65 `MealStatus` int(4) DEFAULT NULL, 66 PRIMARY KEY (`MealId`), 67 KEY `MealSeriesId` (`MealSeriesId`), 68 CONSTRAINT `meal_ibfk_1` FOREIGN KEY (`MealSeriesId`) REFERENCES `mealseries` (`SeriesId`) 69 ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; 70 71 /*Data for the table `meal` */ 72 73 insert into `meal`(`MealId`,`MealSeriesId`,`MealName`,`MealSummarize`,`MealDescription`,`MealPrice`,`MealImage`,`MealStatus`) values (1,1,‘雪梨肉肘棒‘,‘味鲜香甜咸,肘棒不腻‘,‘味鲜香甜咸,肘棒不腻‘,‘10.00‘,‘01.jpg‘,1),(2,1,‘素锅烤鸭肉‘,‘颜色鲜艳,酷似鸭肉,鲜香不腻。‘,‘颜色鲜艳,酷似鸭肉,鲜香不腻。‘,‘20.00‘,‘02.jpg‘,1),(3,1,‘烤花肉揽桂鱼‘,‘味道特鲜,白中泛红,佐以姜末、香醋,尤胜一等。‘,‘ 烤花揽桂鱼,是运用孔府菜的传统独特工艺味,道特鲜,白中泛红,佐以姜末、香醋,尤胜一等。‘,‘15.00‘,‘03.jpg‘,1),(4,1,‘泰安肉三美豆腐‘,‘汤汁乳白而鲜,豆腐软滑,白菜鲜嫩,清淡爽口。‘,‘“泰安三美豆腐”是泰安风味名菜。泰安产的白菜、豆腐和泰山泉水,历来被誉为“泰安三美”。泰安白菜个儿大心实,质细无筋;泰安豆腐,浆细质纯,嫩而不老;泰山泉水,清甜爽口,杂质少‘,‘8.00‘,‘04.jpg‘,1),(5,1,‘落叶琵琶肉虾‘,‘外型美观,鲜香味美。‘,‘ 外型美观,鲜香味美。 ‘,‘14.00‘,‘05.jpg‘,1),(6,1,‘肉冬菜肉末‘,‘味鲜香适口,下饭便菜。‘,‘味鲜香适口,下饭便菜。‘,‘12.00‘,‘06.jpg‘,1),(7,1,‘糖醋红柿椒‘,‘色红美,味鲜香。‘,‘色红美,味鲜香。‘,‘8.00‘,‘07.jpg‘,1),(8,2,‘芹黄烧鱼条‘,‘色泽金黄润亮,鱼肉鲜嫩味香。‘,‘色泽金黄润亮,鱼肉鲜嫩味香。‘,‘15.00‘,‘08.jpg‘,1),(9,2,‘巴国玉米糕肉‘,‘风味浓、口感奇、品种多‘,‘风味浓、口感奇、品种多,信手拈来,皆为佳品。‘,‘13.00‘,‘09.jpg‘,1),(10,2,‘酥皮龙虾‘,‘色泽黄绿相衬,协调雅致,外酥内嫩,鲜香爽口‘,‘酥皮龙虾成菜配以西兰花和蒜薹花,使色泽更加丰富,口感多样,诱人食欲。‘,‘20.00‘,‘10.jpg‘,1),(11,1,‘香煎茄片‘,‘色泽红亮,口感似鱼 ‘,‘色泽红亮,口感似鱼 ‘,‘9.00‘,‘11.jpg‘,1),(12,1,‘金陵片皮鸭‘,‘此菜深红明亮,皮脆,肉滑,分两次上桌,滋味各异‘,‘此菜深红明亮,皮脆,肉滑,分两次上桌,滋味各异,原为江苏风味,传入广东有较长历史,在制法上已有不少变化,现已成为粤菜名品。‘,‘10.00‘,‘12.jpg‘,1); 74 75 /*Table structure for table `mealseries` */ 76 77 DROP TABLE IF EXISTS `mealseries`; 78 79 CREATE TABLE `mealseries` ( 80 `SeriesId` int(4) NOT NULL AUTO_INCREMENT, 81 `SeriesName` varchar(10) DEFAULT NULL, 82 PRIMARY KEY (`SeriesId`) 83 ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; 84 85 /*Data for the table `mealseries` */ 86 87 insert into `mealseries`(`SeriesId`,`SeriesName`) values (1,‘鲁菜‘),(2,‘川菜‘),(3,‘粤菜‘),(4,‘苏菜‘),(5,‘闽菜‘),(6,‘浙菜‘),(7,‘湘菜‘),(8,‘徽菜‘),(9,‘西餐‘),(10,‘西点‘),(11,‘药膳‘),(12,‘私房菜‘); 88 89 /*Table structure for table `orderdts` */ 90 91 DROP TABLE IF EXISTS `orderdts`; 92 93 CREATE TABLE `orderdts` ( 94 `ODID` int(4) NOT NULL AUTO_INCREMENT, 95 `OID` int(4) DEFAULT NULL, 96 `MealId` int(4) DEFAULT NULL, 97 `MealPrice` decimal(8,2) DEFAULT NULL, 98 `MealCount` int(4) DEFAULT NULL, 99 PRIMARY KEY (`ODID`), 100 KEY `OID` (`OID`), 101 KEY `MealId` (`MealId`), 102 CONSTRAINT `orderdts_ibfk_1` FOREIGN KEY (`OID`) REFERENCES `orders` (`OID`), 103 CONSTRAINT `orderdts_ibfk_2` FOREIGN KEY (`MealId`) REFERENCES `meal` (`MealId`) 104 ) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8; 105 106 /*Data for the table `orderdts` */ 107 108 insert into `orderdts`(`ODID`,`OID`,`MealId`,`MealPrice`,`MealCount`) values (18,9,1,‘10.00‘,1),(19,9,2,‘20.00‘,1),(20,10,1,‘10.00‘,2),(21,10,2,‘20.00‘,3),(22,11,2,‘20.00‘,2),(23,11,4,‘8.00‘,1),(24,12,2,‘20.00‘,3),(25,12,4,‘8.00‘,1); 109 110 /*Table structure for table `orders` */ 111 112 DROP TABLE IF EXISTS `orders`; 113 114 CREATE TABLE `orders` ( 115 `OID` int(4) NOT NULL AUTO_INCREMENT, 116 `UserId` int(4) DEFAULT NULL, 117 `OrderTime` datetime DEFAULT NULL, 118 `OrderStatus` varchar(20) DEFAULT NULL, 119 `OrderPrice` decimal(8,2) DEFAULT NULL, 120 PRIMARY KEY (`OID`), 121 KEY `UserId` (`UserId`), 122 CONSTRAINT `orders_ibfk_1` FOREIGN KEY (`UserId`) REFERENCES `users` (`Id`) 123 ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; 124 125 /*Data for the table `orders` */ 126 127 insert into `orders`(`OID`,`UserId`,`OrderTime`,`OrderStatus`,`OrderPrice`) values (9,1,‘2014-05-04 16:07:44‘,‘未付款‘,‘30.00‘),(10,1,‘2014-05-04 18:54:17‘,‘未付款‘,‘80.00‘),(11,1,‘2014-05-05 17:30:16‘,‘未付款‘,‘48.00‘),(12,2,‘2014-05-05 17:52:48‘,‘未付款‘,‘68.00‘); 128 129 /*Table structure for table `powers` */ 130 131 DROP TABLE IF EXISTS `powers`; 132 133 CREATE TABLE `powers` ( 134 `aid` int(4) NOT NULL, 135 `fid` int(4) NOT NULL, 136 PRIMARY KEY (`aid`,`fid`), 137 KEY `fid` (`fid`), 138 KEY `aid` (`aid`), 139 CONSTRAINT `powers_ibfk_1` FOREIGN KEY (`aid`) REFERENCES `admin` (`Id`), 140 CONSTRAINT `powers_ibfk_2` FOREIGN KEY (`fid`) REFERENCES `functions` (`id`) 141 ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 142 143 /*Data for the table `powers` */ 144 145 insert into `powers`(`aid`,`fid`) values (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(1,8),(1,9),(1,10),(1,11),(1,12); 146 147 /*Table structure for table `users` */ 148 149 DROP TABLE IF EXISTS `users`; 150 151 CREATE TABLE `users` ( 152 `Id` int(4) NOT NULL AUTO_INCREMENT, 153 `LoginName` varchar(20) DEFAULT NULL, 154 `LoginPwd` varchar(20) DEFAULT NULL, 155 `TrueName` varchar(20) DEFAULT NULL, 156 `Email` varchar(20) DEFAULT NULL, 157 `Phone` varchar(20) DEFAULT NULL, 158 `Address` varchar(50) DEFAULT NULL, 159 `Status` int(4) DEFAULT NULL, 160 PRIMARY KEY (`Id`) 161 ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; 162 163 /*Data for the table `users` */ 164 165 insert into `users`(`Id`,`LoginName`,`LoginPwd`,`TrueName`,`Email`,`Phone`,`Address`,`Status`) values (1,‘zhangsan‘,‘123456‘,‘张三‘,‘user@163.com‘,‘13200000001‘,‘江苏南京X区X小区X栋001‘,1),(2,‘zs‘,‘zs‘,‘zs‘,‘zs‘,‘zs‘,‘zs‘,1),(3,‘lisi‘,‘lisi‘,‘lisi‘,‘lisi‘,‘lisi‘,‘lisi‘,1); 166 167 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 168 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 169 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 170 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
以上是关于数据库的主要内容,如果未能解决你的问题,请参考以下文章