sqldatabasecounttable-functions

Stuck at table function


Dept_No (Int)
Dept_Name (Char(30))

and using the following database:

EMPLOYEE (fmane, minit, lname, ssn, birthdate, address, sex, salary, superssn, dno)     KEY: ssn
DEPARTMENT (dname, dnumber, mgrssn, mgrstartdate)               KEY: dnumber.
PROJECT  (pname, pnumber, plocation, dnum)                          KEY: pnumber.

I'm stuck at right now, want give me some advice on starting it? really don't know where to start


Solution

  • Select e.Dept_No, d.Dept_Name, Count(e.Dept_No), 
    SUM(e.salary) as Sum_Salary,
    AVG(e.salary)  as AVE_Salary
    from EMPLOYEE e
    join DEPARTMENT d ON e.dno = d.dnumber
    Group by e.Dept_No, d.Dept_Name