mysql和oracle的语法上的差异

mysql:

子查询必须写表别名

delete语句不能使用表别名

分页查询用limit关键字

主键自增长

limit在order by 子句的后面  where condition order by  condition limit num

关键字前后必须有空格 如 order前 必须要有空格

一些表达式必须连续的写,如>= 中间不能含有空格


oracle:以上所列不必遵守 

                分页用rownum关键字,且在order by 语句的前面    where condition and rownum <10 order by condition

order的主键生成方式,一般用序列生成seq


oracle独有的函数:

to_date(将字符串类型的数据转化成时间类型)  to_date(column,'yyyy-MM-dd HH24:mi:ss')

to_char(将时间类型的数据转化成字符串类型) to_char(column ,'yyyy-MM-dd HH24:mi:ss')

sysdate 获取数据库所在服务器的时间

decode 可以转义为case when …… then …… when …… then ……end 的形式

nvl 可以转义为 case when …… then …… else …… end 的形式

start   with …… connect by prior 树结构的数据

wmsys>wm_concat 将数据的行格式转化成列的形式

ROWNUMBER() OVER( PARTITION BY COL1 ORDER BY COL2)按照col1字段分组并按照字段col2进行排序



查询指定数据库'csdb'是否存在表名为'student': mysql:
select count(*) from information_schema.tables where table_schema='csdb' and table_type='base table' and table_name ='student';


查询指定数据库'csdb'中指定表'users'的所有字段名column_name
select column_name from information_schema.columns where table_schema='csdb' and table_name='users'


oracle: select count(*) from user_tables where table_name='student'


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值