RE: Query writing
Date: Thu, 19 Dec 2013 17:13:44 -0500
Message-ID: <029f01cefd07$95819920$c084cb60$_at_rsiz.com>
I would like to point out that I can only think of fraudulent purposes to report retail turns leaving out net credit days. You do not get to leave out "returns day" on a key component of valuing the worth of a retail establishment.
Also, since he didn't spec out SQL, I'm surprised someone hasn't submitted a perl solution to the second one yet.
From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org]
On Behalf Of David Fitzjarrell
Sent: Thursday, December 19, 2013 12:22 PM
To: niall.litchfield_at_gmail.com; oracle-l
Subject: Re: Query writing
That's cheap. I was expecting more like 25,000 hours. :)
David Fitzjarrell
On Thursday, December 19, 2013 10:16 AM, Niall Litchfield
<niall.litchfield_at_gmail.com> wrote:
I''ll do it for $25 per hour (admittedly you might find it takes me 5000 hours to do it :) )
On Thu, Dec 19, 2013 at 4:50 PM, Walker, Jed S
<Jed_Walker_at_cable.comcast.com> wrote:
What is the rate per hour?
From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org]
On Behalf Of Arif Gulzar
Sent: Wednesday, December 18, 2013 1:47 PM
To: oracle-l
Subject: Query writing
Please forward me following 2 quires. Thanks in advance.
Q1: Given the following table of transactions in a cash register:
id| trade_time | amount
- ---------------- ------
1| 06/16/2013 11:43| 52.00
2| 06/16/2013 11:50| 142.74
3| 06/16/2013 14:21| -43.89
4| 06/17/2013 12:50| 36.85
5| 06/17/2013 13:40|-523.58
please write a query which selects net daily turnovers (arithmetical sums of all transactions for a day) for all days when these turnovers are positive.
Q2: Given the following two tables:
clients (id (PK), name)
transactions (id (PK), client_id, trans_date, debit, credit, comment)
transactions.client_id references clients.id <http://clients.id/>
please write a query which selects the balance for ALL clients, even if they have no transactions. (Assume initial balances to be zeros).
Sample table contents:
clients:
id name
- ------
1 John
2 Mary
3 Alex
transactions:
id client_id trans_date debit credit comment
- --------- ---------- ------- ------- -----------------
1 | 1 06/16/2013 NULL 1000.00 SALARY 2 | 1 06/18/2013 516.43 0.00 MOB PHONE PAYMENT 3 | 2 06/16/2013 NULL 1000.00 SALARY 4 | 2 06/18/2013 200.00 NULL INTERNET PAYMENT 5 | 2 06/18/2013 500.00 0.00 MOB PHONE PAYMENT
-- Niall Litchfield Oracle DBA http://www.orawin.info/ -- http://www.freelists.org/webpage/oracle-lReceived on Thu Dec 19 2013 - 23:13:44 CET