If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > 5 Database Queries to go with an online purchasing system :-)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-02-06, 11:04
Philkills Philkills is offline
Registered User
 
Join Date: Nov 2006
Posts: 33
5 Database Queries to go with an online purchasing system :-)

Hi Guys,

I'm having trouble thinking of ideas for queries that would go with an online purchasing system. The queries must be partially complex (i.e. not just a simple insert query ).

I can easily write the queries myself but i just need a little help thinking of useful queries.

A query for an 'Invoice' for example is a perfect idea as it implements table joins etc.

Possible other queries are:
Find all customers that have spent a total of more than X amount
Find all delivery address's that X customer has sent items to
Track an order to see if items have been sent yet or not.
etc....

If anyone else can think of a few other ideas i'd be very grateful :-)

thx for reading :-)

--Philkills
Reply With Quote
  #2 (permalink)  
Old 12-02-06, 11:15
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
online purchasing sytem? or homework assignment?

total sales by category for the previous month
average price of backlogged orders (product not in stock)
most popular item (by quantity sold, not total price)
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 12-02-06, 11:23
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
easiest technique...
open a copy of Access, create yuour tables
create the realtionships
open up the query designer
add the required constraints....
run the query, prove it works
open up the query in SQL mode, copy and paste the SQL to your homework assignment paper
....jobsagoodun



... requires minimum thought and creativity, and absolutely no proof that you have understood the concepts behid joins, where clauses etc...
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #4 (permalink)  
Old 12-02-06, 11:33
Philkills Philkills is offline
Registered User
 
Join Date: Nov 2006
Posts: 33
Quote:
Originally Posted by r937
online purchasing sytem? or homework assignment?

total sales by category for the previous month
average price of backlogged orders (product not in stock)
most popular item (by quantity sold, not total price)
Some nice ideas there thx ^^


Quote:
Originally Posted by healdem
easiest technique...
open a copy of Access, create yuour tables
create the realtionships
open up the query designer
add the required constraints....
run the query, prove it works
open up the query in SQL mode, copy and paste the SQL to your homework assignment paper
....jobsagoodun



... requires minimum thought and creativity, and absolutely no proof that you have understood the concepts behid joins, where clauses etc...
and lol....

a nice way to cheat i suppose... but i do actually understand joins etc ;p
Reply With Quote
  #5 (permalink)  
Old 12-03-06, 08:10
Peter.Vanroose Peter.Vanroose is offline
Registered User
 
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
Quote:
Originally Posted by r937
total sales by category for the previous month
average price of backlogged orders (product not in stock)
most popular item (by quantity sold, not total price)
Variations on these:
- Total sales for all foregoing months
- Top ten most popular items
- Most popular category per client (useful for better direct advertising ;-)
- Top ten clients in terms of the amount spent
- Same question, but now in 12 columns, for each of the last 12 months
__________________
--_Peter Vanroose,
__IBM Certified Database Administrator, DB2 9 for z/OS
__IBM Certified Application Developer
__ABIS Training and Consulting
__http://www.abis.be/
Reply With Quote
  #6 (permalink)  
Old 12-04-06, 09:35
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,455
Lightbulb



- Customer's year to date sales (purchases) compared with last year's year to date sales (purchases).

__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On