'Storing data with validity time window

I am working with PHP/MySql. Frequently, I encounter the problem that I need a "valid from" and a " valid to" column, and only read the matching rows that are valid today.

This makes the SQL statements more difficult to read (adding the extra conditions) and one needs to know (not forget) to add the additional conditions.

Is there a common approach for this problem?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source