mysql 第一次作业
employees:
代码: CREATE TABLE `employees` (
`id` int NOT NULL,
`name` varchar(50) NOT NULL,
`age` int DEFAULT NULL,
`gender` varchar(10) NOT NULL DEFAULT 'unknown',
`salary` float DEFAULT NULL,
PRIMARY KEY (`id`)
);invoices:
代码: CREATE TABLE `invoices` (
`number` int NOT NULL AUTO_INCREMENT,
`order_id` int DEFAULT NULL,
`in_date` date DEFAULT NULL,
`total_amount` float DEFAULT NULL,
PRIMARY KEY (`number`),
KEY `order_id` (`order_id`),
CONSTRAINT `invoices_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`),
CONSTRAINT `invoices_chk_1` CHECK ((`total_amount` > 0))
);
orders:
代码: orders | CREATE TABLE `orders` (
`id` int NOT NULL,
`name` varchar(100) NOT NULL,
`price` float DEFAULT NULL,
`quantity` int DEFAULT NULL,
`category` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
);
原文地址:https://blog.csdn.net/2201_75988692/article/details/140501752
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!