1.要求
2.步骤
1.创建数据库:
create database mydb6_product;
2.使用数据库:
use mydb6_product;
3.创建employees表:
create table employees(id int primary key,name varchar(50) not null, age int not null,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(number int primary key auto_increment,order_id int,in_date date,total_amount float,check(total_amount>0),foreign key(order_id) references orders(id));
4.创建成功后查看表:
show tables;
5.查看employees表结构
desc employees;
查看orders表结构:
查看invoices表结构: