SQL exercises
March 23, 02:34 MSK


forgot password?

Personal page
Developers & Thanks
For employers
Support SQL-EX.RU

Сколько стоит адвокат по уголовным делам
Адвокат по уголовным делам. Профессиональная помощь. Звоните

SQL Exercises news letters, latest issue

#702 (2018-03-17)

Week news

As the important news can appear and between releases of news letters, I shall use this page for the publication of the information on all changes on the site.
The forum is not so suitable for this purpose since the message there "escapes" and can appear on previous page before it will lose a urgency.
So look in here if you wish to be well informed about last events on the site. The link to this page is in section of news at the main page below a subscription banner.
New version of mobile application from Dmitry Ponomarenko is now available for work with site forums and more. Try this.

Has corrected a bug with checking the exercises:
(-2) (SELECT, rating) - formulation from kay1992.

The most popular topics of the forum
Topic        Messages
Authors of the week in the forum
Author	Messages
_Saw	12
juanas	7
Askin	7
Kuzaev	7
selber  6
Available competitions on query optimization
Exercise	Date	     Author
147	2012-02-23	$erges
159	2012-07-25	anddros
170	2011-07-15	qwrqwr
182	2012-02-16	Baser
192	2012-03-03	Baser
197	2014-11-06	pegoopik
214	2015-06-24	pegoopik
222	2018-02-14	pegoopik
259	2012-07-23	anddros
Additional non-optimization competitions
Exercise	Date	Author/Organizer of competition
71	2010-12-26	anddros (closed)
88	2012-07-12	crescent/Pegoopik  (closed)
91	2012-05-31	smog/$erges
102	2016-07-04	GriGrim/pegoopik
121	2012-07-06	ZrenBy/anddros
153	2010-09-21	Ozzy
Changes among leaders (solved exercises of third stage):
8. qwrqwr (223)
14. mcrain (187, 188)
24. Sleeping (153, 207)
58. Gosha (156, 256)
Applicants for Top 100 have advanced in rating:
213. Tsarapkin (109, 474.593)
281. Nechaeva Olga (94, 2960.740)
287. eXeQuThor (88, 14.323)
300. kattiks (87, 34.116)
Number of subscribers - 3030
Number of rating's participants - 12060
Number of second-stage's participants - 3059
Number of third-stage's participants - 127
On the learning stage - 245197
Certified specialists in total - 790

ТОР 20

NoPersonNumber of
Last_SelNumber of
1Boiko D. (Angellore)12632283364638465236.4073825.1402382018-02-202018-03-16
2Krasovskij E.A. (pegooopik)1262228336432749209.94313.8142352018-01-162018-03-16
3Kreslavskij O.M. (Arcan)1262228336433999269.462210.7962352018-01-132018-03-16
4Kostomarov A.V. (al29)42422283160221272435.5752198.7702292018-02-202018-03-16
5Bezhaev A.Yu. (Baser)1257225316292636199.875177.3102272017-07-202018-03-01
6Karasyova N.V. (vlksm)1259225336334301290.336241.6822252018-02-212018-03-16
7Dubinskij A.V. (_velial)1257693363129842793.5243368.3692252018-01-142018-03-14
8Kurochkin P.A. (qwrqwr)1255223336213045255.904164.3922132018-03-132018-03-16
9Filippkin D.V. (_dimon_)1244115295972737194.554127.9092022016-07-202016-09-29
10Movlyanov A.P. (Oct)7244102958813072353.7232448.8471932017-01-232017-04-03
11Sal'nikov S.A. ($erges)122720625551253317.50514.4981812015-02-022018-01-23
12Vyazovetskov A.S. (alex_v)12229218235284285155.55972.3031702018-03-022018-03-16
13Kukushkin S.A. (smog)92251632952723681054.5621122.1811532017-10-032018-03-15
14>Doschenko V.N. (mcrain)142121873351623571890.202375.3791482018-03-162018-03-16
15Yatsuk A.A. (Faust_zp)1186255244591984144.150108.8401372012-07-122012-07-30
16Kuznetsov V.S. (herrRo)1171260234181167478.51173.3351222012-02-082013-06-18
17Grinkevich D.L. (Dmitrij Grinkevich)1320410274672059367.128932.3431092017-05-312018-03-15
18Drozdkov A.N. (anddros)51921624445224412.34111.0911082014-07-212015-01-29
19Shindin A.V. (AlShin)114725223366928408.505777.457992011-05-052014-05-18
20Timofeeva E.V. (Umrikhina)12051032481359650.34747.237962018-02-272018-03-12

Best results for last week

1>Radin P.L. (RadinPL)11561701781216 Mar 2018
2Sorokin D.Yu. (cth)7128614262016 Mar 2018
3G N.E. (gana)46380893316 Mar 2018
4>Alekseeva T.M. (TM)66707576716 Mar 2018
5>Doschenko V.N. (mcrain)22126061416 Mar 2018
6Zajtsev V.S. (Sleeping)22066062416 Mar 2018
7Sidorov A.P. (salex66)210360622310 Mar 2018
8Buldenkov D.A. (eXeQuThor)38850528716 Mar 2018
9>Vasilevskaya E.A. (kattiks)28750530016 Mar 2018
10Yastrebova S.V. (WhiteGoshawk)238505110014 Mar 2018
11Yakovlev M.V. (MikhailYakovlev535)314505391916 Mar 2018
12Vestnikov (letsstudybegin)515505424815 Mar 2018
13>Alexenko V. (vova.alexenko)44505643216 Mar 2018
14>KsNV (KsNV_)24640498216 Mar 2018
15>Volkov S. (VolkovSA)244404100616 Mar 2018
16>Sal K.S. (Kseksekse)33404741516 Mar 2018

Let's learn SQL

MySQL. Usage of query variables

E.A. Krasovskiy

People rather often ask whether there are equivalents for analytic (windowing) functions in MySQL. No, there are not. To replace them, self join queries, complex subqueries, etc, are used. Most of such workarounds turn out to be ineffective.

There are no recursive queries in MySQL either. However, a part of problems usually solved by analytic functions or recursive queries can be handled by features available in MySQL.

One of these features is the unique mechanism of processing variables within a SQL query, which is very unusual for other DBMS. In MySQL, you can declare a variable within a query, change its value, and put it into the result set of the SELECT statement for output. And the most notable thing is, the processing order for query rows, and thus the order values are assigned to variables, can be defined by custom sorting!

Note: this article implies expressions within the SELECT statement are processed in order from left to right; however, there is no confirmation of such a processing order in the official MySQL documentation. You need to keep that in mind when switching from one server version to another. To ensure the required evaluation order, a fake CASE or IF statement can be used.

Read more:
Equivalent of recursive CTEs
Equivalents for analytic functions

Useful links

§ Official communities of the site sql-ex in social networks: SQL Exercises at VK.com and SQL Exercises at LinkedIn.com

§ .
    The resource is positioned as a "handbook" for this site SQL-EX.COM, but can be used irrespective of it also.

§ The following DBMS are used on the site for solving exercises: SQL Server 2012 Express, Oracle Database 11g Express Edition, (совместима с MySQL 8), PostgreSQL 9.

§ If you like this site, vote for us:

Week news
SQL exercises
Rambler's Top100
Copyright SQL-EX © 2002-2018. All rights reserved.