On 9/16/11, Always Learning centos@u61.u22.net wrote:
C1
c1ref c1customer (code) c1quantity (integers only) c1price (in cents) c1discount (2 decimal places held as integers) c1catalogue (code) c1date (yymmdd) c1order (number) c1comments (text)
then do a query:
select c1quantity, c1price, c1discount from c1 where c1customer = 'joebloggs' and c1date like '10%'
Isn't it bad practise to store customer reference by name? What happens if we want to look up a customer called John Smith and there are say a dozen of them?
I would at the very least have a separate table holding core customer information with an auto-incremented ID so that customers with the same name won't cause a problem. Of course, that would mean requiring a join on the query, or at the very least two queries with one pulling the customer ID first. Although since the base customer ID table is usually a frequently accessed but not changed table, it's likely to be in memory and therefore faster to issue a join, which the dbms should handle smartly enough than to separate queries.