MySQL必备指令集

列中仅选取唯一不同的值(DISTINCT )
select DISTINCT (tool_sub_type) from table where tool_type = 1 ;
三表联查(and)
select * from table_1 t1 ,table_2 t2,table_3 t3 
	where t1.store_id = t2.id and t2.company_id=t3.id;
三表联查(left join)
select* from table_1 t1
	LEFT JOIN table_2 t2 on t1.store_id = t2.id
	LEFT JOIN table_3 t3 on t2.company_id = t3.id
从a表迁移部分数据到b表
update t_a a set 
a.seller_id =(select seller_id  from customer_file b where b.id=a.customer_id ), 
a.seller_name =(select name from customer_file b where b.id=a.customer_id ),
a.gmt_modified =now();
更新语句:
update table SET tool_sub_type =9 where id = 2;
插入语句
insert into table(gmt_create,gmt_modified,parent_id,sub_name) value(now(),now(),1,"子类目");
不为空SQL IS NOT NULL
选取在 "Address" 列中不带有 NULL 值的记录呢?
SELECT LastName,FirstName,Address FROM Persons
WHERE Address IS NOT NULL
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值