Differences between SQL Server and MySQL paging queries and creating temporary tables

Source: Internet
Author: User

One:

When paging a query, SQL Server uses the top keyword, and MySQL uses the limit

e.g:

Search for fifth to tenth entry-level staff

SQL server2000:

Select Top 6 * from EMP where empno not in (select Top 4 empno from emp Order by HireDate) order by HireDate;

Mysql:

SELECT * from emp order BY hire date limit 4, 6;

P.s:limit a means the previous a record

Limit A, a, means the record from article (a+1) to article (A+B) and, if b=-1, means from (a+1) to the last record;

Two:

Title: How can I delete duplicate data from a table?

Like there's a watch.

CREATE TABLE Cat (catId int,catname varchar (30));

INSERT into Cat (1, ' AA ');

This sentence is executed nine times;

INSERT into Cat (2, ' BB ');

This sentence is executed nine times;

SQL Server Edition: 4 words

SELECT DISTINCT * to cattemp from cat;

Delete from Cat;

INSERT INTO Cat select * from Cattemp;

drop table cattemp;

MySQL version:

Create temporary table cattemp (SELECT DISTINCT * from cat);

Delete from Cat;

INSERT INTO Cat select * from Cattemp;

drop table cattemp;

Differences between SQL Server and MySQL paging queries and creating temporary tables

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.