I create a database of excursions. For each excursion it is necessary to register the calendar dates of its holding so that its dates can be displayed on the site for the excursion and search by date (output of the introtext of all excursions included in a given period). It makes sense to create a separate table with a calendar? If so, what structure should it have?
- If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky ♦
|
1 answer
Search for a specific date range is possible on the general table with events (excursions). Suppose the table is called excursion , the introtext field is intro , and the date field is date_field type TIMESTAMP . Then the sample request will look something like this:
SELECT `intro` FROM `excursion` WHERE (date_field BETWEEN '2016-05-28 21:29:06' AND '2016-05-29 12:21:25') I see no reason to create a separate table for this.
Do not forget to hang the index on the field with the date.
|