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

  • Home
  • SEARCH
  • 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 7630721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:10:28+00:00 2026-05-31T06:10:28+00:00

If you have a complex database structure where many of your select statements involve

  • 0

If you have a complex database structure where many of your select statements involve complex joins is it best to use 1 model or do you have to break each table into it’s own model?

For example if I have a database that has the following

  • tb_persons = a list of people
  • tb_interests = a list of interests assigned to each customer
  • tb_interests_types = a list of all the possible interests

And I need to pass data to my views from SQL statements like

select c.interest_type_name 
from tb_persons a
LEFT JOIN tb_interests b on (a.persons_id=b.persons_id)
LEFT JOIN tb_interests_types c on (b.interest_type_id=c.interest_type_id)
WHERE a.person_id=1

What model would this go into? Can you treat a model as a holder for a group of tables that relate together or do you need to have individual models?

  • 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-05-31T06:10:29+00:00Added an answer on May 31, 2026 at 6:10 am

    I would have a person model, and then join the interests on an as-needed basis.

    As stated in a comment, you don’t need a model-per-table structure, but you probably need a model per strong entity (an interest is worthless without a “person” context, but a person object can be valuable without interests).

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

Sidebar

Related Questions

I have a complex database model set up in Django, and I have to
I have a pretty complex database schema and would like to know if there
I have a complex network of objects being spawned from a sqlite database using
I have some complex stored procedures that may return many thousands of rows, and
I have an application where many unit tests use a real connection to an
I have a reasonably complex MySQL query being run on another developer's database. I
I have a multithreaded C++ application which holds a complex data structure in memory
I have something like Facebook's Wall build on PHP that uses MySQL database. Structure:
Ok so i am new to making complex database structure into the page. I
Assuming Visual C/C++ 6, I have a complex data structure of 22399 elements that

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.