检查一下SQL代码有没有错误,有的话标识出来并且改错:SET FOREIGN_KEY_CHECKS = 0; DROP TABLE IF EXISTS employee_info; CREATE TABLE employee_info ( e_id int(0) NOT NULL COMMENT '工作人员编号', e_name varchar(50) NOT NULL COMMENT '工作人员姓名', m_id int(0) NOT NULL COMMENT '管理员编号', PRIMARY KEY (e_id) USING BTREE, INDEX m_id(m_id) USING BTREE, CONSTRAINT m_id FOREIGN KEY (m_id) REFERENCES hotel_manager_info (m_id) ON DELETE CASCADE ON UPDATE CASCADE ) ; DROP TABLE IF EXISTS hotel_info; CREATE TABLE hotel_info ( h_id int(0) NOT NULL COMMENT '酒店序号', h_name varchar(25) NOT NULL COMMENT '酒店名称', h_address varchar(255) NOT NULL COMMENT '酒店地址', h_phone varchar(50) NOT NULL COMMENT '酒店电话', o_statistics int(0) NULL DEFAULT NULL COMMENT '统计订单量', PRIMARY KEY (h_id) USING BTREE ) ; DROP TABLE IF EXISTS hotel_manager_info; CREATE TABLE hotel_manager_info ( m_id int(0) NOT NULL COMMENT '管理员编号', m_name varchar(50) NOT NULL COMMENT '管理员姓名', h_id int(0) NULL DEFAULT NULL COMMENT '酒店序号', PRIMARY KEY (m_id) USING BTREE, INDEX hotel_id(h_id) USING BTREE, CONSTRAINT hotel_id FOREIGN KEY (h_id) REFERENCES hotel_info (h_id) ON DELETE CASCADE ON UPDATE CASCADE ) ; DROP TABLE IF EXISTS order_info; CREATE TABLE order_info ( o_id int(0) NOT NULL COMMENT '订单编号', r_id int(0) NOT NULL COMMENT '房间号', u_id int(0) NOT NULL COMMENT '用户id', o_checkin_time datetime(0) NULL DEFAULT NULL COMMENT '入住时间', o_checkout_time datetime(0) NOT NULL COMMENT '离开时间', o_status enum('not null',"null") NULL DEFAULT NULL COMMENT '为null 时表示未入住', PRIMARY KEY (o_id) USING BTREE, INDEX r_id(r_id) USING BTREE, INDEX u_id(u_id) USING BTREE, CONSTRAINT r_id FOREIGN KEY (r_id) REFERENCES room_info (r_id) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT u_id FOREIGN KEY (u_id) REFERENCES user_info (u_id) ON DELETE CASCADE ON UPDATE CASCADE ) ; DROP TABLE IF EXISTS room_info; CREATE TABLE room_info ( r_id int(0) NOT NULL COMMENT '房间号', r_name varchar(50) NOT NULL COMMENT '房间名称', r_type varchar(50) NOT NULL COMMENT '房间类型', r_price varchar(50) NULL DEFAULT NULL COMMENT '房间价格', h_id int(0) NOT NULL COMMENT '酒店序号', PRIMARY KEY (r_id) USING BTREE, INDEX h_id(h_id) USING BTREE, CONSTRAINT h_id FOREIGN KEY (h_id) REFERENCES hotel_info (h_id) ON DELETE CASCADE ON UPDATE CASCADE ) ; DROP TABLE IF EXISTS user_info; CREATE TABLE user_info ( u_id int(0) NOT NULL COMMENT '用户编号', u_name varchar(50) NOT NULL COMMENT '用户名', u_password varchar(50) NOT NULL COMMENT '密码', u_phone varchar(50) NULL DEFAULT NULL COMMENT '手机号码', u_email varchar(50) NULL DEFAULT NULL COMMENT '邮箱', u_register_time datetime(0) NULL DEFAULT NULL COMMENT '注册时间', PRIMARY KEY (u_id) USING BTREE ) ; SET FOREIGN_KEY_CHECKS = 1;
时间: 2024-04-02 19:31:52 浏览: 89
rdb.rar_if
在以下语句中,'not null' 应该改为 'not_null':
o_status enum('not_null',"null") NULL DEFAULT NULL COMMENT '为null 时表示未入住'
应该改为:
o_status enum('not_null','null') NULL DEFAULT NULL COMMENT '为null时表示未入住'
阅读全文