Rate This Document
Findability
Accuracy
Completeness
Readability

Verifying FastDB

  1. Initialize the database and log in to it.
    cd /opt/fastdb/bin/
    ./subsql

  2. View common database operations.
    help

  3. Open the testddl database and query the tables and other information in the current database.

    Start the testddl database. If the database does not exist, create it. If the database exists, open it directly.

    open 'testddl';

    Show database information.

    show

    Query tables.

    Metatableselect * from Metatable;

  4. Create the Persons and Animals tables and view their table structures.

    Create the Persons table.

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

    View the table structure of Persons.

    describe Persons;

    Create the Animals table.

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

    View the table structure of Animals.

    describe Animals;

    Show database information.

    show

  5. Insert related data into the Persons and Animals tables.

    Insert the following data to the Persons table.

    insert into Persons value1, 'andy', 22);
    insert into Persons values(100002, 'swen', 25);
    insert into Persons values(100003, 'tnia', 26);

    Insert the following data to the Animals table.

    insert into Animals values( 'dog', 2, 'wangwang');
    insert into Animals values( 'sheep', 2, 'c');
    insert into Animals values( 'duck', 2, 'gaga');
  6. Query information about the tables.

    Query the Persons table.

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

    Query the Animals table.

    select * from Animals;
    select * from Animals where voice='miemie';
  7. Update information about the tables.

    Update the Persons table.

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

    Update the Animals table.

    update Animals set age=3 where name='duck';
    select * from Animals;
  8. Delete the table information and view the result.

    Delete the Persons table.

    drop table Persons;

    Delete data from the Animals table.

    delete from Animals;

    Show database information.

    show

    View the table structure of Persons.

    describe Persons;

    View the table structure of Animals.

    describe Animals;

    • drop: deletes the data structure, including internal data.
    • delete: deletes the data content but does not delete the data structure.
  9. Log out of the database.
    exit