Differences between SQL server and mysql in the implementation of select clauses in group

Source: Internet
Author: User

When I read an article about SQL puzzles-36: dual responsibility, I downloaded the second version of SQL puzzles. By default, the group by processing between SQL server and mysql is different. In SQL server, the field in the select list is either a field in the group by field group or a max/min/sum/constant. Mysql supports fields not in group.

For example, select name, max (registerdate) as registerdate from registration group by name having count (0) = 1; is written in SQL server, and can be written in mysql: select name, registerdate as registerdate from registration group by name having count (0) = 1; // indicates obtaining the user name and registration time that are registered only once, this statement cannot be run in SQL server, and an error is reported: Msg 8120, Level 16, State 1, Line 1.

In fact, in mysql can set SQL _mode: http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html

I don't know how to implement the select clause of group by. mysql provides different implementations than SQL server. Aren't they all based on sql92 standards? SQL server and mysql have different implementations in the select clause in group by. Obviously, mysql provides more flexibility.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.