Mysql 和 SQLServer 使用SQL差异比较

Posted 吃饭睡觉打豆豆

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mysql 和 SQLServer 使用SQL差异比较相关的知识,希望对你有一定的参考价值。

查询前100条数据

#mysql
select * from table_name limit 100 ;

#sqlserver
select top 100 * from table_name ;

从数据库.表 定位表

#mysql写法:库名.表名

select password from Info.users where userName=boss

#Sqlserver写法:库名.dbo.表名 ;或者:库名..表名 (注:中间使用两个点)

select password from Info.dbo.users where userName=boss

获取时间

MySQL写法:now() 
SQLServer写法:getdate()

联结查询 

# mysql & sqlserver 
select a.* , b.TypeName from Book as a left join BookType as b ON a.TypeId = b.TypeId 

 

以上是关于Mysql 和 SQLServer 使用SQL差异比较的主要内容,如果未能解决你的问题,请参考以下文章