Files
Yggdrasil/infotro/SDi/labs/database
2024-02-22 15:08:55 +01:00
..
2024-02-22 15:08:55 +01:00
2024-02-22 15:08:55 +01:00
2024-02-22 15:08:55 +01:00

Lab databases


Create & populate tables

relations.png

Queries

1) the description of all Function

SELECT `description` FROM `Function`

[!NOTE|label:Result]

"description"
"Fast backwards"
"Raise up the low frequencies. Cut off frequency : 200 Hz"
"Reduce the low frequencies. Cut off frequency : 200 Hz"
"Fast forwards"
"Tunes down"
"Tunes up"
"Plays to the next track"
"Open or close the player's tray"
"Pauses the current track"
"Plays the selected track"
"Select the preset 1"
"Select the preset 2"
"Select the preset 3"
"Plays to the previous track"
"Stores the current frequency to a preset"
"Stops the current track"
"Reduce the high frequencies.Cut off frequency : 4000 Hz"
"Raise up the high frequencies. Cut off frequency : 4000 Hz"
"Slow down fine tuning"
"Slow up fine tuning"
"Raise up the volume"
"Reduce the volume"
"Select the source of the input (BD, DVD, HDMI, ...)"
"Select the Audio format to use with the current source (2ch stereo, 5.1, 7.2, 9.2, ...)"

2) the name of manufacturers that have at least one entry in the Model table

SELECT `Manufacturer`.`manufacturerName`
FROM `Manufacturer`
WHERE EXISTS( SELECT *
             FROM `Model`
             WHERE `Model`.`manufacturerID`=`Manufacturer`.`manufacturerID`)

[!NOTE|label:Result]

"manufacturerName"
"HEVs"
"Sony"
"Onkyo"

3) the modelName of device models together with the manufacturerName of their manufacturers

SELECT `Model`.`modelName`, `Manufacturer`.`manufacturerName`
FROM `Model`, `Manufacturer`
WHERE `Model`.`manufacturerID` = `Manufacturer`.`manufacturerID`

[!NOTE|label:Result]

"modelName","manufacturerName"
"MHC-900","Sony"
"SDi-Ampli-01","HEVs" "SDi-CdDvd-01","HEVs"
"SDi-Tuner-01","HEVs"
"UBP-X800M2","Sony"
"TX-RZ70","Onkyo"

4) the description of the Function with functionLabel “Stop”

SELECT `Function`.`description`
FROM `Function`
WHERE `Function`.`functionLabel` like 'Stop'

[!NOTE|label:Result] "description"
"Stops the current track"

5) the functionLabel for Function with functionID > 10 and with a description containing the word “preset” (SQL wildcard character is “%”)

SELECT `Function`.`functionLabel`
FROM `Function`
WHERE `Function`.`functionID` > '10' AND `Function`.`description` like '%preset%'

[!NOTE|label:Result] "functionLabel"
"Preset 1"
"Preset 2"
"Preset 3"
"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


[!NOTE|label:Result]

Test constraints