Diferència entre revisions de la pàgina «ASIX/M10/UF1/A05/E1»
Salta a la navegació
Salta a la cerca
m (Guillem ha mogut M10/UF1/A05/E1 a ASIX/M10/UF1/A05/E1 sense deixar una redirecció: Crear subnivell ASIX) |
|||
(Hi ha 8 revisions intermèdies del mateix usuari que no es mostren) | |||
Línia 1: | Línia 1: | ||
+ | [[Category:M10]] | ||
==ASIX M10 UF1== | ==ASIX M10 UF1== | ||
===Pt5. Codificació de funcions=== | ===Pt5. Codificació de funcions=== | ||
Línia 17: | Línia 18: | ||
==Execució== | ==Execució== | ||
+ | <source lang="mysqle"> | ||
+ | MariaDB [world]> call paisos_llengua("English"); | ||
+ | </source> | ||
+ | |||
<source> | <source> | ||
− | Name | + | +--------------------------------------+ |
− | Anguilla | + | | Name | |
− | American Samoa | + | +--------------------------------------+ |
− | Antigua and Barbuda | + | | Anguilla | |
− | Australia | + | | American Samoa | |
− | Belize | + | | Antigua and Barbuda | |
− | Bermuda | + | | Australia | |
− | Barbados | + | | Belize | |
− | Canada | + | | Bermuda | |
− | Cocos (Keeling) Islands | + | | Barbados | |
− | Christmas Island | + | | Canada | |
− | Cayman Islands | + | | Cocos (Keeling) Islands | |
− | Falkland Islands | + | | Christmas Island | |
− | United Kingdom | + | | Cayman Islands | |
− | Gibraltar | + | | Falkland Islands | |
− | Guam | + | | United Kingdom | |
− | Hong Kong | + | | Gibraltar | |
− | Ireland | + | | Guam | |
− | Saint Kitts and Nevis | + | | Hong Kong | |
− | Saint Lucia | + | | Ireland | |
− | Lesotho | + | | Saint Kitts and Nevis | |
− | Marshall Islands | + | | Saint Lucia | |
− | Malta | + | | Lesotho | |
− | Northern Mariana Islands | + | | Marshall Islands | |
− | Montserrat | + | | Malta | |
− | Norfolk Island | + | | Northern Mariana Islands | |
− | Niue | + | | Montserrat | |
− | Nauru | + | | Norfolk Island | |
− | New Zealand | + | | Niue | |
− | Palau | + | | Nauru | |
− | Saint Helena | + | | New Zealand | |
− | Seychelles | + | | Palau | |
− | Turks and Caicos Islands | + | | Saint Helena | |
− | Tokelau | + | | Seychelles | |
− | Tonga | + | | Turks and Caicos Islands | |
− | Tuvalu | + | | Tokelau | |
− | United States Minor Outlying Islands | + | | Tonga | |
− | United States | + | | Tuvalu | |
− | Saint Vincent and the Grenadines | + | | United States Minor Outlying Islands | |
− | Virgin Islands, British | + | | United States | |
− | Virgin Islands, U.S. | + | | Saint Vincent and the Grenadines | |
− | Vanuatu | + | | Virgin Islands, British | |
− | Samoa | + | | Virgin Islands, U.S. | |
− | South Africa | + | | Vanuatu | |
− | Zimbabwe | + | | Samoa | |
+ | | South Africa | | ||
+ | | Zimbabwe | | ||
+ | +--------------------------------------+ | ||
+ | 44 rows in set (0.01 sec) | ||
+ | |||
+ | Query OK, 0 rows affected (0.01 sec) | ||
</source> | </source> |
Revisió de 11:29, 15 abr 2020
ASIX M10 UF1
Pt5. Codificació de funcions
Guillem Solà i Boeck (host: PC05)
Enunciat
Crear un procediment/funció, de tal forma que si li passem el nom d'un llenguatge, ens mostri els paisos que el tenen com a oficial.
Solució
CREATE DEFINER=`root`@`localhost` PROCEDURE `paisos_llengua`(in llenguatge varchar(30)) BEGIN DECLARE pais varchar(30); SELECT Country.Name FROM CountryLanguage JOIN Country ON Country.Code = CountryLanguage.CountryCode WHERE CountryLanguage.Language=llenguatge AND CountryLanguage.IsOfficial="T"; END
Execució
MariaDB [world]> call paisos_llengua("English");
+--------------------------------------+ | Name | +--------------------------------------+ | Anguilla | | American Samoa | | Antigua and Barbuda | | Australia | | Belize | | Bermuda | | Barbados | | Canada | | Cocos (Keeling) Islands | | Christmas Island | | Cayman Islands | | Falkland Islands | | United Kingdom | | Gibraltar | | Guam | | Hong Kong | | Ireland | | Saint Kitts and Nevis | | Saint Lucia | | Lesotho | | Marshall Islands | | Malta | | Northern Mariana Islands | | Montserrat | | Norfolk Island | | Niue | | Nauru | | New Zealand | | Palau | | Saint Helena | | Seychelles | | Turks and Caicos Islands | | Tokelau | | Tonga | | Tuvalu | | United States Minor Outlying Islands | | United States | | Saint Vincent and the Grenadines | | Virgin Islands, British | | Virgin Islands, U.S. | | Vanuatu | | Samoa | | South Africa | | Zimbabwe | +--------------------------------------+ 44 rows in set (0.01 sec) Query OK, 0 rows affected (0.01 sec)