mysql -h host -u user -p password
create database test;
drop database test;
create table xxx();
drop table xxx;
比如在where字句中,若想要区分大小写,则需要使用binary关键字表示区分大小写。
select->where->group by->having->order by
update xxx set xx= replace(xxx, fromStr, toStr) where clause;
在mysql中,NULL值与任何其它值的比较都是false。mysql中处理NULL需要使用 is null 和 is not null。
like字句:select * from test where uu like ‘%aaa%‘; 查找uu字段中含有aaa的的记录。
select * from test where uu like ‘%aaa‘; 查找uu字段中以aaa结尾的数据记录。
select * from test where uu like ‘aaa%‘; 查找uu字段中以aaa开头的数据记录。
select * from test where uu like ‘_o_‘; 查找uu字段中第二个字符是o的数据记录。
regexp:select * from test where uu regexp ‘^[aeiou]|haha$‘; 查找uu字段中以元音字符开头或者以haha结尾的记录。
原文:https://www.cnblogs.com/mydesky2012/p/11448925.html