Staredit Network > Forums > Technology & Computers > Topic: Database Help (mySQL)
Database Help (mySQL)
Nov 7 2008, 1:33 am
By: KilaByte  

Nov 7 2008, 1:33 am KilaByte Post #1



I'm in a database management class at college and I'm on my final question but I'm having some trouble.

The problem is:
How many films were rented each month during 2005?

This is on a pre-made database for a film rental store.
I can get SQL to print out the dates and how many movies were rented each day. But how do I group those dates by month?
I.E. Instead of getting

Quote
Rental Date
Films Rented

5/24/2005
8

5/28/2005
30

5/30/2005
45

I want it to appear like this

Quote
Rental Month
Films Rented

5
83

How can I group dates like that?

My current SQL query.

Quote
SELECT rent_date AS 'Rental Date', COUNT(rent_date) AS 'Films Rented'
FROM rental
GROUP BY rent_date

rent_date in the table is the only information I can use as far as Dates go and they are listed by month/day/year.
I counted rent_date because the date is repeated in the table for every time a movie was rented.

I would prefer to display '5' as May and '6' as June but its not required.

(This may be easy for some of you but I'm fairly new to databases so bear with me)



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[09:16 am]
NimoStar -- ever wanted to play melee in installation tileset? Now you can https://staredit.net/topic/18929/
[02:29 am]
Symmetry -- TFW you google a problem and find the answer in a post you made yourself
[01:46 am]
Oh_Man -- How can i change my name here to put [TFE] on the end will thr website let me
[2026-9-10. : 6:02 pm]
Zoan -- of course it isn't full understanding. You could ask "is the mechanism by which this counterexample blows up the ONLY mechanism possible for an initial configuration to blow up?"
[2026-9-10. : 5:48 pm]
Zoan -- ppl do it all the time in PDEs
[2026-9-10. : 5:47 pm]
Zoan -- Heinermann
Heinermann shouted: it also didn't solve that problem but hey as long as the investors are pleased
Constructing a counterexample is answering the question: "Is Navier Stokes well posed?" in the negative
[2026-9-10. : 5:44 pm]
NudeRaider -- I only heard about it, didn't any news article, so what did it do then?
[2026-9-10. : 5:43 pm]
Heinermann -- it also didn't solve that problem but hey as long as the investors are pleased
[2026-9-10. : 5:39 pm]
NudeRaider -- I have no idea tbh. All I know no human was ever able to solve it, but there's at least a few that beat portal ;)
[2026-9-10. : 5:32 pm]
Zoan -- Navier Stokes is not that esoteric I thought
Please log in to shout.


Members Online: Oh_Man