Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Odp: Tricky SQL

Odp: Tricky SQL

From: Marek Jó¼wik <mjozwik_at_wonlok.com.pl>
Date: Thu, 23 Nov 2000 07:25:01 +0100
Message-ID: <8vid8i$pr6$1@kujawiak.man.lodz.pl>

> table employee:
> employeeid(PK), name, companyid(FK)
>
> table company:
> companyid(PK) , name
>
> table department:
> departmentid(PK) , name, companyid(FK)
>
> · Write a query to list all the department names from all
> companies that (the companies) have more than 25 employees and that
> (the company) have a name that starts with an 'A'.
>

select d.name
from department d, company c
where d.companyid = c.companyid and
substr(c.name, 1, 1) = 'A' and
25 < (select count(*) from employee e where e.companyid = c.companyid); Received on Thu Nov 23 2000 - 00:25:01 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US