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 7746965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:24:49+00:00 2026-06-01T10:24:49+00:00

My database has an organisation table and an address table. In the address table,

  • 0

My database has an organisation table and an address table. In the address table, I want to store user ID and organisation ID so that I can look these up later and also have multiple addresses for organisations or for a user to be able to select an address they have added for a different organisation. An example here would be if 2 organisations share the same property. I also want my organisation table to store the default address ID. However, this is proving awkward when using ORM Models in FuelPHP (probably irrelevant, it’s just caused me to pay attention to a possible design weakness).

The above is one option, I can think of 2 more solutions. One is to have a default address table storing organisation ID and address ID, the address table can still store user and org IDs. I can then select from organisation table inner join the default address table and inner join the address ID from the address table to retrieve the address.

The second option is to have a default address field in my address table, as type bool. I then use a where statement in the elect to retrieve this address when needed.

The second option is my preferred option at the moment because it means I don’t have to do too much work altering my tables and adding keys and setting relationships in my PHP framework ORM model. However, should the database become larger and performance be an issue, which of these methods are best? Are there any other methods which I haven’t considered?

  • 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-01T10:24:51+00:00Added an answer on June 1, 2026 at 10:24 am

    It sounds like you have an m:m (many to many) relationship between Organization and Address. So the best way to represent this in the database would be to introduce a new a table to represent this relationship.

    I’m not sure if you mean default address as in default for the given company, or default for the given user when creating companies. In the first case, you would add this as an attribute of the newly created table representing the relationship. In the later case you could place a foreign-key in the user table, representing the default address.

    With regards to performance, use integer keys and make proper indexes…! That said, it would be faster of course to skip the relationship table and just create a similair addresses for different companies on the same address. That would save you one join on the company+adresses lookup. However, this will be much slower if you need to find all companies on a given address, as you would have to read out different addresses and compare them.

    So it all depends a bit on how you wanna use your data. I would go with “correct” option (a new relationship talbe), as it isn’t a lot slower with the correct indexes and it gives you a lot more possibilities later on.

    The next question is how do you get new users to pick an excisting address, rather than creating a duplicate entry.. This will be a challenge in your interface design, and the quality of the data you gather will depend a lot on it.

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

Sidebar

Related Questions

I have a table in database which has following structure(data) : +--------------------------+ Organization +--------------------------+
How would you design a database to manage multi organisation? (ie 1 user can
i have a database that has a list of employees of an organziation. There
Database has tables Photos and PhotoAlbums. I need a query that will select all
My database has a table with thousands of records. The primary key is an
I have setup a simple Oracle external table test that I (alongside a DBA
I have a Project table and a Organization table. Project has a many to
I'm designing a database for an organization that has multiple types of users. At
I have a Python application. It has an SQLite database, full of data about
Alright, so here is the story.. My organization has a database that we sell

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.