SQL exercises
January 19, 18:38 MSK


forgot password?

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

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

SQL Exercises news letters, latest issue

#693 (2018-01-13)

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 and replacements of exercises
306 -> 69 -> 50 -> 17 -> 9 -> 7 -> 142 (Learning stage).
228 - new exercise from qwrqwr (2 points).
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:
120 (SELECT, learn) - formulation from Kursist.

The most popular topics of the forum
Topic        Messages
Authors of the week in the forum
Author	Messages
selber  	14
qwrqwr  12
Kursist	10
Gosha	6
kay1992	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
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):
3. Arcan (227)
6. vlksm (223)
7. al29 (212)
14. alex_v (165)
24. y4nzi (179, 204, 209)
45. Kursist (224)
65. selber (253)
Applicants for Top 100 have advanced in rating:
138. Margarita_K (127, 45.048)
144. Alexander_ttl (132, 318.823)
211. pavel1211 (107, 36.699)
214. Tsarapkin (109, 468.140)
217. parra (103, 455.198)
239. Lesya1 (106, 240.940)
257. Chatte (104, 178.922)
Have been certified last week:
pavel1211 (A18170633) [BK] - g. Moskva, Rossiya
Number of subscribers - 3014
Number of rating's participants - 11967
Number of second-stage's participants - 3047
Number of third-stage's participants - 126
On the learning stage - 238370
Certified specialists in total - 788

ТОР 20

NoPersonNumber of
Last_SelNumber of
1Boiko D. (Angellore)12633063364437805232.3843821.1172352017-12-162018-01-09
2Krasovskij E.A. (pegoopik)1262306336422719209.88213.7522332017-12-172018-01-12
3Kreslavskij O.M. (Arcan)1262227336413992268.784210.1192322018-01-062018-01-12
4Bezhaev A.Yu. (Baser)1258225316302636199.875177.3102272017-07-202017-12-12
5Dubinskij A.V. (_velial)1257953363029412793.3693368.3692252017-12-022018-01-03
6Karasyova N.V. (vlksm)1257223326264257288.515239.8612182018-01-082018-01-08
7>Kostomarov A.V. (al29)72382123058920882392.7692155.9642162018-01-122018-01-12
8Filippkin D.V. (_dimon_)1245115295982737194.554127.9092022016-07-202016-09-29
9Kurochkin P.A. (qwrqwr)1250219336072966253.034161.5211982017-12-242018-01-12
10Movlyanov A.P. (Oct)7245102958913072353.7232448.8471932017-01-232017-04-03
11Sal'nikov S.A. ($erges)122820625552253317.50514.4981812015-02-022017-04-13
12Kukushkin S.A. (smog)92261632952823681054.5621122.1811532017-10-032017-12-25
13Yatsuk A.A. (Faust_zp)1187255244601984144.150108.8401372012-07-122012-07-30
14Vyazovetskov A.S. (alex_v)14210165234804235134.85951.6651232018-01-112018-01-12
15Kuznetsov V.S. (herrRo)1172260234191167478.51173.3351222012-02-082013-06-18
16Doschenko V.N. (mcrain)152012193348122781817.100302.2771122017-12-272018-01-12
17Grinkevich D.L. (Dmitrij Grinkevich)1320510274682059367.128932.3431092017-05-312018-01-11
18Drozdkov A.N. (anddros)51931624446224412.34111.0911082014-07-212015-01-29
19Shindin A.V. (AlShin)114825223367928408.505777.457992011-05-052014-05-18
20Timofeeva E.V. (Umrikhina)12061031480338150.34747.237962017-07-272017-10-20

Best results for last week

1>Pusev D.V. (Pusev_Denis)14673103180712 Jan 2018
2>Yakovlenko V.G. (musthacrackezh)9611601679212 Jan 2018
3>Mendoza A. (AlvaroMendoza)82613013291312 Jan 2018
4Malyshkin (Andrey_Mal)111512012424612 Jan 2018
5>Zvon (pavel1211)51071101121112 Jan 2018
6>G N.E. (gana)9911011490012 Jan 2018
7>Aliev R. (y4nzi)52119092412 Jan 2018
8>Nikanorov (parra)210380821712 Jan 2018
9Pejsakhovich L. (PLP39)5561723378112 Jan 2018
10Volkov S. (ctacukoc)417606201112 Jan 2018
11Nazarova (L__)515549212311 Jan 2018
12>KsNV (KsNV_)237505119912 Jan 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 5, PostgreSQL 9.

§ If you like this site, vote for us:

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