mysql

select * from bbs where artical like '[ALM]%';以ALM开头

[charlist][!charlist] ;

 

select * from bbs where artical in(book,image);

in 允许选多个

 

 select * from bbs where artical between 'book' and 'image';

在book 和image之间的所有行,mysql包括book和image;

 

select title as t from bbs;

将t作为title的别名;

 

select * from bbs,party where bbs,b_username=party,p_username;

多表查询;

 

select * from bbs inner join party on b_username=party.p_username;

内联

(inner) join:至少一个匹配,返回行。

left join:右边不匹配,返回左行。

right join:左边不匹配,返回右行。

full join: 只要有一个匹配,返回行。mysql不支持;

 

union 和 union all 两个表必须有相同的列,相同的数据类型,列的顺序也相同;union all 会列出所有的值,union只会列出不同的值

select name from E_China union select name from E_America;

 

 having 用来弥补where 的不足,where不能和合计函数一起用,例如group by

select customer sum(money) from order group by customer having sum(money)>2;

 

ucase()变为大写 lcase()变小写

select * from ucase(lastname) from name;

 

mid()从文本中提取字符

select mid(week,3)  from date;

 

len()函数返回文本字段的程度;

slect len(content) from message;

 

round()把数值字段舍入为制定位数的小数;

select round(price,0) from book;

 

format制定的字段进行格式化

select format(now(),'YYYY-MM-DD') as date from message;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值