Saturday, July 10, 2010

How do i create a database for a game rental shop? ...?

Ive got three tables (members,loans and stock)


in the loans table ive got the columns DATE TAKEN and DATE DUE BACK. How could i calculate overdue games? would it be a query or a table and what would the formula be?


Thanks for the help





btw its on microsoft access 03 :)How do i create a database for a game rental shop? ...?
I would do this with a query. Unfortunately, I work directly with the SQL language and not the Access GUI, so I'd suggest this:





select stock.*


from stock inner join loans


on stock.id = loans.stockId


where loans.dateDueBack %26lt; getDate()


and stock.isAvailable = true





I'm guessing that you have ID's for your stock items that you would have showing up in your loans table.





Here's how I'd set up these tables:





Table: Members


- id (int)


- first name (text)


- last name (text)


- any other info.. address, whatever





Table: Loans


- id (int)


- stockId (int)


- dateRented (datetime)


- dateDueBack (datetime)





Table: Stock


- id (int)


- description (text)


- isAvailable (boolean)





I hope that helps!

No comments:

Post a Comment