update lab-database
This commit is contained in:
1 parent
04f2ca9aba
commit
2035387730
1 file changed
+194
@@ -100,10 +100,204 @@ WHERE `Function`.`functionID` > '10' AND `Function`.`description` like '%preset%
|
||||
> "Save preset"
|
||||
|
||||
#### 6) the product of the tables `Code` and `FunctionList` (with and without the `JOIN` keyword), as well as the number of entries in the resulting product table
|
||||
<b><u>With JOIN keyword</u></b><br>
|
||||
26 elements in 0,0003 seconds
|
||||
```sql
|
||||
SELECT `Code`.`codeValue`, `FunctionList`.`modelID`, `FunctionList`.`functionID`
|
||||
FROM `Code`
|
||||
JOIN `FunctionList`
|
||||
ON `Code`.`codeID` = `FunctionList`.`codeID`;
|
||||
```
|
||||
> [!NOTE|label:Result]
|
||||
> "codeValue","modelID","functionID" <br>
|
||||
> "7","1","1" <br>
|
||||
> "124","1","10" <br>
|
||||
> "125","1","16" <br>
|
||||
> "547","1","9" <br>
|
||||
> "698","1","4" <br>
|
||||
> "59409854","3","8" <br>
|
||||
> "78546723","3","7" <br>
|
||||
> "81298355","3","16" <br>
|
||||
> "84578346","3","9" <br>
|
||||
> "84793478","3","10" <br>
|
||||
> "95847623","3","14" <br>
|
||||
> "458945040","2","17" <br>
|
||||
> "458945041","2","18" <br>
|
||||
> "458945042","2","2" <br>
|
||||
> "458945043","2","3" <br>
|
||||
> "458945044","2","21" <br>
|
||||
> "458945045","2","22" <br>
|
||||
> "1164736495","4","19" <br>
|
||||
> "1164736496","4","20" <br>
|
||||
> "1184894580","4","11" <br>
|
||||
> "1184894581","4","12" <br>
|
||||
> "1184894582","4","13" <br>
|
||||
> "1184894589","4","15" <br>
|
||||
> "1948573644","4","5" <br>
|
||||
> "1948573645","4","6" <br>
|
||||
> "1948573646","1","8"
|
||||
|
||||
|
||||
<b><u>Without JOIN keyword</u></b><br>
|
||||
26 elements in 0,0002 seconds
|
||||
```sql
|
||||
SELECT `Code`.`codeValue`, `FunctionList`.`modelID`, `FunctionList`.`functionID`
|
||||
FROM `Code`, `FunctionList`
|
||||
WHERE `Code`.`codeID` = `FunctionList`.`codeID`;
|
||||
```
|
||||
> [!NOTE|label:Result]
|
||||
> "codeValue","modelID","functionID" <br>
|
||||
> "7","1","1" <br>
|
||||
> "124","1","10" <br>
|
||||
> "125","1","16" <br>
|
||||
> "547","1","9" <br>
|
||||
> "698","1","4" <br>
|
||||
> "59409854","3","8" <br>
|
||||
> "78546723","3","7" <br>
|
||||
> "81298355","3","16" <br>
|
||||
> "84578346","3","9" <br>
|
||||
> "84793478","3","10" <br>
|
||||
> "95847623","3","14" <br>
|
||||
> "458945040","2","17" <br>
|
||||
> "458945041","2","18" <br>
|
||||
> "458945042","2","2" <br>
|
||||
> "458945043","2","3" <br>
|
||||
> "458945044","2","21" <br>
|
||||
> "458945045","2","22" <br>
|
||||
> "1164736495","4","19" <br>
|
||||
> "1164736496","4","20" <br>
|
||||
> "1184894580","4","11" <br>
|
||||
> "1184894581","4","12" <br>
|
||||
> "1184894582","4","13" <br>
|
||||
> "1184894589","4","15" <br>
|
||||
> "1948573644","4","5" <br>
|
||||
> "1948573645","4","6" <br>
|
||||
> "1948573646","1","8"
|
||||
|
||||
#### 7) All `codeValue` for `modelID 4`
|
||||
```sql
|
||||
SELECT `Code`.`codeValue`
|
||||
FROM `Code`
|
||||
CROSS JOIN `FunctionList`
|
||||
ON `Code`.`codeID` = `FunctionList`.`codeID`
|
||||
WHERE `FunctionList`.`modelID` = 4;
|
||||
```
|
||||
> [!NOTE|label:Result]
|
||||
> "codeValue" <br>
|
||||
> "1948573644" <br>
|
||||
> "1948573645" <br>
|
||||
> "1184894580" <br>
|
||||
> "1184894581" <br>
|
||||
> "1184894582" <br>
|
||||
> "1184894589" <br>
|
||||
> "1164736495" <br>
|
||||
> "1164736496"
|
||||
|
||||
#### 8) The number of `codeValue` for `modelID 4`
|
||||
```sql
|
||||
SELECT COUNT(`Code`.`codeValue`)
|
||||
FROM `Code`
|
||||
JOIN `FunctionList`
|
||||
ON `Code`.`codeID` = `FunctionList`.`codeID`
|
||||
WHERE `FunctionList`.`modelID` = 4;
|
||||
```
|
||||
> [!NOTE|label:Result]
|
||||
> 8
|
||||
|
||||
#### 9) All `codeValue` and `functionLabel` for Model with `modelName “SDi-Tuner-01”`
|
||||
```sql
|
||||
SELECT `Code`.`codeValue`, `Function`.`functionLabel`
|
||||
FROM `Model`
|
||||
JOIN `FunctionList` ON `Model`.`modelID` = `FunctionList`.`modelID`
|
||||
JOIN `Code` ON `FunctionList`.`codeID` = `Code`.`codeID`
|
||||
JOIN `Function` ON `FunctionList`.`functionID` = `Function`.`functionID`
|
||||
WHERE `Model`.`modelName` like 'SDi-Tuner-01'
|
||||
```
|
||||
> [!NOTE|label:Result]
|
||||
> "codeValue","functionLabel" <br>
|
||||
> "1948573644","Frequency down" <br>
|
||||
> "1948573645","Frequency up" <br>
|
||||
> "1184894580","Preset 1" <br>
|
||||
> "1184894581","Preset 2" <br>
|
||||
> "1184894582","Preset 3" <br>
|
||||
> "1184894589","Save preset" <br>
|
||||
> "1164736495","Tune down" <br>
|
||||
> "1164736496","Tune up"
|
||||
|
||||
#### 10) The number of `Function` items per `modelName`
|
||||
```sql
|
||||
SELECT `Model`.`modelName`, COUNT(`FunctionList`.`functionID`)
|
||||
FROM `Model`
|
||||
LEFT JOIN `FunctionList` ON `Model`.`modelID` = `FunctionList`.`modelID`
|
||||
GROUP BY `Model`.`modelName`
|
||||
```
|
||||
> [!NOTE|label:Result]
|
||||
> "modelName","COUNT(`FunctionList`.`functionID`)" <br>
|
||||
> "MHC-900","6" <br>
|
||||
> "SDi-Ampli-01","6" <br>
|
||||
> "SDi-CdDvd-01","6" <br>
|
||||
> "SDi-Tuner-01","8" <br>
|
||||
> "UBP-X800M2","0" <br>
|
||||
> "TX-RZ70","0"
|
||||
|
||||
|
||||
#### 11) All `functionLabel` and `description` with their corresponding `modelID`, `functionID` and `codeID`. Be sure to include all `functionLabel` even if they are not used in any device !
|
||||
```sql
|
||||
SELECT `Function`.`functionLabel`, `Function`.`description`, `FunctionList`.`modelID`, `FunctionList`.`codeID`
|
||||
FROM `FunctionList`
|
||||
RIGHT JOIN `Function` ON `FunctionList`.`functionID` = `Function`.`functionID`;
|
||||
```
|
||||
> [!NOTE|label:Result]
|
||||
> "functionLabel","description","modelID","codeID" <br>
|
||||
> "Back","Fast backwards","1","1" <br>
|
||||
> "Bass down","Raise up the low frequencies. Cut off frequency : 200 Hz","2","14" <br>
|
||||
> "Bass up","Reduce the low frequencies. Cut off frequency : 200 Hz","2","15" <br>
|
||||
> "Forward","Fast forwards","1","5" <br>
|
||||
> "Frequency down","Tunes down","4","24" <br>
|
||||
> "Frequency up","Tunes up","4","25" <br>
|
||||
> "Next","Plays to the next track","3","7" <br>
|
||||
> "Open/Close tray","Open or close the player's tray","1","26" <br>
|
||||
> "Open/Close tray","Open or close the player's tray","3","6" <br>
|
||||
> "Pause","Pauses the current track","1","4" <br>
|
||||
> "Pause","Pauses the current track","3","9" <br>
|
||||
> "Play","Plays the selected track","1","2" <br>
|
||||
> "Play","Plays the selected track","3","10" <br>
|
||||
> Preset 1","Select the preset 1","4","20" <br>
|
||||
> "Preset 2","Select the preset 2","4","21" <br>
|
||||
> "Preset 3","Select the preset 3","4","22" <br>
|
||||
> "Previous","Plays to the previous track","3","11" <br>
|
||||
> "Save preset","Stores the current frequency to a preset","4","23" <br>
|
||||
> "Stop","Stops the current track","1","3" <br>
|
||||
> "Stop","Stops the current track","3","8" <br>
|
||||
> "Treble down","Reduce the high frequencies.Cut off frequency : 4000 Hz","2","12" <br>
|
||||
> "Treble up","Raise up the high frequencies. Cut off frequency : 4000 Hz","2","13" <br>
|
||||
> "Tune down","Slow down fine tuning","4","18""Tune up","Slow up fine tuning","4","19" <br>
|
||||
> "Volume down","Raise up the volume","2","16" <br>
|
||||
> "Volume up","Reduce the volume","2","17" <br>
|
||||
> "Input source","Select the source of the input (BD, DVD, HDMI, ...)",NULL,NULL <br>
|
||||
> "Audio format","Select the Audio format to use with the current source (2ch stereo, 5.1, 7.2, 9.2, ...)",NULL,NULL
|
||||
|
||||
|
||||
#### 12) All `functionLabel` and `description` of non-used functions in any device. (insert beforehand a new function in `Function`, with no reference in the `FunctionList` table). Add an unused function in the CSV file
|
||||
```sql
|
||||
SELECT `Function`.`functionLabel`, `Function`.`description`
|
||||
FROM `FunctionList`
|
||||
RIGHT JOIN `Function` ON `FunctionList`.`functionID` = `Function`.`functionID`
|
||||
WHERE `FunctionList`.`modelID` is NULL
|
||||
```
|
||||
> [!NOTE|label:Result]
|
||||
> "functionLabel","description" <br>
|
||||
> "Input source","Select the source of the input (BD, DVD, HDMI, ...)" <br>
|
||||
> "Audio format","Select the Audio format to use with the current source (2ch stereo, 5.1, 7.2, 9.2, ...)" <br>
|
||||
> "Test Function","This function should not be referenced in the FunctionList"
|
||||
|
||||
|
||||
#### 13) Add a VIEW to your DB to list all HEVs appliances with their `manufacturerName`, `modelName`, `typeLabel`, `functionLabel` and `codeValue`
|
||||
```sql
|
||||
|
||||
```
|
||||
> [!NOTE|label:Result]
|
||||
>
|
||||
|
||||
|
||||
# Test constraints
|
||||
Reference in new issue
Block a user