Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8287631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:06:09+00:00 2026-06-08T12:06:09+00:00

This is general question about the best way I should setup a database, it

  • 0

This is general question about the best way I should setup a database, it is not specific to a software but for information it is MYSQL.

I am monitoring 1000 “houses” and how many people are present at that house at a given time to later be used in some statistics such as:

Which house is normally the fullest at a specific time range
Average capacity in general
Busiest time frame for all houses, and for a specific house.

I will be checking how many people are present every hour.

Whats the best way to setup this mysql table?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T12:06:12+00:00Added an answer on June 8, 2026 at 12:06 pm

    Looks like you would (optionally) want entries for each house (a house table to describe each location, with some sort of ID).

    Then you would want a transactional table which would contain the house ID, the number of people and the sample date/time.

    This way you can analyse what you need

    e.g.

    House
       HouseID int
       Address1 varchar
       etc etc..
    
    Attendance
       RecordID int (optional I suppose)
       HouseID int
       People int
       SampleDate datetime
    

    Queries for stuff like averages are easy enough

    SELECT AVG(People) FROM Attendance WHERE HouseID = 1 AND SampleDate BETWEEN Date1 AND Date2
    

    Which house is fullest for a specific time range

    SELECT TOP 1 HouseID FROM Attendance GROUP BY HouseID ORDER BY SUM(People) DESC
    

    Disclaimer: some/all of these queries might not work 🙂

    Edit: They do work! Here’s a SQL fiddle showing them in action

    http://sqlfiddle.com/#!3/293e4/8

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a general question about mongodb database design, but the reason for my
I this is a really general question, but what would be the best way
This is a general question about design. What's the best way to communicate between
This is a general question about MVC as a pattern, but in this case
This is a general question. And may not be specific to datagrids. How can
This is a general programming question, not pertaining to any specific language. A new
Yesterday I asked this general question about decimals and their internal precisions. Here is
This is a general question about character encoding when using MD5 libraries in various
So this is more of a general question about apps and techniques rather than
This question is about 64-bit Java apps in general, although I came upon it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.