题目
步骤
创建数据库
create database mydb6_product; #创建数据库
use mydb6_product; #使用数据库
创建表
employees表
create table `employees`(id int primary key,-> name varchar(50) not null,-> age int,-> gender varchar(10) not null default"unknown",-> salary float);
orders 表
create table `orders`(id int primary key,-> name varchar(100) not null,-> price float,-> quantity int,-> category varchar(50));
invoices表
create table invoices(id int primary key auto_increment,-> order_id int,-> in_date date,-> total_amount float,-> foreign key (order_id) references orders(id),-> check(total_amount>0));