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 

 

posted @ 2018-08-22 12:21  吃饭睡觉打豆豆o  阅读(512)  评论(0编辑  收藏  举报