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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:47:47+00:00 2026-06-02T22:47:47+00:00

I have some data that looks like this: 1: Events 2: Event 1 3:

  • 0

I have some data that looks like this:
1: Events
2: Event 1
3: Event 1.1
4: Event 2
5: Event 2.2
6: Event 2.2.1
7: Event 2.2.1.1
8: Event 2.2.1.2
9: Event 2.2.1.3
10: Event 2.2.1.3.1
11: Event 3
12: Event 4
13: Event 4.1

Event 1, 2, 3 and 4 would all be nested under ‘Events’
Event 1.1 would be nested under Event 1
etc. etc.

How should I store this in the same table in the database? Could I just have another field for which ids to include?

That would look like this:

Fields:
id (id of event)
name (name of event)
ids_to_include (events that happened within this event)

The most that this (example) data is nested, is by 4 levels (2.2.1.3.1). But in my mind I’m thinking historical data, where every single event in history has many more sub-events, so the nesting needs to be limitless. I don’t want to create a new table for each “type” of historical event, I’d rather just a table for long-term periods (like WW2:1939-1945) which would have no nesting, and events which would have as much nesting as needed.

Or am I going about this the entirely wrong way? Thanks.

  • 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-02T22:47:49+00:00Added an answer on June 2, 2026 at 10:47 pm

    There are some models to store hierarchical data in relational tables, the most used two of them being nested sets and adjacency list.

    Depending on the types of the queries you want to run against these models, either can be more efficient.

    In MySQL, adjacency list is somewhat harder to query, since it requires set recursion which MySQL lacks, but still possible.

    See this entry in my blog for the comparison of these two models:

    • Adjacency list vs. nested sets: MySQL
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some data that looks something like this... +----------+----------+----------+ | Column 1 |
I have some data in an XML element that looks like this: <?xml version=1.0
I have some data in a table that looks roughly like the following: table
I have some data that I would like to visualize. Each byte of the
I have a function that loads in some XML that looks like this: private
I have some data which look like that: PMID- 19587274 OWN - NLM DP
I have a datasheet that looks like this: ID name_ 1 2 3 4
Suppose I have a data frame, df, that looks like: f t1 t2 t3
I have a Python script that for-loops through some objects and fetches data from
I have some data that I want to store somewhere in my Rails app

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.