articulus Directory
Usus syntaxis interrogationis/enuntiati UNION ORDER BY in basi datorum MySQL
MySQL CONIUNCTIO operator
Haec doceo te ad syntaxin et exempla MySQL Unionis operantis introducit.
Description
Operator MySQL CONIUNCTIO adhibetur ad coniungendos eventus duorum vel plurium propositionum selectarum in unum effectum statutorum.Multae sententiae selectae duplicata data removent.
grammatica
MySQL CONIUNCTIO operator format syntaxin:
SELECT expression1, expression2, ... expression_n FROM tables [WHERE conditions] UNION [ALL | DISTINCT] SELECT expression1, expression2, ... expression_n FROM tables [WHERE conditions];
Morbi
- expression1, expression2, ... expression_n: columnam capias.
- Tabulae: Data mensa capias.
- Ubi conditiones: Libitum, criteria quaestionis denota.
- DISTINCTUS: Optionally, data duplicata remove ab eventu statuto.CONGREGATIO operator data per defaltam duplicavit, ergo determinatio distincti effectus nullum effectum habet.
- OMNIS: Ad libitum, omnes proventus effectus recurrit, duplicata possidet.
demo database
In hoc doceo, chenweiliang specimen datorum utemur.
Hic est notitia e mensa "Websitarum":
mysql> SELECT * FROM Websites; +----+--------------+---------------------------+-------+---------+ | id | name | url | alexa | country | +----+--------------+---------------------------+-------+---------+ | 1 | Google | https://www.google.cm/ | 1 | USA | | 2 | 淘宝 | https://www.taobao.com/ | 13 | CN | | 3 | 陈沩亮博客 | http://www.chenweiliang.com/ | 4689 | CN | | 4 | 微博 | http://weibo.com/ | 20 | CN | | 5 | Facebook | https://www.facebook.com/ | 3 | USA | | 7 | stackoverflow | http://stackoverflow.com/ | 0 | IND | +----+---------------+---------------------------+-------+---------+
Hic est notitia pro "apps" APP:
mysql> SELECT * FROM apps; +----+------------+-------------------------+---------+ | id | app_name | url | country | +----+------------+-------------------------+---------+ | 1 | QQ APP | http://im.qq.com/ | CN | | 2 | 微博 APP | http://weibo.com/ | CN | | 3 | 淘宝 APP | https://www.taobao.com/ | CN | +----+------------+-------------------------+---------+ 3 rows in set (0.00 sec)
SQL CONIUNCTIO exempli gratia
Sequens mandatum SQL omnes distinctas terras (solum valores distinctos) ex tabulis "Websites" et "apps" deligit:
Exempli gratia
SELECT country FROM Websites UNION SELECT country FROM apps ORDER BY country;
SQL CONIUNCTIO OMNES exempli gratia
Sequens enuntiatio SQL UNION ALL adhibet ad omnes terras (valores duplicatos inclusis) ex tabulis "Websites" et "apps" eligendas:
Exempli gratia
SELECT country FROM Websites UNION ALL SELECT country FROM apps ORDER BY country;
SQL CONIUNCTIO OMNES cum WHERE
Sequens mandatum SQL UNION ALL adhibet ad omnia data pro Sinis (CN) ex tabulis "Websites" et "apps" (valoribus duplicatis inclusis) eligenda:
Exempli gratia
SELECT country, name FROM Websites WHERE country='CN' UNION ALL SELECT country, app_name FROM apps WHERE country='CN' ORDER BY country;
Speramus te utilem fore articulum "Ordo Unionis Secundum Syntaxin Quaerendarum/Usus Enuntiatorum in Database MySQL" in diario interretiali Chen Weiliang ( https://www.chenweiliang.com/ ) communicatum.
Libere hunc articulum communicare potes: https://www.chenweiliang.com/cwl-475.html
