logo头像

博学广问,自律静思

SSD8_Ex3【JAVA_RMI】(4)会议数据库建表

为了更好管理会议和更好更有效率执行删除、添加、查询等操作,本次SSD8_Ex3【JAVA_RMI】,极客人结合数据库系统知识,决定采用数据库来管理会议。因为这次练习的各个题目都是典型的数据库题,虽然它被放在了网络与分布式计算课程上。

系列文章链接:

SSD8_Ex3【JAVA_RMI服务】(1)概述RMI和网络API

SSD8_Ex3【JAVA_RMI】(2)远程接口声明

SSD8_Ex3【JAVA_RMI】(3)开启RMI服务

SSD8_Ex3【JAVA_RMI】(4)会议数据库建表

SSD8_Ex3【JAVA_RMI】(5)数据库连接和会议方法定义

SSD8_Ex3【JAVA_RMI】(6)制作命令行导航菜单

 

会议数据库rmimeeting建表

  • 数据库名:rmimeeting
  • 建表三项:users(用户),meeting(会议),meetingrecord(会议记录)

rmimeetingER图

rmimeetingER图 rmimeetingER图

建表语句

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for meeting
-- ----------------------------
DROP TABLE IF EXISTS `meeting`;
CREATE TABLE `meeting` (
`meetingId` int(11) NOT NULL AUTO_INCREMENT,
`founderUserName` varchar(255) NOT NULL,
`startTime` datetime NOT NULL,
`endTime` datetime NOT NULL,
`meetingTitle` varchar(255) NOT NULL,
PRIMARY KEY (`meetingId`),
KEY `fk_meeting_users_1` (`founderUserName`),
CONSTRAINT `fk_meeting_users_1` FOREIGN KEY (`founderUserName`) REFERENCES `users` (`userName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of meeting
-- ----------------------------

-- ----------------------------
-- Table structure for meetingrecord
-- ----------------------------
DROP TABLE IF EXISTS `meetingrecord`;
CREATE TABLE `meetingrecord` (
`recordId` int(11) NOT NULL AUTO_INCREMENT,
`meetingId` int(11) DEFAULT NULL,
`userName` varchar(255) DEFAULT NULL,
PRIMARY KEY (`recordId`),
KEY `fk_meetingRecord_meeting_1` (`meetingId`),
KEY `fk_meetingRecord_users_1` (`userName`),
CONSTRAINT `fk_meetingRecord_meeting_1` FOREIGN KEY (`meetingId`) REFERENCES `meeting` (`meetingId`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `fk_meetingRecord_users_1` FOREIGN KEY (`userName`) REFERENCES `users` (`userName`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of meetingrecord
-- ----------------------------

-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`userName` varchar(255) NOT NULL,
`userPassword` varchar(255) NOT NULL,
PRIMARY KEY (`userName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of users
-- ----------------------------
INSERT INTO `users` VALUES (‘2013303394’, ‘123456’);