Unrelated tables and time intervals I am going to comment on the scenario that I currently have when designing my database.

I have the following tables:

user (id, name, lastname)

role (id, name)

user_role (user_id, role_id, from_date, to_date)

period (id, name, from_date, to_date)


The period table serves as a data master to know the name of the periods that I define in my application.

In this case I mention only the user, role and user_role tables, but there are many more tables that have periods.

The intention of the period table is to act as a labeling system for the different periods that exist in the tables of my model. This table is not related in any way by any foreign key with other tables. To do the searches and relate other tables to this, a join is made using dates from and dates to.

For example, a tuple of the user_role table can have a date from and a date until that covers several periods defined in the period table, so it would be labeled with the names of the periods it comprises.

Is it okay for the period table to be an unrelated table? It only serves to give names to the periods, that's why I put it this way. Can you think of another better way to raise it? Should the period table be related to the other tables in some other way?

Thanks in advance.
Thank you for your response on my queries.

My thoughts on this:


Periods are only to label your data
It is not labeling every data of your database
Since as per your clarifications "When inserted, it is not checked if there is a period to insert the information", periods may overlapped each other
Query is not essentially labeling every data with a periods
Database is very small in size,


Linking a table to others needs some sort of consistency which is not available in this case.  Seeing these inputs, IMHO, we can safely keep this table as separate entity.

From Performance aspects, we can make better indexes based on our application's need on period table to avoid any bottleneck.

Thank you,

Sanjeeva