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

Home
Oracle PL / SQL
1.Aggregate Functions
2.Analytical Functions
3.Char Functions
4.Constraints
5.Conversion Functions
6.Cursor
7.Data Type
8.Date Timezone
9.Hierarchical Query
10.Index
11.Insert Delete Update
12.Large Objects
13.Numeric Math Functions
14.Object Oriented Database
15.PL SQL
16.Regular Expressions
17.Report Column Page
18.Result Set
19.Select Query
20.Sequence
21.SQL Plus
22.Stored Procedure Function
23.Subquery
24.System Packages
25.System Tables Views
26.Table
27.Table Joins
28.Trigger
29.User Previliege
30.View
31.XML
Oracle PL / SQL » Table Joins » Table Join Column 
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
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.