Online Documentation for SQL Manager for DB2

Tables


Relational databases store all their data in Tables. A table is a data structure consisting of an unordered set of horizontal rows, each containing the same number of vertical columns. The intersection of an individual row and column is a field that contains a specific piece of information. Much of the power of relational databases comes from defining the relations among the tables.

 

 

Creating Tables

 

To create a new table:

Hint: To create a new table, you can also right-click the Tables node or any object within this node in the DB Explorer tree and select the New Table... item from the context menu.

 

To create a new table with the same properties as one of existing tables has:

Alternatively, you can right-click a table in the DB Explorer tree and select the Duplicate Table <table_name>... context menu item.

 

Duplicate Object Wizard allows you to select the database to create a new table in, and to edit the result SQL statement for creating the table.

 

 

Editing Tables

 

To edit an existing table (manage its fields, indexes, data, etc.):

  • select the table for editing in the DB Explorer tree (type the first letters of the table name for quick search);
  • right-click the object and select the Edit Table <table_name>... context menu item, or simply double-click the table;
  • edit table subobjects and data using the appropriate tabs of Table Editor.

To change the name of a table:

  • select the table to rename in the DB Explorer tree;
  • right-click the table alias and select the Rename Table <table_name>... item from the context menu;
  • edit the table name using the Rename Object... dialog.

 

Dropping Tables

 

To drop a table:

  • select the table to drop in the DB Explorer tree;
  • right-click the object and select the Drop Table <table_name>... context menu item;
  • confirm dropping in the dialog window.

 

Note: If more convenient, you can also use the following shortcuts:

Ctrl+N to create a new table;

Ctrl+O to edit the selected table;

Ctrl+R to rename the table;

Shift+Del to drop the object from the database.