建立数据库
mysql> create database mydb6_product;
mysql> show databases;
mysql> use mydb6_product;
mysql> select mydb6_product();
mysql> use mydb6_product;
建立employees表
mysql> create table employees(id int primary key, name varchar(50) not null, age int
unsigned, gender varchar(10) not null default 'unknown');
mysql> desc employess;
建立orders表
mysql> create table orders(id int primary key, name varchar(100) not null, price float,
quantity int, category varchar(50));
mysql> desc orders;
建立invoices表
mysql> 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));