break on cust_id
select c.cust_id
,c.name
,o.order_id
,o.order_date
,decode(o.order_date
,f.min_date,'First-time Customer'
,'Returning Customer') Customer_Status
from orders o
,customers c
,(select c2.cust_id,min(order_date) min_date
from orders o2
,customers c2
where o2.cust_id = c2.cust_id
group by c2.cust_id) F
where o.cust_id = c.cust_id
and o.cust_id = f.cust_id
order by cust_id,order_date
/
CUST_ID NAME ORDER_ID ORDER_DATE CUSTOMER_STATUS
-------- -------------------------- ---------- --------------- -------------------
201 Unisports 97 28-AUG-92 First-time Customer
202 OJ Atheletics 98 31-AUG-92 First-time Customer
203 Delhi Sports 99 31-AUG-92 First-time Customer
204 Womansport 100 31-AUG-92 First-time Customer
Womansport 111 09-SEP-92 Returning Customer
205 Kam's Sporting Goods 101 31-AUG-92 First-time Customer
206 Sportique 102 01-SEP-92 First-time Customer
208 Muench Sports 103 02-SEP-92 First-time Customer
Muench Sports 104 03-SEP-92 Returning Customer
209 Beisbol Si! 105 04-SEP-92 First-time Customer
210 Futbol Sonora 112 31-AUG-92 First-time Customer
Futbol Sonora 106 07-SEP-92 Returning Customer
211 Kuhn's Sports 107 07-SEP-92 First-time Customer
212 Hamada Sport 108 07-SEP-92 First-time Customer
213 Big John's Sports Emporium 109 08-SEP-92 First-time Customer
214 Ojibway Retail 110 09-SEP-92 First-time Customer
16 rows selected.