Join and GROUP BY : Table Join Column « Table Joins « Oracle PL / SQL






Join and GROUP BY

   

create table ord(
         order_no               integer          primary key
        ,order_date             date not null
        ,emp_no                 number(3,0)
);



create table department(
        dept_no                 integer      primary key
       ,dept_name               varchar(20)  not null
);

create table employee(
         emp_no                 integer         primary key
        ,lastname               varchar2(20)    not null
        ,dept_no                integer     
);

select d.dept_name,
       e.lastname AS sales_name,
       o.order_date,
       count(*)
from department d, employee e, ord o
where d.dept_no = e.dept_no
  and e.emp_no = o.emp_no
group by d.dept_name, e.lastname, o.order_date;


drop table ord;
drop table employee;
drop table department;

   
    
  








Related examples in the same category

1.Join two tables: column is not mentioned in the SELECT list
2.Join with (+)
3.Use in operator with table join
4.Use column name alias during table join
5.3-Way join
6.Join three table to find out which employee sold that gift
7.Join using and join on
8.Join using clause
9.Join columns with full table name reference