1、跨库表操作:将shiro库dept表的数据复制到activiti库的mydept表中
INSERT INTO activiti.mydept (NAME,parent_id,weight) SELECT NAME,PARENT_ID,WEIGHT FROM shiro.dept
2、子查询例子:
select StuId, StuName, (Languages+Mathematics+English) Total,
round ( ( select avg(Languages+Mathematics+English) from student ), 0 ) Averages ,
round ( ((Languages+Mathematics+English) - (select avg(Languages+Mathematics+English) from student)) , 0)
Average from student
3、'a' 与 "a" 的区别:
'a'表示基本数据类型char类型变量;"a"表示字符串对象。对基本数据类型进行比较可以使用符号"==",对字符串进行比较则需要使用equals()方法。
4、聚合查询:
select StuName, Class, Native from tb_stuone
union all
select StuName, Class, Native from tb_stutwo
union all:不删除重复行,也不对行自动排序,这种模式需要的计算资源少,尤其是处理大型表时。