English 中文(简体)
是否应按SQL标准对按集团划分的结果进行分类?
原标题:Is the result of GROUP BY should be sorted accordingly the SQL standard?
  • 时间:2012-05-24 19:12:42
  •  标签:
  • sql

是否应按SQL标准对按集团划分的结果进行分类?

许多数据库都按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、按类别、

但它是否按照SQL92或其他标准执行?

问题回答

编号 GROUP by 对返回的行序没有标准影响。 这是 ORDER by 的设计目的。

如果您正在得到某种由 GROUP by 返回的可重复或可预测的排序顺序,那就是在您的 DBMS 中正在做的某件标准中没有定义的事情。

正如先前的答复所解释的,除 < code> ORDER by 之外,任何基本的SQL结构都从未隐含任何分类。

然而,要用 < code> GROUP by 来计算 < code> GROUP by ,可以进行索引扫描或模拟排序(以创建桶),而这种索引扫描或排序意味着数据按分类顺序穿行。因此,特定数据库经常使用这种方式并非偶然。但是,不要依赖它,因为使用不同的索引组,甚至只是不同的查询计划(可能由几个插入和(或)数据库服务器的重新启用等少量触发),其行为可能大不相同。

还请注意,将 ORDER 条款中的列列表重新排序为 条款将导致可靠地对输出重新排序,而将 GROUP 中的列列表重新排序为 条款则可能没有任何效果。

使用似乎“ 冗余” 命令按部就班的运行成本并不高。 如果原始的已保证的分类输出, 查询计划可能完全相同 。

Um, 按组别按输出进行分类没有达到标准,因为分组的标准算法不产生结果。

其中最常见的是使用散列表进行分组。

此外,在多行服务器上,可以对数据进行分类,但结果将逐个处理返回处理器。不能保证最低订单处理器将首先返回数据。

此外,在平行的机器上,数据可能用多种方法在处理器之间分割。例如,所有以“a”结尾的字符串都可能转到一个处理器。所有以“b”结尾的字符串都可以转到另一个处理器。然后,这些数据可以在本地进行分类,但结果本身不会在整体上进行分类。

数据库,例如保证在组之后再进行某种类型的 Mysql 数据库,在设计决定方面做得不好。 除了不符合标准之外,这些数据库要么限制算法的选择,要么对订单施加额外的处理。





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

难以执行 REGEXP_SUBSTR

I m 查询Oracle 10g。 我有两张表格(样本数据见下文)。 i m 试图提取一些领域

SQL Query Shortcuts

What are some cool SQL shorthands that you know of? For example, something I learned today is you can specify to group by an index: SELECT col1, col2 FROM table GROUP BY 2 This will group by col2

PHP array callback functions for cleaning output

I have an array of output from a database. I am wondering what the cleanest way to filter the values is example array Array ( [0] => Array ( [title] => title 1 ...

OracleParameter and DBNull.Value

we have a table in an Oracle Database which contains a column with the type Char(3 Byte). Now we use a parameterized sql to select some rows with a DBNull.Value and it doesn t work: OracleCommand ...

Running numbers in SQL

I have a SQL-statement like this: SELECT name FROM users WHERE deleted = 0; How can i create a result set with a running number in the first row? So the result would look like this: 1 Name_1 2 ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签