SQL exercises
February 26, 17:42 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

#647 (2017-02-25)

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.
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
eugene.dnepr	20
Chernov_AN	10
mcrain  	4
daromchto	3
pegoopik  	2
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):
4. Pegoopik (151)
11. al29 (196, 205)
37. labuch_fedev (196)
53. mcrain (139, 140, 142)
87. selber (140)
Have completed the 2nd-stage testing:
120. VadimI (tasks 144, time 23.698)

New persons in TOP 100 or have returned (solved exercises and 2nd-stage time):
87. selber (168, 685.503)
Applicants for Top 100 have advanced in rating:
120. VadimI (144, 23.698)
127. wqer (134, 91.269)
130. Kazaam (140, 59.988)
151. HandKot_ (131, 2442.286)
226. Kursist (100, 47.769)
Number of subscribers - 3234
Number of rating's participants - 11689
Number of second-stage's participants - 2965
Number of third-stage's participants - 118
On the learning stage - 207372
Certified specialists in total - 762

ТОР 20

NoPersonNumber of
Last_SelNumber of
1Kreslavskij O.M. (Arcan)1254222296203652258.362201.7732222017-01-312017-02-24
2Bezhaev A.Yu. (Baser)1253305296192441197.797175.1682222017-01-062017-02-01
3Boiko D. (Angellore)12512222961434354677.3153268.2362182017-01-052017-02-23
4Krasovskij E.A. (pegoopik)4251151296122418207.42511.3282142017-02-192017-02-24
5Karasyova N.V. (vlksm)1251221296123914275.181226.9262142017-01-302017-02-23
6Filippkin D.V. (_dimon_)1245115295982737194.624127.9092022016-07-202016-09-29
7Kurochkin P.A. (qwrqwr)124410295922628250.316159.3151952017-01-202017-02-23
8Movlyanov A.P. (Oct)7245102958913072353.7512448.8471932017-01-232017-02-24
9Dubinskij A.V. (_velial)1241102958626332601.5413176.5401892017-01-282017-02-24
10Sal'nikov S.A. ($erges)122820625552253317.53314.4981812015-02-022016-08-11
11Kostomarov A.V. (al29)92111962952317631710.8311296.7491712017-02-212017-02-24
12Yatsuk A.A. (Faust_zp)1187255244601984144.150108.8401372012-07-122012-07-30
13Kukushkin S.A. (smog)9213115274922115985.9781059.9751242017-01-232017-01-23
14Kuznetsov V.S. (herrRo)1172260234191167478.51173.3351222012-02-082013-06-18
15Grinkevich D.L. (Dmitrij Grinkevich)1320445274671652367.281932.3431092016-04-192017-02-09
16Drozdkov A.N. (anddros)51931624446224412.34111.0911082014-07-212015-01-29
17Shindin A.V. (AlShin)114825223367928408.505777.457992011-05-052014-05-18
18Vyazovetskov A.S. (alex_v)15177187234063246123.34242.620972015-04-282015-06-05
19Timofeeva E.V. (Umrikhina)12061029478321450.38047.237962017-02-102017-02-20
20Tarasov D.B. (Gavrila)916515233942427151.34399.710952012-04-232012-05-25

Best results for last week

1>Karlov A. (karlov-aa)124125025100824 Feb 2017
2Grishunin M.F. (MikhailFG)4881201229122 Feb 2017
3>Rzazade N.M. (Natiq849)73712012106424 Feb 2017
4Hans L.J. (LHans)101012012461324 Feb 2017
5Sasinovich E.M. (liza sasinovich)88101121434224 Feb 2017
6Ilyasov V. (VadimI)214490912022 Feb 2017
7>Sil'van (silvr)632909130924 Feb 2017
8P_ N. (no_more)527909269124 Feb 2017
9Chernov D. (Kursist)210070722624 Feb 2017
10Rusakov S.S. (Stas123)423707155422 Feb 2017
11Poltoranin S.S. (Stas911)424707160123 Feb 2017
12Doschenko V.N. (mcrain)31676065324 Feb 2017
13Vlasov (HandKot_)213160615121 Feb 2017
14>Bukreev A. (AlxB)340606102424 Feb 2017
15>Ivanov (w12)4452833293324 Feb 2017
16Pantileenko D. (iriswind1)513527219322 Feb 2017
17Kostomarov A.V. (al29)22115051124 Feb 2017
18Fedevych V.I. (labuch_fedev)21825053722 Feb 2017
19Vasil'ev A. (kans)327505110523 Feb 2017
20>Chukavin M. (rfv45uklwd)320448170924 Feb 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-2017. All rights reserved.