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 将数据的行格式转化成列的形式
查询指定数据库'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'