>SQL> select min(all sal) from gao.table3; 666 667 MIN(ALLSAL) 668 ----------- 669 1111.11 670 671 672 63.STDDEV(distinct|all) 673 求标准差,ALL表示对所有的值求标准差,DISTINCT表示只对不同的值求标准差 674 SQL> select stddev(sal) from scott.emp; 675 676 STDDEV(SAL) 677 ----------- 678 1182.5032 679 680 SQL> select stddev(distinct sal) from scott.emp; 681 682 STDDEV(DISTINCTSAL) 683 ------------------- 684 1229.951 685 686 687 688 64.VARIANCE(DISTINCT|ALL) 689 求协方差 690 691 SQL> select variance(sal) from scott.emp; 692 693 VARIANCE(SAL) 694 ------------- 695 1398313.9 696 697 698 65.GROUP BY 699 主要用来对一组数进行统计 700 SQL> select deptno,count(*),sum(sal) from scott.emp group by deptno; 701 702 DEPTNO COUNT(*) SUM(SAL) 703 --------- --------- --------- 704 10 3 8750 705 20 5 10875 706 30 6 9400 707 708 709 710 66.HAVING 711 对分组统计再加限制条件 712 SQL> select deptno,count(*),sum(sal) from scott.emp group by deptno having count(*)>=5; 713 714 DEPTNO COUNT(*) SUM(SAL) 715 --------- --------- --------- 716 20 5 10875 717 30 6 9400 718 SQL> select deptno,count(*),sum(sal) from scott.emp having count(*)>=5 group by deptno ; 719 720 DEPTNO COUNT(*) SUM(SAL) 721 --------- --------- --------- 722 20 5 10875 723 30 6 9400 724 725 726 67.ORDER BY 727 用于对查询到的结果进行排序输出 728 SQL> select deptno,ename,sal from scott.emp order by deptno,sal desc; 729 730 DEPTNO ENAME SAL 731 --------- ---------- --------- 732 10 KING 5000 733 10 CLARK 2450 734 10 MILLER 1300 735 20 SCOTT 3000 736 20 FORD 3000 737 20 JONES 2975 738 20 ADAMS 1100 739 上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 下一页 |