---
title: 验证FastDB
description: "1. 初始化数据库并登录。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengdbs/ecosystemEnable/FastDB/openmind_fastdb376_03_0020.html
sourcePath: /source/zh/kunpengdbs/ecosystemEnable/FastDB/openmind_fastdb376_03_0020.html
indexId: fc39d0733c3e31d576f2d03a64f58d27d439cac17de001b2d5effd377bed00fc76
---
# 验证FastDB

1. 初始化数据库并登录。
  1 2 cd /opt/fastdb/bin/ ./subsql

2. 查看数据库常用操作。
  1 help

3. 打开数据库testddl并查询当前数据库中表及其相关信息。
  打开数据库testddl。如果数据库不存在，则创建数据库；如果数据库存在，则直接打开。

  1 open 'testddl';

  显示当前数据库的相关信息。

  1 show

  查询表。

  1 Metatableselect * from Metatable;

4. 创建表Persons和表Animals并查看其表结构。
  创建表Persons。

  1 create table Persons(identityID int4, name string, age int2);

  查看表Persons结构。

  1 describe Persons;

  创建表Animals。

  1 create table Animals(name string, age int2, voice string);

  查看表Animals结构。

  1 describe Animals;

  显示当前数据库的相关信息

  1 show

5. 插入表Persons和表Animals中相关数据。
  插入表Persons。

  1 2 3 insert into Persons values(100001, 'andy', 22); insert into Persons values(100002, 'swen', 25); insert into Persons values(100003, 'tnia', 26);

  插入表Animals。

  1 2 3 insert into Animals values( 'dog', 2, 'wangwang'); insert into Animals values( 'sheep', 2, 'c'); insert into Animals values( 'duck', 2, 'gaga');

6. 查询当前表相关信息。
  查询表Persons。

  1 2 select * from Persons; select * from Persons where name='andy';

  查询表Animals。

  1 2 select * from Animals; select * from Animals where voice='miemie';

7. 更新当前表相关信息。
  更新表Persons。

  1 2 update Persons set identityID=100005 where name='andy'; select * from Persons;

  更新表Animals。

  1 2 update Animals set age=3 where name='duck'; select * from Animals;

8. 删除表相关信息并查看。
  删除表Persons。

  1 drop table Persons;

  删除表Animals中的信息。

  1 delete from Animals;

  显示当前数据库的相关信息。

  1 show

  查看表Persons结构。

  1 describe Persons;

  查看表Animals结构。

  1 describe Animals;

  drop: 主要用于删除数据结构，包括内部的数据内容。 delete：主要用于删除数据内容，不删除数据结构。

9. 退出数据库。
  1 exit
