Note that there are some explanatory texts on larger screens.

plurals
  1. POPlanning management slots/sessions
    primarykey
    data
    text
    <p>I have a planning structure on two tables to store available slots by day, and sessions.</p> <p>A slot is defined by a range of time in the day.</p> <pre><code>CREATE TABLE slot ( `id` int(11) NOT NULL AUTO_INCREMENT , `date` date , `start` time , `end` time ); </code></pre> <p>Sessions can't overlap themselves and must be wrapped in a slot.</p> <pre><code>CREATE TABLE session ( `id` int(11) NOT NULL AUTO_INCREMENT , `date` date , `start` time , `end` time ); </code></pre> <p>I need to generate a list of available blocks of time of a certain duration, in order to create sessions.</p> <p>Example:</p> <pre><code>INSERT INTO slot (date, start, end) VALUES ("2010-01-01", "10:00", "19:00") , ("2010-01-02", "10:00", "15:00") , ("2010-01-02", "16:00", "20:30") ; INSERT INTO slot (date, start, end) VALUES ("2010-01-01", "10:00", "19:00") , ("2010-01-02", "10:00", "15:00") , ("2010-01-02", "16:00", "20:30") ; </code></pre> <p>2010-01-01</p> <pre><code> &lt;##&gt;&lt;####&gt; &lt;- Sessions ------------------------------------ &lt;- Slots 10 11 12 13 14 15 16 17 18 19 20 </code></pre> <p>2010-01-02</p> <pre><code> &lt;##########&gt; &lt;########&gt; &lt;- Sessions -------------------- ------------------ &lt;- Slots 10 11 12 13 14 15 16 17 18 19 20 </code></pre> <p>I need to know which spaces of 1 hour I can use:</p> <pre><code>+------------+-------+-------+ | date | start | end | +------------+-------+-------+ | 2010-01-01 | 13:00 | 14:00 | | 2010-01-01 | 14:00 | 15:00 | | 2010-01-01 | 15:00 | 16:00 | | 2010-01-01 | 16:00 | 17:00 | | 2010-01-01 | 17:00 | 18:00 | | 2010-01-01 | 18:00 | 19:00 | | 2010-01-02 | 10:00 | 11:00 | | 2010-01-02 | 11:00 | 12:00 | | 2010-01-02 | 16:00 | 17:00 | +------------+-------+-------+ </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload