【正文】
==錯誤案例select deptno, ename, avg(sal)from emp group by deptno /select d from emp group by a, b, c 求各部門每個工種的平均薪水, 并顯示部門編號、工種、平均薪水select deptno, job, avg(sal)from emp group by deptno, job先按deptno、job分組,出來n組數據,在這個基礎之上,再進行計算求各部門每個工種大于2000的薪水 select sal from emp where sal200041 求各部門每個工種,平均薪水大于2000的薪水select deptno, job, avg(sal)from emp group by deptno, job having avg(sal)2000 求10號部門的平均工資(2種寫法)select deptno, avg(sal)from emp where deptno=10 group by deptnoselect deptno, avg(sal)from emp group by deptno having deptno = 10 創(chuàng)建一個學生表sid sname sex age 7 并向表中插入一條數據create table student(sid number, sname varchar2(20), varchar2(64), sex number,age number)insert into student(sid, sname, , sex, age)values(1, 39。日期的數學運算日期函數轉換函數隱式數據類型轉換顯式數據類型轉換第三篇:黑馬程序員c語言教程:SQL函數(7)什么是分組函數組函數類型組函數語法AVG(平均值)和 SUM(合計)函數MIN(最小值)和 MAX(最大值)函數COUNT(計數)函數DISTINCT(distinct)關鍵字組函數與空值在組函數中使用NVL函數第四篇:黑馬程序員c語言教程:sql語言課堂強化sql語言課堂強化 select a, b, c select.....(多個列)from.....一個表(多個表)where....(條件)group by...(分組)難點 having......(分組過濾)ord