Mysql的常用语句
-- 创建表 create table tableName( id int primary key, name varchar(20) ) -- 查询 select * from tableName -- 查询并排序(降序,升序是asc) select * from tableName order by desc -- 分组查询 (根据姓名分组) select name,count(*) from tableName group by name -- 分组查询 (根据姓名分组) 分组后再查询 select name,count(*) from tableName group by name having name = "张三" -- 模糊查询 查询姓名中含有张的 select * from tableName where name like '%张%' -- 修改 update tableName set name = ? where id = ? --删除 delete from tableName
-- 分页查询
select * from tableName limit 0,10