by Dr Mike Lance >> Mon, 10 Sep 2001 22:25:37 GMT
I teach Jade at Christchurch Polytechnic Institute of Technology.
One of the joys of being an academic is being able to 'play' with technology.
One of the down-sides is the concern that what gets taught is just play and not related to industry realities.
I've recently been pondering how best to write ad hoc queries in Jade.
In database courses a heavy emphasis is placed on using SQL for reporting purposes.
I am aware that many database administrators end up spending a lot of time optimising queries to run on large data sets. Jade is a database wrapped up in a programming environment, but is it used like SQL is? Does anybody send time and effort in Jade writing ad hoc queries for reporting?
The following is an exercise I've adapted from a database course.
There are Customers.
Customers have a credit limit.
Customers make Orders.
Orders have a date, an amount and an isPaid boolean field.
Assorted queries are required to be made on this data..
ie
How may Customers have orders which have not been payed?
What is the total of unpaid orders for each customer?
How many customers have unpaid orders of more than $xxx?
Which customers have ordered and payed for more than $xxx in the last yyy days?
One way of implementing these queries is to start adding calc methods to Customer and constructing external key directories. The use of public properties or accessor / get methods for every property makes things easier.
I am concerned that this type of approach quickly 'pollutes' the system with very specialised query methods. (My fictitious client can always think of a new query variant.)
Is there a smarter way of dealing with ad hoc queries?
- Mike Lance