mysql
1 将一张表中的数据复制到另一张表中 (一张表更新另一张表)
2 将一张表中的数据复制到另一张表中(完全复制)
insert into table1 select * from table2
3 有则更新,无则插入
REPLACE salay1(menuId,salay) values("44","dd")
4 多个字段进行拼接
update hyz set date_proofNo = concat(date,'_',proofNo)
5 将一个String类型转换为日期进行比较
select * from test 2
where str_to_date(date,'%m/%d/%y') between str_to_date('02/03/2015','%m/%d/%y'))
and str_to_date('03/31/2015','%m/%d/%y')
6 分页查询 (从第10个开发,20条数据)
select * from test
order by id asc
1 将一张表中的数据复制到另一张表中 (一张表更新另一张表)
update class c ,salay s set c.salay = s.salay where c.menuId = s.menuId
update class c ,salay s set c.salay = s.salay ,c.name=s.name where c.menuId = s.menuId
2 将一张表中的数据复制到另一张表中(完全复制)
insert into table1 select * from table2
3 有则更新,无则插入
REPLACE salay1(menuId,salay) values("44","dd")
4 多个字段进行拼接
update hyz set date_proofNo = concat(date,'_',proofNo)
5 将一个String类型转换为日期进行比较
select * from test 2
where str_to_date(date,'%m/%d/%y') between str_to_date('02/03/2015','%m/%d/%y'))
and str_to_date('03/31/2015','%m/%d/%y')
6 分页查询 (从第10个开发,20条数据)
select * from test
order by id asc
limit 10,20
7 mysql 远程授权
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
8 查询全部都合格的学生姓名
select name from student GROUP BY name HAVING min(grade)>= 60; //grade 分数