ASP源码.NET源码PHP源码JSP源码JAVA源码DELPHI源码PB源码VC源码VB源码Android源码
当前位置:首页 >> 数据库 >> DB2 >> DB2常用命令以及错误处理宝典

DB2常用命令以及错误处理宝典(1/6)

来源:网络整理     时间:2015-12-30     关键词:

本篇文章主要介绍了"DB2常用命令以及错误处理宝典",主要涉及到方面的内容,对于DB2感兴趣的同学可以参考一下: 1、打开数据库db2 connect to 数据库名;2、查看数据库中有哪些表db2 list tables ;3、查看数据库中的表结构db2 describe...

1、打开数据库

db2 connect to 数据库名;

2、查看数据库中有哪些表

db2 list tables ;

3、查看数据库中的表结构

db2 describe table 表名;

db2 describe table 表名 show  detail ;(详细的结构)

4、查看表的索引

db2 describe indexes for table表名   (显示所有索引的标识,但是不会显示字段)

db2 describe indexes for table 表名 show detail (显示各种索引的字段名)

5、查询语句 select

(1)基本查询语句:

db2 "select * from table_name"                        显示所有的字段

db2 "select * from table_name  where  字段名 = '  '  "

db2 "select 列名1,列名from 表名"                  显示指定的字段 

db2 "select distinct 列名 ,列名……from 表名         不显示重复行

6、describe的用法

db2  ?  describe     查看帮助文档

7、函数in的用法

    db2 "select * from  表名 where 列名 =值1  or 列名=值2"

||  等价于

db2 "select * from 表名 where 列名 in (值1,值2)"

相关图片

相关文章