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.
[05:47 pm]
NimoStar -- If its any consolation, the human brain would still mop the floor with this bot if it wasn't limited by the mechanical interface
[05:34 pm]
NimoStar -- Well. The bot didn't come up with any new strategy. It just has superhuman micro. Hard to beat that. I reckon even the simplest dedicated chess engines are unbeatable for humans now.
[02:13 pm]
Oh_Man -- all g
[10:54 am]
NudeRaider -- Oh_Man
Oh_Man shouted: NudeRaider did u watch the entire video? it's not one game. it's currently dominating the ladder at number 1 position. do ur research first!
Oops, caught me there, no I haven't. :( I was imagining how the game went. Sorry for that. Watching it now. brb
[10:52 am]
NudeRaider -- NimoStar
NimoStar shouted: They were not "Unprepared" that was their fifth loss in a row against the bot. The other replays are also available
that doesn't mean he was prepared. When humans come around with new strategies it often takes weeks until the pros figure out how to shut it down. Oh_Man that's certainly a way more convincing argument for micro being "too good to beat".
[09:43 am]
DiearAnother -- wirefram
[08:35 am]
NimoStar -- Well, pros showed that long ago... half of zerg pros just ling muta rush
[08:35 am]
NimoStar -- " its shown is that you can trade 1000's of apm to make up for lack of strategy"
[03:25 am]
Oh_Man -- https://youtu.be/R_6bsf9REkY anyone ever tried playing SC ghost?
Please log in to shout.


Members Online: l)ark_ssj9kevin, O)FaRTy1billion[MM]