(1)使用数据库mysql,脚本语言如下:
/* 用户表*/ CREATE TABLE `usertbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(20) DEFAULT NULL, `password` varchar(20) DEFAULT NULL, `permission` int(11) DEFAULT NULL, PRIMARY KEY (`id`) ) DEFAULT CHARSET=gbk; /*餐桌表*/ CREATE TABLE `tabletbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, `flag` int(11) DEFAULT '0' COMMENT '1:表示有人 0:表示空位', PRIMARY KEY (`id`) ) DEFAULT CHARSET=gbk; /*菜单分类表*/ CREATE TABLE `menutypetbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(20) DEFAULT NULL, PRIMARY KEY (`id`) )DEFAULT CHARSET=gbk; /*菜单表*/ CREATE TABLE `menutbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, `tid` int(11) DEFAULT NULL, `name` varchar(20) DEFAULT NULL, `price` int(11) DEFAULT NULL, `description` varchar(20) DEFAULT NULL, PRIMARY KEY (`id`) )DEFAULT CHARSET=gbk; /* 订单表*/ CREATE TABLE `ordertbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ctime` varchar(20) DEFAULT NULL, `uid` int(11) DEFAULT NULL, `tid` int(11) DEFAULT NULL, `description` varchar(20) DEFAULT NULL, `personNum` int(11) DEFAULT NULL, `isPay` int(11) DEFAULT '0' COMMENT '0:未结算 1: 结算', PRIMARY KEY (`id`) )DEFAULT CHARSET=gbk; /* 订单详细表*/ CREATE TABLE `orderdetailtbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, `oid` int(11) DEFAULT NULL, `mid` int(11) DEFAULT NULL, `num` int(11) DEFAULT NULL, `description` varchar(20) DEFAULT NULL, PRIMARY KEY (`id`) )DEFAULT CHARSET=gbk; INSERT INTO `usertbl` (`id`, `username`, `password`, `permission`) VALUES (1,'admin','123',NULL), (2,'tom','456',NULL); COMMIT; INSERT INTO `menutypetbl` (`id`, `name`) VALUES (1,'热菜'), (2,'凉菜'), (3,'酒品'); COMMIT; INSERT INTO `menutbl` (`id`, `tid`, `name`, `price`, `description`) VALUES (1,1,'水煮鱼',30,NULL), (2,1,'地三鲜',15,NULL), (3,2,'鱼香肉丝',15,NULL), (4,2,'东北乱炖',30,NULL); COMMIT; INSERT INTO `tabletbl` (`id`, `flag`) VALUES (1,0), (2,0), (3,0), (4,0), (5,0), (6,0); COMMIT;
数据库创建成功!
原文地址:http://blog.csdn.net/xlgen157387/article/details/44002153