SQL Server 2012 vs MySQL statements

 

SQL Server 2012

MySQL 5.5

1 use master;select  *  from sys.databases; show databases;

 

2 create database yourDatabaseName; Create database yourDatabaseName;

 

3 use yourDatabaseName; use yourDatabaseName;

 

4 select * from sys.tables; show tables;

 

create table yourTableName(    

tablesPrimaryKey varchar(10) primary key,

field1 varchar(10),field2 smallint, field3….

);


create table yourTableName(

tablesPrimaryKey varchar(4) primary key,

field2 varchar(10),

field3 smallint(10),…

);


6 exec sp_help yourTableName;
Describe yourTableName;

 

7 truncate table yourTableName;


Truncate table yourTableName;
8 insert into yourTableName values

(‘xyz’,‘abc’, 123,…);

insert into yourTableName values (“xyz”,”abc”,123,…);

As you can see, the statements are almost identical and are pretty self explanatory. No wonder, they are SeQueL afterall! E.F.Codd and Peter Chen will be happy to see how effective and easy to use/learn the tools and our software turned out to be.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s