ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 【DB2】部分语法SQL

【DB2】部分语法SQL

原创 Linux操作系统 作者:肖_Sean 时间:2012-05-31 22:40:18 0 删除 编辑
1. LEFT OUTER JOIN                                          
2. 查看表结构和索引的命令                                   
  describe table user1.department;                          
  describe select * from user.tables;                       
  describe indexes for table user1.department;              
3. 杀进程                                                   
   FORCE APPLICATION(0);                                    
   db2 force applications all (强迫所有应用程序从数据库断开)
4. 显示当前用户所有表                                       
   list tables                                              
5. 列出所有的系统表                                         
   list tables for system                                   
6. 列出所有表空间                                           
   list tablespaces                                         
7. 当前用户数据库的存取权限                                 
   GET AUTHORIZATIONS;                                      
8. 给表、视图、模式、数据库和索引赋权限                     
   grant select,delete,insert,update on tables to user      
   grant all on tables to user WITH GRANT OPTION            
   GRANT CREATEIN ON SCHEMA SCHEMA-name TO USER             
   grant connect,createtab,dbadm on database to user        
   grant control on index index-name to user                
9. 检查 DB2 数据库管理程序配置                              
   get dbm cfg                                              
10.检索具有特权的所有授权名                                 
   SELECT DISTINCT GRANTEE, GRANTEETYPE, 'DATABASE' FROM SYSC
   UNION                                                    
   SELECT DISTINCT GRANTEE, GRANTEETYPE, 'TABLE ' FROM SYSCAT
   UNION                                                    
   SELECT DISTINCT GRANTEE, GRANTEETYPE, 'PACKAGE ' FROM SYSC
   UNION                                                    
   SELECT DISTINCT GRANTEE, GRANTEETYPE, 'INDEX ' FROM SYSCAT
   UNION                                                    
   SELECT DISTINCT GRANTEE, GRANTEETYPE, 'COLUMN ' FROM SYSCA
   UNION                                                    
   SELECT DISTINCT GRANTEE, GRANTEETYPE, 'SCHEMA ' FROM SYSCA
   UNION                                                    
   SELECT DISTINCT GRANTEE, GRANTEETYPE, 'SERVER ' FROM SYSCA
   ORDER BY GRANTEE, GRANTEETYPE, 3;                        
11.修改表结构                                               
   alter table tab_name ALTER 列名 SET DATA TYPE varchar(13);

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26952448/viewspace-731617/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2012-05-07

  • 博文量
    9
  • 访问量
    31901