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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:25:56+00:00 2026-05-13T00:25:56+00:00

I am designing a data model for tourism-site. I have a table for places

  • 0

I am designing a data model for tourism-site. I have a table for places (countries, resorts, hotels) and a table for tours. The tables are pretty different in fields so the cant be merged into one. Both of them have usual auto_increment as id. Places and tours have photos so there is a third table for photos. This table has ‘parent’ field in which I plan to store the parent (place or tour) id.

Which is the best way to design these tables? One table for all photos and two tables as ‘parents’ for the photos. For now I have added ‘parent_type’ column to photos table, so when my script displays a tour it calls photos by its (parent) id and type (parent_type) ‘tour’ from the photos table…

Upd:
Is there a more graceful solution? With just 3 tables and no ‘parent_type’ column?

(cant post a diagram… here’s the link http://share.xmind.net/yentsun/tourism-site-data-model/)

  • 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-13T00:25:56+00:00Added an answer on May 13, 2026 at 12:25 am

    There are no Parents involved – you just have photos with two atttributes – Place and Tour.

    So use a Photos table with two foreign keys, one for Tour, the other for Place. And then of course
    a Tours table and a Places table.

    If you need to know which Tours went to which Places, deal with it directly with a Tour_Places table
    which justifies itself independently.

    As for “Parentness”, this solution still lets you identify, for a Tour (or Place), which Photos are associated.

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

Sidebar

Related Questions

I'm re-designing a Web site and I have a problem with the existing data
I'm designing my application data model and I have a doubt, whether to use
I have never designed a database/data-model/schema from scratch, especially for a web-application. In some
Are there any good practices to follow when designing a model/ViewModel to represent data
I'm designing the data model for an app with the LINQ to SQL (O/R)
I've have a library of data access objects and am tasked with designing the
i need some help with designing iphone's core data object model context. I've started
In designing my app, I have organized my UI with backbone.js, with each model
I am struggling with designing a coreData model where I have only one type
I have been trying the model-first method when designing my application. We usually like

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.