Some common Terms related to Database:
1. Database: A relational database presents data as a collection of tables. The data in each table is logically related, and relationships can be defined between tables. Data can be viewed and manipulated based on mathematical principles and operations called relations (such as, INSERT, SELECT, and UPDATE).
2. Tables: A relational database presents data as a collection of tables. A table consists of data logically arranged in columns and rows (generally known as records)
3. Table Space: The physical space within a database is organized into a collection of table spaces. Each table space consists of a collection of containers, each of which is an allocation of physical storage (for example, a directory on a machine, a physical file, or a device such as a hard drive).
4. Schema: A schema is a unique identifier used to group a set of database objects. Most database objects have a two-part object name, the first part being the schema name and the second part is the name of the object.
5. Index : An index is a data access aid that can be created on a table. It is an ordered set of pointers to rows in a table. Each index is based on the values of data in one or more columns in a table. An index is an object that is separate from the data in the table.
6. Instance: An instance is a logical database manager environment where you catalog databases and set configuration parameters. Multiple instances can be created on the same physical server providing a unique database server environment for each instance.
7. Alias: An alias is an alternative name for a table, view, or even another alias. These table-related aliases are somewhat different from database aliases. Assigning an alias to a database can avoid potential client connection problems in environments where different servers might have databases with the same name.
8. Views: A view is the result of a query on one or more tables. A view looks like a real table, but is actually just a representation of the data from one or more tables. A view is a logical or virtual table that does not exist in physical storage.
Creating Database in DB2
1. To create a database there are various options either one can create a database from the Command Centre or the Control Center. The option from the Control center is easy as it has a wizard that will guide through the process.
2. Here the database creation through the Control Center is explained.
i. Click on Databases on the left panel of the Control Center
ii. Right click on Databases and choose create -> Standard.
iii. Follow the panels from the create database wizard.
The wizard guides through the step by step process of creating the database, it asks for a database name, location to store the database and the various options about the maintenance of the data base.
Creating a Table
1. From the Control Center again we would need three steps:
a. Click on Tables on the left panel of the Control Center.
b. Right click on Tables and choose Create .
c. Follow the panels from the create table wizard.
This is how the wizard for creating a table looks like, it will ask for information and the user just fills in the blanks to create the columns in a table, long with the columns the user can also provide information about the constraints, keys. Following this same procedure one can create aliases, views, indexes, triggers, schemas, and so on.
Alter a table
1. To alter some of the characteristics of a table, first specify which table needs to altered. Thus, using the Control center's right pane (contents pane), follow these four steps:
a. Click on Tables on the left panel of the Control Center.
b. Click on the table name that needs to be altered.
c. Right click on the table name and choose Alter .
d. Follow the 'Alter Table' panels.
2. With the Alter panel one can change the data type, the keys , constraints or the properties of the table.
Performing Queries
-
After creating a database and its table the next step is to perform queries on them. Queries like Insert, delete, update or select and so on. Follow the steps
-
In the Control center select the database from the left side panel
-
Select table and it show all the tables for the particular database in the right side panel
-
Select the table in the right hand panel.
-
Under the right panel there is an option for Query, select it

This is the window that comes up, you can type the query in the top panel.

If you are using command panel directly, remember to connect to the database by the command
- > connect to database name
After typing the query press the green arrow sign, to run the query.
The result will be displayed in a new tab window.
In the result set you can delete or add an row in the table, there are options of committing and rollback present too.
Query Assist
1. Another easier way to frame the queries is to use the SQL-Assist.
a. Click on the selected tab, then click on SQL Assist.

b. This brings up an interactive window through which writing queries becomes easier.
Restricting Usage
1. To prevent unauthorized users from messing up with the database or tables, there is provision for setting the privileges granted to the users
a. On the left panel of the Control Center and within the desired database tree, click on User and Group Objects -> DB Users .
b. Click on the desired user on the right panel of the Control Center
c. Right-click on the desired user and choose change.

| < Prev | Next > |
|---|