SQL exercises
January 24, 22:10 MSK


forgot password?

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

Would you get the following certificate?
Such certificate is necessary on a site, but not for me
Probably I would get it for supporting the project
Such certificate is unnecessary one

View Results

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

Аль факер
аль факер

SQL Exercises news letters, latest issue

#642 (2017-01-21)

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 exercise (SELECT) is available now for discussion under the number of 306 (1 point).
The old #136 is now in the learn stage under the number 136.
Mobile application from Dmitry Ponomarenko is now available for work with site forums. Try this.
The most popular topics of the forum
Topic        Messages
Authors of the week in the forum
Author	Messages
selber  	11
Gosha		10
gsvg		9
Kursist		8
qwrqwr  	7
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
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):
50. Anton (164, 184)
64. mcrain (186, 209)
109. selber (142, 254)
Applicants for Top 100 have advanced in rating:
109. selber (166, 584.735)
200. Gosha (112, 261.910)
278. furie (93, 1189.739)
Number of subscribers - 3230
Number of rating's participants - 12934
Number of second-stage's participants - 2949
Number of third-stage's participants - 118
On the learning stage - 203043
Certified specialists in total - 755

ТОР 20

NoPersonNumber of
Last_SelNumber of
1Bezhaev A.Yu. (Baser)1254305296202441197.797175.1682222017-01-062017-01-14
2Kreslavskij O.M. (Arcan)1254306296193634257.483200.9002202017-01-132017-01-20
3Boiko D. (Angellore)12522222961534354677.3153268.2362182017-01-052017-01-08
4Karasyova N.V. (vlksm)1248219286053631274.404226.4842122016-04-222017-01-16
5Filippkin D.V. (_dimon_)1246115295992737194.624127.9092022016-07-202016-09-29
6Kurochkin P.A. (qwrqwr)1245306295932622250.314159.3151952017-01-142017-01-20
7Movlyanov A.P. (Oct)72463062959013002353.7482448.8471932017-01-162017-01-20
8Dubinskij A.V. (_velial)12412102958624922601.5323176.5401892016-09-092017-01-01
9Sal'nikov S.A. ($erges)122920625553253317.53314.4981812015-02-022016-08-11
10>Krasovskij E.A. (pegoopik)9239306295742388205.9199.8261752017-01-202017-01-20
11Kostomarov A.V. (al29)92081942851417241698.5001284.6831662017-01-132017-01-20
12Yatsuk A.A. (Faust_zp)1188255244611984144.150108.8401372012-07-122012-07-30
13Kukushkin S.A. (smog)921345274911829950.7721059.9751242016-04-122017-01-20
14Kuznetsov V.S. (herrRo)1173260234201167478.51173.3351222012-02-082013-06-18
15Grinkevich D.L. (Dmitrij Grinkevich)1320545274681652367.281932.3431092016-04-192017-01-20
16Drozdkov A.N. (anddros)51941624447224412.34111.0911082014-07-212015-01-29
17Shindin A.V. (AlShin)114925223368928408.505777.457992011-05-052014-05-18
18Vyazovetskov A.S. (alex_v)15178187234073246123.34242.620972015-04-282015-06-05
19Timofeeva E.V. (Umrikhina)120619529478301050.36747.237962016-07-212016-12-26
20Tarasov D.B. (Gavrila)916615233952427151.34399.710952012-04-232012-05-25

Best results for last week

1>Gorbenko P.E. (Paukanishe)13502602685220 Jan 2017
2>Grishunin M.F. (MikhailFG)9461801892220 Jan 2017
3>Chernov D. (Kursist)8851701733820 Jan 2017
4Karashasheva A.M. (lina_karashash)74117017101519 Jan 2017
5>Faust (Mitrandir Hex)141416016436020 Jan 2017
6Shkarednyj (Gosha)51121401420020 Jan 2017
7>Krasavina O.V. (Chatte)4811121339520 Jan 2017
8Klimenko (Klimenko Andrej)4741001064818 Jan 2017
9>Votrina A. (Almir4ik)5591001070020 Jan 2017
10Bukreev A. (AlxB)61172835237919 Jan 2017
11Dedkov D.A. (dsni)526606291717 Jan 2017
12Kuznetsov (avk-odn)613606444417 Jan 2017
13Belyaev A.V. (fduchuni)354711286220 Jan 2017

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

§ All articles from news letters are putting on the site Books and articles about SQL thereafter.

§ We invite you to visit the Interactive SQL textbook.
    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 5, PostgreSQL 9.

§ If you like this site, vote for us:

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