Tuesday, September 17, 2013

Microsoft SQL vs MySQL

I'm working with both databases and love them. Here are my notes their SQL syntax difference.

Select first 10 records from table:
In Microsoft SQL:
SELECT TOP 10 SchoolID, SchoolName
FROM schools
ORDER BY SchoolID;

In MySQL:
SELECT SchoolID, SchoolName
ORDER BY SchoolID
LIMIT 10

Create new table and insert data from existing tables
Microsoft SQL:
SELECT * INTO Schools_Bak20130916 FROM Schools;

MySQL:
CREATE TABLE Schools_Bak20130916 SELECT * FROM Schools;

No comments: