在linux终端输入db2fs,系统打开DB2 FIRST STEP 工具。然后选择Database Creation —> Create Sample Database ,即可以创建样例数据库。
然后在命令行执行 db2 connect to sample 可以连接上数据库,
再执行 db2 "select * from staff where dept >20 " 可以查询出符合条件的记录,注意不要把引号省略。
或者可以执行db2 ,进入db2的命令行,然后直接输入db2的命令:
如 connect to sample 和 select * from staff where dept >20 。
The DB2 CLP (db2 命令行)has two parts: a front-end process and a back-end process. The
front-end process is called db2 and the back-end is db2bp. The back-end process
will maintain a connection to the database. To release this connection, use the TERMINATE
command. To end an interactive DB2 CLP session, issue the QUIT command ( this does not release the database connection ).