TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Things in MySQL that won't work as expected

25 pointsby rnicholsonover 14 years ago

7 comments

prodigal_erikover 14 years ago
Misleading title. While #4 and #3 look like good ways to avoid relying on a horrible MySQL-only misfeature (silently picking arbitrary values from rows you've grouped over), almost all the other behavior (maybe other than LIMIT in #5) is correct according to the ANSI standard and you'll find other databases do the same.
ceejayozover 14 years ago
What's with the massive photos that have nothing to do with the article?
评论 #1881334 未加载
评论 #1881033 未加载
compayover 14 years ago
Most of the things listed there are not MySQL specific. Here's one that I'm pretty sure is:<p>SELECT * FROM example WHERE value = 'á';<p>where "á" uses UTF-8 encoding.<p>By default this will return rows that match both "á" AND "a", which may or may not be what you want.<p>If you want to make MySQL distinguish between an "a" with an accent and one without, then you need to specify a collation either in the table creation/alter statement, or in your query directly:<p>SELECT * example WHERE value = 'á' COLLATE utf8_bin;
评论 #1882183 未加载
d_rover 14 years ago
Some of these are just silly. E.g.<p><pre><code> WHERE column IN ('1, 2, 3') </code></pre> How can this ever be expected to work, unless, of course your column is literally '1, 2, 3'? Seems strange to blame MySQL for it. ("MySQL is buggy because it cannot infer meaning from my arbitrary string literals!")
评论 #1882172 未加载
tzsover 14 years ago
A lot of these come down to NULL makes things not work the way you might expect. Maybe C. J. Date is rightbwhen he says there should be no NULL in the relational model.
评论 #1881249 未加载
评论 #1881190 未加载
评论 #1881290 未加载
axiakover 14 years ago
haven't we learned that order by rand() is a bad idea?
评论 #1881216 未加载
jpcx01over 14 years ago
Do most of these examples work in Postgres?
评论 #1882176 未加载