文件名称:hql查询语句
文件大小:47KB
文件格式:DOC
更新时间:2016-05-02 14:04:28
hibernate hql
3.统计函数查询: 1: count() 统计记录的条数 2: min() 求最小值 3: max() 求最大值 4: sum() 求和 4: avg() 求平均值 //取得Student的数量 Query query=session.createQuery("select count(*) from Student") //avg()取得Student平均年龄 Query query=session.createQuery("select avg(s.age) from Student as s") //upper()方法将字符串转为大写 Query query=session.createQuery("select upper(s.name) from Student as s") //去除重复行distinct Query query=session.createQuery("select distinct s.age from Student as s") select count(*) from Person select max(p.age) from Person as p select p.name || "" || p.address from Person as p