luulinh90s's picture
update
8431e47
<html><head>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
h1 { text-align: center; }
.cot-title { color: blue; }
.pos-title { color: green; }
h2 { color: black; text-align: left; }
h3 { color: black; text-align: left; }
h4 { color: darkslategray; }
table { width: 100%; border-collapse: collapse; margin: 20px 0; }
table, th, td { border: 1px solid #ddd; padding: 8px; }
th { background-color: #f2f2f2; }
tr:nth-child(even) { background-color: #f9f9f9; }
.highlight { background-color: #ffffcc; }
.true { color: green; }
.false { color: red; }
.highlighted-cell { background-color: yellow; cursor: pointer; }
.step-title { background-color: #f1f1f1; color: #444; padding: 10px; margin: 10px 0; font-size: 18px; border-left: 4px solid #888; }
.step { display: block; }
</style>
</head><body>
<hr/>
<h3><span>Statement:</span> 2007 - 2008 is the season where september 26 , 2007 has the season premier</h3>
<h3>Input Table: csi (franchise)</h3>
<div class="step">
<div class="step">
<div class="step-title">Step 1: Order the table by 'season_premiere' in ascending order.</div>
<div class="content" id="step-1">
<table>
<tr>
<td>season</td>
<td>episodes</td>
<td>time_slot__est_</td>
<td>season_premiere</td>
<td>season_finale</td>
<td>tv_season</td>
<td>rank</td>
<td>viewers__in_millions_</td>
</tr>
<tr>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">1</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">23</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">wednesday 10 pm / 9c</span></td>
<td><span class="highlighted-cell" style="background-color:#90EE90;" title="Used in transformation">2004-09-22</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">2005-05-18</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">2004 - 2005</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">21</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">13.59</span></td>
</tr>
<tr>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">2</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">24</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">wednesday 10 pm / 9c</span></td>
<td><span class="highlighted-cell" style="background-color:#90EE90;" title="Used in transformation">2005-09-28</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">2006-05-17</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">2005 - 2006</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">22</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">14.04</span></td>
</tr>
<tr>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">3</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">24</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">wednesday 10 pm / 9c</span></td>
<td><span class="highlighted-cell" style="background-color:#90EE90;" title="Used in transformation">2006-09-20</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">2007-05-16</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">2006 - 2007</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">25</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">13.92</span></td>
</tr>
<tr>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">4</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">21</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">wednesday 10 pm / 9c</span></td>
<td><span class="highlighted-cell" style="background-color:#90EE90;" title="Used in transformation">2007-09-26</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">2008-05-21</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">2007 - 2008</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">28</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">11.71</span></td>
</tr>
<tr>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">5</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">25</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">wednesday 10 pm / 9c</span></td>
<td><span class="highlighted-cell" style="background-color:#90EE90;" title="Used in transformation">2008-09-24</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">2009-05-14</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">2008 - 2009</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">17</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">13.5</span></td>
</tr>
<tr>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">6</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">23</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">wednesday 10 pm / 9c</span></td>
<td><span class="highlighted-cell" style="background-color:#90EE90;" title="Used in transformation">2009-09-23</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">2010-05-26</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">2009 - 2010</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">23</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">12.66</span></td>
</tr>
<tr>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">7</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">22</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">friday 9 pm / 8c</span></td>
<td><span class="highlighted-cell" style="background-color:#90EE90;" title="Used in transformation">2010-09-24</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">2011-05-13</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">2010 - 2011</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">37</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">10.73</span></td>
</tr>
<tr>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">8</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">18</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">friday 9 pm / 8c</span></td>
<td><span class="highlighted-cell" style="background-color:#90EE90;" title="Used in transformation">2011-09-23</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">2012-05-11</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">2011 - 2012</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">38</span></td>
<td><span class="highlighted-cell" style="background-color:yellow;" title="Used in transformation">10.34</span></td>
</tr>
</table>
</div>
<hr/>
<div class="step">
<div class="step-title">Step 2: Select rows where 'season' is '2007'.</div>
<div class="content" id="step-0">
<table>
<tr>
<td>season</td>
<td>episodes</td>
<td>time_slot__est_</td>
<td>season_premiere</td>
<td>season_finale</td>
<td>tv_season</td>
<td>rank</td>
<td>viewers__in_millions_</td>
</tr>
<tr>
<td>1</td>
<td>23</td>
<td>wednesday 10 pm / 9c</td>
<td>2004-09-22</td>
<td>2005-05-18</td>
<td>2004 - 2005</td>
<td>21</td>
<td>13.59</td>
</tr>
<tr>
<td>2</td>
<td>24</td>
<td>wednesday 10 pm / 9c</td>
<td>2005-09-28</td>
<td>2006-05-17</td>
<td>2005 - 2006</td>
<td>22</td>
<td>14.04</td>
</tr>
<tr>
<td>3</td>
<td>24</td>
<td>wednesday 10 pm / 9c</td>
<td>2006-09-20</td>
<td>2007-05-16</td>
<td>2006 - 2007</td>
<td>25</td>
<td>13.92</td>
</tr>
<tr>
<td>4</td>
<td>21</td>
<td>wednesday 10 pm / 9c</td>
<td>2007-09-26</td>
<td>2008-05-21</td>
<td>2007 - 2008</td>
<td>28</td>
<td>11.71</td>
</tr>
<tr>
<td>5</td>
<td>25</td>
<td>wednesday 10 pm / 9c</td>
<td>2008-09-24</td>
<td>2009-05-14</td>
<td>2008 - 2009</td>
<td>17</td>
<td>13.5</td>
</tr>
<tr>
<td>6</td>
<td>23</td>
<td>wednesday 10 pm / 9c</td>
<td>2009-09-23</td>
<td>2010-05-26</td>
<td>2009 - 2010</td>
<td>23</td>
<td>12.66</td>
</tr>
<tr>
<td>7</td>
<td>22</td>
<td>friday 9 pm / 8c</td>
<td>2010-09-24</td>
<td>2011-05-13</td>
<td>2010 - 2011</td>
<td>37</td>
<td>10.73</td>
</tr>
<tr>
<td>8</td>
<td>18</td>
<td>friday 9 pm / 8c</td>
<td>2011-09-23</td>
<td>2012-05-11</td>
<td>2011 - 2012</td>
<td>38</td>
<td>10.34</td>
</tr>
</table>
</div>
</div>
<hr/>
<div class="step">
<div class="step-title">Step 3: Select rows where 'season_premiere' is '2007-09-26'.</div>
<div class="content" id="step-1">
<table>
<tr>
<td>season</td>
<td>episodes</td>
<td>time_slot__est_</td>
<td>season_premiere</td>
<td>season_finale</td>
<td>tv_season</td>
<td>rank</td>
<td>viewers__in_millions_</td>
</tr>
</table>
</div>
</div>
<hr/>
<div class="step">
<div class="step-title">Step 4: Use a `CASE` statement to return TRUE if the number of rows is equal to 1, otherwise return FALSE.</div>
<div class="content" id="step-2">
<table>
<tr>
<td>season</td>
<td>episodes</td>
<td>time_slot__est_</td>
<td>season_premiere</td>
<td>season_finale</td>
<td>tv_season</td>
<td>rank</td>
<td>viewers__in_millions_</td>
</tr>
</table>
</div>
</div>
<hr/>
</div>
</div>
<hr/>
</body></html>