insert into orders(customer_id,order_date,status)
values(1,'2019-01-02',1);
-- 插入一条新数据
select last_insert_id();
-- 获取新订单的id
insert into order_items
values(last_insert_id(),1,1,2.96);
-- 插入新订单的数据
create table invoices_archeives
select i.invoice_id,i.number,c.name as client,invoice_date from invoices i
left join clients c on c.client_id = i.client_id
where i.payment_date is not null;
-- 创建表复制:从一张表复制数据到另外一张表
感谢各位读者查阅,欢迎各位点赞✍评论⭐收藏+关注!