您好,登錄后才能下訂單哦!
這篇文章給大家分享的C#建立宿舍管理系統(tǒng)數(shù)據(jù)庫(kù)的代碼,相信大部分人都還沒學(xué)會(huì)這個(gè)技能,為了讓大家學(xué)會(huì),給大家總結(jié)了以下內(nèi)容,話不多說,一起往下看吧。
/*
Navicat MySQL Data Transfer
Source Server : hibernate
Source Server Version : 50610
Source Host : 127.0.0.1:3306
Source Database : dormdb
Target Server Type : MYSQL
Target Server Version : 50610
File Encoding : 65001
Date: 2019-08-02 12:10:00
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for building
-- ----------------------------
DROP TABLE IF EXISTS `building`;
CREATE TABLE `building` (
`buildId` int(11) NOT NULL AUTO_INCREMENT,
`buildName` varchar(30) DEFAULT NULL,
`dormCount` int(11) DEFAULT NULL,
`dormFloor` int(11) DEFAULT NULL,
PRIMARY KEY (`buildId`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of building
-- ----------------------------
INSERT INTO `building` VALUES ('1', '1號(hào)樓', '40', '4');
INSERT INTO `building` VALUES ('2', '2號(hào)樓', '20', '5');
-- ----------------------------
-- Table structure for charge
-- ----------------------------
DROP TABLE IF EXISTS `charge`;
CREATE TABLE `charge` (
`chargeId` int(11) NOT NULL AUTO_INCREMENT,
`chargeDate` datetime DEFAULT NULL,
`fk_typeId` int(11) DEFAULT NULL,
`fk_stuId` int(11) DEFAULT NULL,
`payMoney` decimal(10,2) DEFAULT NULL,
`fk_teachId` int(11) DEFAULT NULL,
`memo` varchar(100) DEFAULT NULL,
`day` int(11) DEFAULT NULL,
PRIMARY KEY (`chargeId`),
KEY `fk_typeId` (`fk_typeId`),
KEY `fk_stuId` (`fk_stuId`),
KEY `fk_teachId` (`fk_teachId`),
CONSTRAINT `charge_ibfk_1` FOREIGN KEY (`fk_typeId`) REFERENCES `chargetype` (`typeid`),
CONSTRAINT `charge_ibfk_2` FOREIGN KEY (`fk_stuId`) REFERENCES `student` (`stuId`),
CONSTRAINT `charge_ibfk_3` FOREIGN KEY (`fk_teachId`) REFERENCES `teacher` (`teachId`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of charge
-- ----------------------------
INSERT INTO `charge` VALUES ('1', '2019-04-11 08:46:24', '1', '1', '300.00', '2', 'xxxx', '14');
INSERT INTO `charge` VALUES ('2', '2019-04-23 10:06:14', '1', '1', '300.00', '2', 'xxx', '1');
-- ----------------------------
-- Table structure for chargetype
-- ----------------------------
DROP TABLE IF EXISTS `chargetype`;
CREATE TABLE `chargetype` (
`typeid` int(11) NOT NULL AUTO_INCREMENT,
`typeName` varchar(20) DEFAULT NULL,
`unitPrice` decimal(18,2) DEFAULT NULL,
`flag` int(11) DEFAULT NULL,
`memo` varchar(100) DEFAULT NULL,
PRIMARY KEY (`typeid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of chargetype
-- ----------------------------
INSERT INTO `chargetype` VALUES ('1', '二人間', '10.00', null, null);
INSERT INTO `chargetype` VALUES ('2', '三人間', '8.00', null, null);
-- ----------------------------
-- Table structure for classinfo
-- ----------------------------
DROP TABLE IF EXISTS `classinfo`;
CREATE TABLE `classinfo` (
`classId` int(11) NOT NULL AUTO_INCREMENT,
`className` varchar(20) DEFAULT NULL,
`fk_teachId` int(11) DEFAULT NULL,
`createDate` datetime DEFAULT NULL,
`endDate` datetime DEFAULT NULL,
`flag` int(11) DEFAULT NULL,
`memo` varchar(100) DEFAULT NULL,
PRIMARY KEY (`classId`),
KEY `fk_teachId` (`fk_teachId`),
CONSTRAINT `classinfo_ibfk_1` FOREIGN KEY (`fk_teachId`) REFERENCES `teacher` (`teachId`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of classinfo
-- ----------------------------
INSERT INTO `classinfo` VALUES ('1', 'a125', '1', '2019-04-15 09:04:10', null, '0', null);
INSERT INTO `classinfo` VALUES ('2', 'a126', '1', '2019-04-15 09:05:08', null, '0', null);
INSERT INTO `classinfo` VALUES ('3', 'a127', '1', '2019-04-15 09:05:18', '2019-04-15 09:05:20', '1', null);
-- ----------------------------
-- Table structure for dorm
-- ----------------------------
DROP TABLE IF EXISTS `dorm`;
CREATE TABLE `dorm` (
`dormId` int(11) NOT NULL AUTO_INCREMENT,
`dormNum` varchar(10) DEFAULT NULL,
`fk_typeId` int(11) DEFAULT NULL,
`fk_buildid` int(11) DEFAULT NULL,
`personCount` int(11) DEFAULT NULL,
`flag` int(11) DEFAULT NULL,
`memo` varchar(100) DEFAULT NULL,
PRIMARY KEY (`dormId`),
KEY `fk_typeId` (`fk_typeId`),
KEY `fk_buildid` (`fk_buildid`),
CONSTRAINT `dorm_ibfk_1` FOREIGN KEY (`fk_typeId`) REFERENCES `dormtype` (`typeId`),
CONSTRAINT `dorm_ibfk_2` FOREIGN KEY (`fk_buildid`) REFERENCES `building` (`buildId`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of dorm
-- ----------------------------
INSERT INTO `dorm` VALUES ('1', '401', '1', '1', '0', '1', null);
INSERT INTO `dorm` VALUES ('2', '402', '2', '2', '0', '1', null);
INSERT INTO `dorm` VALUES ('3', '403', '1', '2', '0', '1', null);
-- ----------------------------
-- Table structure for dormtype
-- ----------------------------
DROP TABLE IF EXISTS `dormtype`;
CREATE TABLE `dormtype` (
`typeId` int(11) NOT NULL AUTO_INCREMENT,
`typeName` varchar(20) DEFAULT NULL,
`personCount` int(11) DEFAULT NULL,
`price` decimal(8,2) DEFAULT NULL,
`flag` int(11) DEFAULT NULL,
`sex` char(2) DEFAULT NULL,
`memeo` varchar(50) DEFAULT NULL,
PRIMARY KEY (`typeId`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of dormtype
-- ----------------------------
INSERT INTO `dormtype` VALUES ('1', '4人間', '4', '100.00', '1', '男', null);
INSERT INTO `dormtype` VALUES ('2', '4人間', '4', '200.00', '1', '女', null);
-- ----------------------------
-- Table structure for power
-- ----------------------------
DROP TABLE IF EXISTS `power`;
CREATE TABLE `power` (
`pid` int(11) NOT NULL AUTO_INCREMENT,
`pname` varchar(20) DEFAULT NULL,
`url` varchar(200) DEFAULT NULL,
PRIMARY KEY (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of power
-- ----------------------------
-- ----------------------------
-- Table structure for role
-- ----------------------------
DROP TABLE IF EXISTS `role`;
CREATE TABLE `role` (
`rid` int(11) NOT NULL AUTO_INCREMENT,
`rname` varchar(20) DEFAULT NULL,
`sort` int(11) DEFAULT NULL,
PRIMARY KEY (`rid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of role
-- ----------------------------
-- ----------------------------
-- Table structure for role_power
-- ----------------------------
DROP TABLE IF EXISTS `role_power`;
CREATE TABLE `role_power` (
`pid` int(11) DEFAULT NULL,
`rid` int(11) DEFAULT NULL,
KEY `pid` (`pid`),
KEY `rid` (`rid`),
CONSTRAINT `role_power_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `power` (`pid`),
CONSTRAINT `role_power_ibfk_2` FOREIGN KEY (`rid`) REFERENCES `role` (`rid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of role_power
-- ----------------------------
-- ----------------------------
-- Table structure for student
-- ----------------------------
DROP TABLE IF EXISTS `student`;
CREATE TABLE `student` (
`stuId` int(11) NOT NULL AUTO_INCREMENT,
`stuNum` varchar(30) DEFAULT NULL,
`stuName` varchar(20) DEFAULT NULL,
`stuUserName` varchar(20) DEFAULT NULL,
`stuPass` varchar(20) DEFAULT NULL,
`sex` varchar(2) DEFAULT NULL,
`birthday` datetime DEFAULT NULL,
`cardId` varchar(20) DEFAULT NULL,
`fk_classId` int(11) DEFAULT NULL,
`tel` varchar(20) DEFAULT NULL,
`province` varchar(20) DEFAULT NULL,
`city` varchar(20) DEFAULT NULL,
`inDate` datetime DEFAULT NULL,
`outDate` datetime DEFAULT NULL,
`dormEndDate` datetime DEFAULT NULL,
`fk_dormId` int(11) DEFAULT NULL,
`flag` int(11) DEFAULT NULL,
`memo` varchar(100) DEFAULT NULL,
PRIMARY KEY (`stuId`),
KEY `fk_classId` (`fk_classId`),
KEY `fk_dormId` (`fk_dormId`),
CONSTRAINT `student_ibfk_1` FOREIGN KEY (`fk_classId`) REFERENCES `classinfo` (`classId`),
CONSTRAINT `student_ibfk_2` FOREIGN KEY (`fk_dormId`) REFERENCES `dorm` (`dormId`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of student
-- ----------------------------
INSERT INTO `student` VALUES ('1', '10001', '周瑜', null, null, '男', null, null, '1', null, null, null, null, null, null, null, '0', null);
INSERT INTO `student` VALUES ('2', '10002', '小喬', null, null, '女', null, null, '1', null, null, null, null, null, null, null, '0', null);
INSERT INTO `student` VALUES ('3', '10003', '大喬', null, null, '女', null, null, '1', null, null, null, null, null, null, null, '0', null);
INSERT INTO `student` VALUES ('4', '10004', '貂蟬', null, null, '女', null, null, '1', null, null, null, null, null, null, null, '0', null);
INSERT INTO `student` VALUES ('5', '10005', '孫尚香', null, null, '女', null, null, '1', null, null, null, null, null, null, null, '0', null);
INSERT INTO `student` VALUES ('6', '10006', '趙云', null, null, '男', null, null, '2', null, null, null, null, null, null, null, '0', null);
INSERT INTO `student` VALUES ('7', '10007', '關(guān)羽', null, null, '男', null, null, '2', null, null, null, null, null, null, null, '0', null);
INSERT INTO `student` VALUES ('8', '10008', '張飛', null, null, '男', null, null, '2', null, null, null, null, null, null, null, '0', null);
INSERT INTO `student` VALUES ('9', '10009', '馬超', null, null, '男', null, null, '2', null, null, null, null, null, null, null, '0', null);
INSERT INTO `student` VALUES ('10', '10010', '黃忠', null, null, '男', null, null, '2', null, null, null, null, null, null, null, '1', null);
-- ----------------------------
-- Table structure for teacher
-- ----------------------------
DROP TABLE IF EXISTS `teacher`;
CREATE TABLE `teacher` (
`teachId` int(11) NOT NULL AUTO_INCREMENT,
`teachName` varchar(30) DEFAULT NULL,
`teachUserName` varchar(20) DEFAULT NULL,
`teachPass` varchar(20) DEFAULT NULL,
`sex` varchar(2) DEFAULT NULL,
`birthday` datetime DEFAULT NULL,
`idCard` varchar(20) DEFAULT NULL,
`edulevel` varchar(20) DEFAULT NULL,
`specialty` varchar(30) DEFAULT NULL,
`tel` varchar(20) DEFAULT NULL,
`address` varchar(50) DEFAULT NULL,
`flag` int(11) DEFAULT NULL,
`memo` varchar(100) DEFAULT NULL,
`hireDate` datetime DEFAULT NULL,
`leaveDate` datetime DEFAULT NULL,
`fk_typeid` int(11) DEFAULT NULL,
PRIMARY KEY (`teachId`),
KEY `fk_typeid` (`fk_typeid`),
CONSTRAINT `teacher_ibfk_1` FOREIGN KEY (`fk_typeid`) REFERENCES `teachertype` (`typeId`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of teacher
-- ----------------------------
INSERT INTO `teacher` VALUES ('1', '王楊', null, null, null, '2019-04-16 00:00:00', null, null, null, null, null, '0', null, '2019-04-16 00:00:00', null, '1');
INSERT INTO `teacher` VALUES ('2', '趙明芳', null, null, null, null, null, null, null, null, null, '2', null, null, null, '2');
INSERT INTO `teacher` VALUES ('3', '張建', null, null, null, null, null, null, null, null, null, '1', null, null, null, '1');
INSERT INTO `teacher` VALUES ('4', '司朝貴', null, null, null, null, null, null, null, null, null, '2', null, null, '2019-04-10 15:16:12', '2');
INSERT INTO `teacher` VALUES ('5', '馬林', null, null, null, null, null, null, null, null, null, '3', null, null, null, '1');
INSERT INTO `teacher` VALUES ('6', '安春青', null, null, null, null, null, null, null, null, null, '1', null, null, null, '7');
INSERT INTO `teacher` VALUES ('7', '武亞娟', null, null, null, null, null, null, null, null, null, '1', null, null, null, '2');
INSERT INTO `teacher` VALUES ('8', 'AA', null, null, null, null, null, null, null, null, null, '2', null, '2019-04-10 11:07:08', null, '1');
INSERT INTO `teacher` VALUES ('9', '王麗娜', null, null, null, '2010-06-06 00:00:00', null, null, null, null, null, '1', null, null, null, '1');
INSERT INTO `teacher` VALUES ('10', '李智', null, null, null, '1989-11-08 00:00:00', null, null, null, null, null, '2', null, '2011-03-10 00:00:00', null, '1');
INSERT INTO `teacher` VALUES ('11', '趙尤溪', null, null, null, '2000-01-11 00:00:00', null, null, null, null, null, '1', null, '2019-04-10 15:02:48', null, '2');
INSERT INTO `teacher` VALUES ('12', '正帥鵬', null, null, null, '1998-01-01 00:00:00', null, null, null, null, null, '1', null, '2019-04-12 08:47:36', null, '1');
INSERT INTO `teacher` VALUES ('13', '張三', '1013', '000000', null, null, null, null, null, null, null, '1', null, null, null, null);
INSERT INTO `teacher` VALUES ('14', '周瑜', '1014', '000000', null, '2019-04-12 00:00:00', null, null, null, null, null, '1', null, '2019-04-12 10:00:15', null, '1');
INSERT INTO `teacher` VALUES ('15', '徐孟偉', '1015', '000000', null, '2010-06-12 00:00:00', null, null, null, null, null, '1', null, '2019-04-12 10:08:08', null, '2');
INSERT INTO `teacher` VALUES ('16', '任鑫', '1016', '000000', null, '2000-07-12 00:00:00', null, null, null, null, null, '1', null, '2019-04-12 10:09:17', null, '3');
INSERT INTO `teacher` VALUES ('17', 'AAA', '1017', '000000', null, '2019-04-12 00:00:00', null, null, null, null, null, '1', null, '2019-04-12 10:09:54', null, '1');
INSERT INTO `teacher` VALUES ('18', '庫(kù)遠(yuǎn)遠(yuǎn)', '1018', '000000', null, '2010-02-03 00:00:00', null, null, null, null, null, '0', null, '2019-04-12 10:12:13', null, '3');
INSERT INTO `teacher` VALUES ('19', '張三', null, null, null, null, null, null, null, null, null, null, null, null, null, null);
INSERT INTO `teacher` VALUES ('20', '王萍', '10020', '0000', null, '2019-04-12 00:00:00', null, null, null, null, null, '1', null, '2019-04-12 14:03:35', null, '3');
INSERT INTO `teacher` VALUES ('22', '趙培勇', null, null, null, '1994-06-16 00:00:00', null, null, null, null, null, '0', null, '2019-04-16 14:41:55', null, '3');
INSERT INTO `teacher` VALUES ('23', '劉新勇', '23', '0000', null, '2019-04-27 00:00:00', null, null, null, null, null, '0', null, '2019-04-27 14:23:07', null, '3');
INSERT INTO `teacher` VALUES ('24', '劉新勇', '24', '0000', null, '2019-04-27 00:00:00', null, null, null, null, null, '0', null, '2019-04-27 14:23:10', null, '3');
-- ----------------------------
-- Table structure for teachertype
-- ----------------------------
DROP TABLE IF EXISTS `teachertype`;
CREATE TABLE `teachertype` (
`typeId` int(11) NOT NULL AUTO_INCREMENT,
`typeName` varchar(30) DEFAULT NULL,
`memo` varchar(100) DEFAULT NULL,
PRIMARY KEY (`typeId`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of teachertype
-- ----------------------------
INSERT INTO `teachertype` VALUES ('1', '教員', '');
INSERT INTO `teachertype` VALUES ('2', '班主任', '負(fù)責(zé)管理');
INSERT INTO `teachertype` VALUES ('3', '宿管', '管理寢室');
INSERT INTO `teachertype` VALUES ('6', '校長(zhǎng)', '厲害極了!');
INSERT INTO `teachertype` VALUES ('7', '教導(dǎo)主任', '訓(xùn)話,請(qǐng)家長(zhǎng),開除');
INSERT INTO `teachertype` VALUES ('10', '副校長(zhǎng)', '');
INSERT INTO `teachertype` VALUES ('12', '副校長(zhǎng)', '');
INSERT INTO `teachertype` VALUES ('13', '副校長(zhǎng)', '');
-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`tid` int(11) DEFAULT NULL,
`sid` int(11) DEFAULT NULL,
PRIMARY KEY (`uid`),
KEY `tid` (`tid`),
KEY `sid` (`sid`),
CONSTRAINT `users_ibfk_1` FOREIGN KEY (`tid`) REFERENCES `teacher` (`teachId`),
CONSTRAINT `users_ibfk_2` FOREIGN KEY (`sid`) REFERENCES `student` (`stuId`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of users
-- ----------------------------
INSERT INTO `users` VALUES ('1', '1', '1');
-- ----------------------------
-- Table structure for user_role
-- ----------------------------
DROP TABLE IF EXISTS `user_role`;
CREATE TABLE `user_role` (
`uid` int(11) DEFAULT NULL,
`rid` int(11) DEFAULT NULL,
KEY `uid` (`uid`),
KEY `rid` (`rid`),
CONSTRAINT `user_role_ibfk_1` FOREIGN KEY (`uid`) REFERENCES `users` (`uid`),
CONSTRAINT `user_role_ibfk_2` FOREIGN KEY (`rid`) REFERENCES `role` (`rid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of user_role
-- ----------------------------
以上就是C#建立宿舍管理系統(tǒng)數(shù)據(jù)庫(kù)的代碼展示,詳細(xì)使用情況還得要大家自己使用過才能知道具體要領(lǐng)。如果想閱讀更多相關(guān)內(nèi)容的文章,歡迎關(guān)注億速云行業(yè)資訊頻道!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。