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.
[04:03 pm]
IskatuMesk -- no Hello World? No Hello . jpeg? Not even ddosing some government website? smh my head
[2026-5-31. : 10:02 pm]
Symmetry -- I was really just figuring out how to compile
[2026-5-31. : 10:02 pm]
Symmetry -- I didn't make it do anything
[2026-5-31. : 9:17 pm]
Ultraviolet -- hell yeah. did you have trouble making the button functional, or just haven't gotten there yet?
[2026-5-31. : 8:29 pm]
Symmetry -- I made the marine shoot lasers and gave the medic a nonfunctional button
[2026-5-31. : 8:07 pm]
Ultraviolet -- Symmetry
Symmetry shouted: I did my first EUD thing today. Feels like me finding arsenal at age 8 again
haha for sure. in some ways it's even more exciting because you can play EUD maps on regular battle.net, don't need to convince someone to download your mod to play with you. what did you do?
[2026-5-31. : 6:47 pm]
Symmetry -- I did my first EUD thing today. Feels like me finding arsenal at age 8 again
[2026-5-31. : 3:20 pm]
l)ark_ssj9kevin -- le reddit
[2026-5-31. : 2:55 pm]
Moose -- >reddit :rip2:
[2026-5-31. : 2:07 pm]
IskatuMesk -- reddit 💀
Please log in to shout.


Members Online: Roy