Tuesday, January 4, 2011

1-4-11: The New Year's Resolution Gym Crowd; SQL Project Example

Another new year, another New Year’s resolution crowd at the gym. This morning was not quite as bad as years past, but it was nonetheless more crowded than usual. The crowd usually begins to fade back to normal levels around March or so, so it’s just a matter of getting through the next 8-10 weeks. You can often tell the regulars from the “resolutioners.” Regulars tend to float between machines pretty smoothly and recognize what other people around them are doing so that it’s a smoother operation in general (a.k.a. proper gym etiquette). Resolutioners tend to have poorer etiquette simply because they’re dealing with a new personal routine. They also tend to exert more effort and fade more quickly. I am by no means a power user (I go three times a week), but I stick to my routine year-round. I also don’t mind seeing new people at the gym; I don’t say anything or give them a hard time. I just stay out of their way.

The annual influx of this resolution crowd of gym members made me think: what percentage of the resolution crowd had active memberships before the new year? I’d be surprised if it were under 70%. I don’t know many people who get gym memberships for Christmas (though that’s not saying a lot of people do), and I also don’t know how many people make it their resolution to get in shape for [insert reason here]. I think it’s great that people make the effort. I just wish they stuck with it more to make it easier for the regulars. The more you use the gym, the better your etiquette becomes (general rule which does not apply to all regular members), and the more likely it is you’ll develop a healthy routine.

While asking myself the above question, I began to think how one would determine what percentage of the resolution crowd had active memberships before the new year. I switched into SQL mode. Now, I haven’t used SQL since I took a course in Database Concepts for my Master’s degree two years ago, but I came up with the following general scheme that may be useful to a student in a database class:

Assumptions:

- An active member is any dues paying member (under contract or month to month), regardless of attendance, for at least 3 months prior to the new year

- An active member is part of the resolution crowd if they increase their monthly attendance by at least 250% from the previous 6 months (second half of the previous calendar year)

o If they were not active members for the full six months prior to the new year, use the average monthly attendance for the time period during which they were active members

Methodology:

You will need two tables. One of them contains members (listed by unique ID) and their starting date of active membership. The other would be much larger and would contain members (listed by unique ID) and time stamps of their attendance. Many gyms have members “scan in” with their membership cards, so it’s safe to assume the data exists to populate the second table. Here are small examples of the two tables:

Table 1:

ID

Start_Date



825486

6/3/2010

842647

8/1/2008

214578

12/15/2009

467946

2/24/2009

915948

6/15/2010

753125

7/17/2009

Table 2:

Date

Time

ID




1/2/2011

6:30:15

214578

1/2/2011

6:40:58

467946

1/2/2011

7:15:02

915948

1/2/2011

12:15:52

825486

1/2/2011

15:38:29

842647

1/3/2011

6:35:24

214578

The queries would be pretty straightforward (though I’ll need to refresh my memory on SQL queries for the exact syntax; may put the queries themselves in a future post). You’d need to select from Table 1 and Table 2 (probably use an inner join; ID would be the key) where the member is both an active member who is part of the resolution crowd (according to the assumptions above).

Nice little SQL project for any student looking for something to do. How might such a project be useful? Perhaps it would help the gym management determine how many members start attending more frequently once the new year rolls around so that they know to staff more personnel or make sure more machines are available (some may be broken; this morning four out of five stationary bikes were in disrepair) or just to be prepared for more volume in general. Maybe even use the information for marketing purposes. Maybe they like having a large resolution crowd. Who knows.

No comments: