tag:blogger.com,1999:blog-265587150912543268.post2912471334229607077..comments2022-10-22T09:41:03.443+02:00Comments on johto's lair: SQL gotcha of the weekMarko Tiikkajahttp://www.blogger.com/profile/10981554077352841785noreply@blogger.comBlogger18125tag:blogger.com,1999:blog-265587150912543268.post-60196375667803112842020-05-11T07:16:56.219+02:002020-05-11T07:16:56.219+02:00With expanded rivalry, continually changing calcul...With expanded rivalry, continually changing calculations and internet searcher rules, Search <a href="https://thesims4mods.com/download-the-sims-4-ui-mod/" rel="nofollow">UI Cheats Extension Sims 4 2k20</a> Engine Optimization (SEO) presently requires a lot higher ability to deal with it. Mods2k20https://www.blogger.com/profile/18240856498713157467noreply@blogger.comtag:blogger.com,1999:blog-265587150912543268.post-71761736226601932982017-01-04T12:24:55.087+01:002017-01-04T12:24:55.087+01:00Thanks for providing this informative informatio...Thanks for providing this informative information you may also refer.<br />http://www.s4techno.com/blog/2016/07/27/introduction-to-sql/<br />shivhttps://www.blogger.com/profile/11907687058520596789noreply@blogger.comtag:blogger.com,1999:blog-265587150912543268.post-64308293751604851202014-04-27T21:17:45.966+02:002014-04-27T21:17:45.966+02:00MySQL (MariaDB) is strange too:
MariaDB [(none)]&g...MySQL (MariaDB) is strange too:<br />MariaDB [(none)]> SELECT 'foo',('foo' 'bar');<br />+-----+--------+<br />| foo | foo |<br />+-----+--------+<br />| foo | foobar |<br />+-----+--------+<br /><br />I concatenates the two strings. Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-265587150912543268.post-52378848866417655672014-04-27T15:14:51.180+02:002014-04-27T15:14:51.180+02:00indeed strange. and oracle in every case expects &...indeed strange. and oracle in every case expects "FROM" ORA-00923: FROM keyword not found where expected : SELECT 'foo' "bar"; You have touched interesting case ;)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-265587150912543268.post-25498371719510443922014-04-27T15:03:42.552+02:002014-04-27T15:03:42.552+02:00@Anonymous: That's interesting. Looks like th...@Anonymous: That's interesting. Looks like the SQL server doesn't follow the standard here. For example:<br /><br />SELECT 'foo'<br />'bar';<br /><br />appears to be equivalent to SELECT 'foo' "bar"; i.e. a single column with the value of 'foo' called "bar", which obviously won't work in an IN list.Marko Tiikkajahttps://www.blogger.com/profile/10981554077352841785noreply@blogger.comtag:blogger.com,1999:blog-265587150912543268.post-77854924598198881172014-04-27T14:59:47.836+02:002014-04-27T14:59:47.836+02:00@Anonymous: That's a single string literal wit...@Anonymous: That's a single string literal with an escaped single quote in the middle. See e.g. the result of SELECT 'foo''bar';Marko Tiikkajahttps://www.blogger.com/profile/10981554077352841785noreply@blogger.comtag:blogger.com,1999:blog-265587150912543268.post-72840232326627139152014-04-27T14:56:18.070+02:002014-04-27T14:56:18.070+02:00yes, I did and still got the same error. but maybe...yes, I did and still got the same error. but maybe this is just sqlfiddle?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-265587150912543268.post-79093526411881889222014-04-27T14:53:43.706+02:002014-04-27T14:53:43.706+02:00@Marko Tiikkaja: even without the newline postgres...@Marko Tiikkaja: even without the newline postgresql doesn't throw any error: http://sqlfiddle.com/#!15/d41d8/1812/0Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-265587150912543268.post-89318850152947084602014-04-27T14:50:35.835+02:002014-04-27T14:50:35.835+02:00Did you try it with our without a newline? The SQ...Did you try it with our without a newline? The SQL standard requires a newline between the literals for this to "work".Marko Tiikkajahttps://www.blogger.com/profile/10981554077352841785noreply@blogger.comtag:blogger.com,1999:blog-265587150912543268.post-75321981696741652972014-04-27T14:49:12.697+02:002014-04-27T14:49:12.697+02:00SQL Server 2012 reports an error: Incorrect syntax...SQL Server 2012 reports an error: Incorrect syntax near the keyword 'in'.: SELECT 'foo' in ('foo' 'bar')Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-265587150912543268.post-79840804607306715372014-04-27T10:32:29.474+02:002014-04-27T10:32:29.474+02:00Kowalski!Kowalski!afefelovhttps://www.blogger.com/profile/17347026148012583230noreply@blogger.comtag:blogger.com,1999:blog-265587150912543268.post-34274633871013580612014-04-27T07:32:05.408+02:002014-04-27T07:32:05.408+02:00Hmm, guess which other open-source database treats...Hmm, guess which other open-source database treats all whitespace (not just new lines) between string literals as an opportunity to concatenate them, no questions asked.Ian Barwickhttp://sql-info.de/noreply@blogger.comtag:blogger.com,1999:blog-265587150912543268.post-74843847083013311902014-04-27T04:51:27.943+02:002014-04-27T04:51:27.943+02:00The point is that "SELECT 'foo' IN (&...The point is that "SELECT 'foo' IN ('foo' 'bar')" will result an error, but the additional newline causes the strings to be concatenated, which will cause some head-scratching if you accidentally missed the comma.Ian Barwickhttp://sql-info.de/noreply@blogger.comtag:blogger.com,1999:blog-265587150912543268.post-50309678354467748002014-04-26T23:29:19.742+02:002014-04-26T23:29:19.742+02:00the correct syntax is:
SELECT 'foo' IN (&#...the correct syntax is:<br />SELECT 'foo' IN ('foo', 'bar');ELISEU SCHMIDThttps://www.blogger.com/profile/00918900144567441060noreply@blogger.comtag:blogger.com,1999:blog-265587150912543268.post-73535859245787030972014-04-26T19:51:38.382+02:002014-04-26T19:51:38.382+02:00Yeah, the quirk of SQL string lexing. The standard...Yeah, the quirk of SQL string lexing. The standard is really weird on this point.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-265587150912543268.post-89684475551295792132014-04-26T19:29:52.240+02:002014-04-26T19:29:52.240+02:00It's because a newline between two single-quot...It's because a newline between two single-quoted literals concatenates the two. Without the newline, this would not be valid SQL.Marko Tiikkajahttps://www.blogger.com/profile/10981554077352841785noreply@blogger.comtag:blogger.com,1999:blog-265587150912543268.post-3839320522961311422014-04-26T19:27:55.010+02:002014-04-26T19:27:55.010+02:00can someone explain why this is a valid statement?...can someone explain why this is a valid statement? Shouldn't the missing comma throw an error?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-265587150912543268.post-23514106161115822742014-04-26T18:08:28.127+02:002014-04-26T18:08:28.127+02:00Yeah, there is no comma between the foo and bar.Yeah, there is no comma between the foo and bar.Alexeyhttps://www.blogger.com/profile/09418624687521812667noreply@blogger.com