SQL exercises
May 21, 08:16 MSK


forgot password?

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

SQL Exercises news letters, latest issue

#711 (2018-05-19)

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.

The most popular topics of the forum
Topic        Messages
Authors of the week in the forum
Author	Messages
selber  	4
kostushko	4
aks_nsk  	4
qwrqwr  	3
Cordova  	3
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):
9. alex_v (161)
31. xLiSPirit (203)
41. Gosha (152)
48. aks_nsk (258)
Applicants for Top 100 have advanced in rating:
133. SN 209 (139, 2225.417)
142. hard (129, 456.687)
181. mitvol (117, 23.830)
198. Pusev_Denis (101, 13.607)
243. eXeQuThor (96, 17.301)
251. lnl122 (104, 98.916)
255. Ranil (98, 278.851)
Have been certified last week:
Cordova (A18402112) [BK] - Moskva, Rossiya
Number of subscribers - 3031
Number of rating's participants - 12044
Number of second-stage's participants - 3072
Number of third-stage's participants - 127
On the learning stage - 251208
Certified specialists in total - 793

ТОР 20

NoPersonNumber of
Last_SelNumber of
1Krasovskij E.A. (pegoopik)1264227346492851210.25414.1242402018-04-282018-05-13
2>Kostomarov A.V. (al29)1252953162422144128.3412266.8982402018-05-182018-05-18
3Kreslavskij O.M. (Arcan)1263229346464090273.280214.6142372018-04-142018-05-18
4Boiko D. (Angellore)12632283364538465236.4073825.1402372018-02-202018-03-23
5Bezhaev A.Yu. (Baser)1262227346432924201.513178.8212342018-05-042018-05-06
6Dubinskij A.V. (_velial)12593073463730932797.3933371.3762282018-05-032018-05-16
7Karasyova N.V. (vlksm)1259225346334354290.336241.6822242018-04-152018-05-05
8Kurochkin P.A. (qwrqwr)1255223346213078255.904164.3922122018-04-152018-05-18
9Vyazovetskov A.S. (alex_v)9240161235634361177.45294.1962052018-05-172018-05-17
10Filippkin D.V. (_dimon_)1244115295972737194.554127.9092022016-07-202016-09-29
11Movlyanov A.P. (Oct)7244102958813072353.7232448.8471932017-01-232017-04-03
12Sal'nikov S.A. ($erges)122720625551253317.50514.4981812015-02-022018-01-23
13Doschenko V.N. (mcrain)132231673454923971929.011414.1881802018-04-252018-05-18
14Kukushkin S.A. (smog)92251632952723681054.5621122.1811532017-10-032018-05-11
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-04-20
18Drozdkov A.N. (anddros)51921624445224412.34111.0911082014-07-212015-01-29
19Zajtsev V.S. (Sleeping)192091842746036011040.0531327.686992018-04-172018-04-19
20Shindin A.V. (AlShin)114725223366928408.505777.457992011-05-052014-05-18

Best results for last week

1>kalyan (kalyan_123)25534604686318 May 2018
2>Agirre Kordova A.K. (Cordova)19643503564318 May 2018
3>Kim A.S. (Andrian)162721021128618 May 2018
4>Tikhonov A. (_Saw)132720020251018 May 2018
5>Viktorov V. (viktor-orenb)7521301387718 May 2018
6Mikhalenkov S.V. (black_horse)77909535618 May 2018
7>Kravchenko S.N. (strangers)637707106118 May 2018
8>Chukanov V.S. (VSC)335707121818 May 2018
9Kudravtsev V.S. (Vitaliy_Kudravtsev)43950599117 May 2018
10>Mityurin V. (mitvol)111740418118 May 2018
11Pusev D.V. (Pusev_Denis)110140419818 May 2018
12Rakhmatullin R. (Ranil)29840425518 May 2018
13G N.E. (gana)27540466518 May 2018
14Boronin M.V. (makc-nv)45340487818 May 2018
15Volkov S. (Wolf778)242404144517 May 2018
16Yurin D.I. (Diman9425)225404292917 May 2018
17Kolesnikov (hard)112931414218 May 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, MariaDB-10.2.13 (compatible with MySQL 8), PostgreSQL 10.3.

§ If you like this site, vote for us:

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