微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

SqlServer,mysql,oracle 数据处理语句的区别

sqlServer与MysqL部分语句区别

sqlServer中
select top n* from table order by

MysqL
select * from table limit i,j;     i表示行数起始位置(从零开始),j表示长度

SELECT * FROM Persons LIMIT 5

Oracle 

SELECT * FROM Persons WHERE ROWNUM <= 5

----------------------------------

sqlServer中
identity属性 
create table tablename ( id int identity,) 
id就是自增列。 identity(标识种子,标识递增量)。
已经创建的表无法直接把某字段设置为自增,只能把原来的字段删除,之后再添加具有自增属性的列。 
步骤如下 
--删除列 
alter table a drop column list 
--添加具有identity属性的列 
alter table a add list int identity

MysqL
create table tablename(id int auto_increment not null primary key)

 


 

----------------------------------
sqlServer中
create table tablename(name varchar(30),mytime date default getdate());

MysqL
create table tablename(name varchar(30),mytime timestamp);

----------------------------------


 

Oracle 

时间:sysdate

 

 

oracle 中没有自增长,需要从序列(Sequences)中获得select SEQ_USER(Sequences名字).NEXTVAL  from dual(固定的数据库内置表)

 

MysqL

时间:Now();

 

 

 

数据类型也不一样,在此就不一一列出了。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐