Wednesday, April 15, 2009

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/

No comments:

Post a Comment