TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Things in MySQL that won't work as expected

25 点作者 rnicholson超过 14 年前

7 条评论

prodigal_erik超过 14 年前
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.
ceejayoz超过 14 年前
What's with the massive photos that have nothing to do with the article?
评论 #1881334 未加载
评论 #1881033 未加载
compay超过 14 年前
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_r超过 14 年前
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 未加载
tzs超过 14 年前
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 未加载
axiak超过 14 年前
haven't we learned that order by rand() is a bad idea?
评论 #1881216 未加载
jpcx01超过 14 年前
Do most of these examples work in Postgres?
评论 #1882176 未加载