DB2创建sample数据库





要学习sql查询,db2里面也有像oracle数据库软件一样的sample数据库,那么我们来创建一下这个sample数据库吧。

 

[db2inst1@localhost ~]$ db2sampl -dbpath /db2/sample -name SAMPLE -sql

 

  Creating database "SAMPLE" on path "/db2/sample"…

  Connecting to database "SAMPLE"…

  Creating tables and data in schema "DB2INST1"…

 

  'db2sampl' processing complete.

 

 

[db2inst1@localhost ~]$ db2

(c) Copyright IBM Corporation 1993,2007

Command Line Processor for DB2 Client 10.1.0

 

You can issue database manager commands and SQL statements from the command

prompt. For example:

    db2 => connect to sample

    db2 => bind sample.bnd

 

For general help, type: ?.

For command help, type: ? command, where command can be

the first few keywords of a database manager command. For example:

 ? CATALOG DATABASE for help on the CATALOG DATABASE command

 ? CATALOG          for help on all of the CATALOG commands.

 

To exit db2 interactive mode, type QUIT at the command prompt. Outside

interactive mode, all commands must be prefixed with 'db2'.

To list the current command option settings, type LIST COMMAND OPTIONS.

 

For more detailed help, refer to the Online Reference Manual.

 

db2 => connect to sample  

 

   Database Connection Information

 

 Database server        = DB2/LINUXX8664 10.1.0

 SQL authorization ID   = DB2INST1

 Local database alias   = SAMPLE

 

db2 => select empno,firstnme from employee

 

EMPNO  FIRSTNME   

—— ————

000010 CHRISTINE  

000020 MICHAEL    

000030 SALLY      

000050 JOHN       

000060 IRVING     

000070 EVA        

000090 EILEEN     

000100 THEODORE   

000110 VINCENZO   

000120 SEAN       

000130 DELORES    

000140 HEATHER    

000150 BRUCE      

000160 ELIZABETH  

000170 MASATOSHI  

000180 MARILYN    

000190 JAMES      

000200 DAVID      

000210 WILLIAM    

000220 JENNIFER   

000230 JAMES      

000240 SALVATORE  

000250 DANIEL     

000260 SYBIL      

000270 MARIA      

000280 ETHEL      

000290 JOHN       

000300 PHILIP     

000310 MAUDE      

000320 RAMLAL     

000330 WING       

000340 JASON      

200010 DIAN       

200120 GREG       

200140 KIM        

200170 KIYOSHI    

200220 REBA       

200240 ROBERT     

200280 EILEEN     

200310 MICHELLE   

200330 HELENA     

200340 ROY        

 

  42 record(s) selected.

 

 




Related posts

coded by nessus
分享:  DeliciousGReader鲜果豆瓣CSDN网摘
Trackback

only 1 comment untill now

  1. imbecile@radiochlorine.digressions” rel=”nofollow”>.…

    thanks for information!…

Add your comment now

无觅相关文章插件