Posted by: Vijay Modi | November 24, 2007

Syntax Difference between MS Sql and My Sql

I got some problem with the guys that they want to know the exact difference between the syntax of MS Sql and My Sql. So I like to write this article on this blog. As you see my articles, I have also write an article for the commercial difference between these two Databases. You can see this article on the following url:  

http://vijaymodi.wordpress.com/2007/03/28/my-sql-vs-ms-sql/

Now I like to give the syntax difference between these two databases. Let me start it now…

> If you want to retrieve the first (Top) four rows from a table by using query you have to write TOP in MS Sql. While for the same purpose, you need to write LIMIT in mysql. The syntax are as follows:

MS SQL:

SELECT TOP(4) * FROM TableName ORDER BY FieldName

MY Sql:

SELECT * FROM TableName ORDER BY FieldName LIMIT 4

> My Sql can insert multiple rows at a time, while MS Sql cannot.

MS SQL:

INSERT INTO tablename VALUES (1,'AAA');
INSERT INTO tablename VALUES (2,’BBB’);
INSERT INTO tablename VALUES (3,’CCC’);

MY SQL:

INSERT INTO tablename
VALUES (1,’AAA’) , (2,’BBB’) , (3,’CCC’);

> MSSQL doesn’t have CHARACTER_LENGTH. Provides the LEN and DATALENGTH functions instead (the latter is especially valid for ’special’ data types like the TEXT type).while MYSQL Provides CHARACTER_LENGTH.
Aliases: CHAR_LENGTH, LENGTH. Note that MySQL removes trailing (not leading) spaces from CHAR values before counting.

To See the other more important difference visit the following link:

http://troels.arvin.dk/db/rdbms/

Responses

very interesting, but I don’t agree with you
Idetrorce

hi Idetrorce,

Let me know, why are you not agree? So that I can change it. Thank you for comment.

Vijay Modi

Hi To all

very good..Thank you for cleared my doubt and also very new. You given that answer with example very good.

Thank you for your information

hey i wanna added n more diff —-Technical - As of versions 4.x MySQL does not support views, triggers, stored procedures, user defined functions, XML, while all these are suported by MS SQL
Non Technical - MS SQL is an expensive (*relatively*) proprietory RDBMS developed & owned by Microsoft Corporation while MySql is an open source RDBMS developed & maintained by MySQL AB of sweden with free as well as paid enterprise versions available.

Leave a response

Your response:

Categories