Several Simple DB2 operation statements

Source: Internet
Author: User
Tags table definition

What is the difference between DB2 operation statements and other database operation statements? The following is an example of a simple DB2 operation statement for your comparative study.

1. Create a table:
Create table table_name (
Column1 datatype [not null] [not null primary key],
Column2 datatype [not null],
...)
Note:
Datatype -- is the data format. For details, see the table.
Nut null-do you want to allow empty data ).
Primary key -- is the primary key of the table.

2. Change the table
Alter table table_name
Add column column_name datatype
Note: Add a column without deleting the syntax of a column.
Alter table table_name
Add primary key (column_name)
Note: You can change the table definition to set a column as a primary key.
Alter table table_name
Drop primary key (column_name)
Delete the definition of the primary key.

3. Create an index
Create index index_name on table_name (column_name)
Note: index the column of a table to increase the query speed.

4. Delete
Drop table_name
Drop index_name

The above is a simple introduction to the DB2 operation statements.

DB2 isolation level-read for implementation

Use of DB2 dynamic SQL

Implementation of DB2 circular Query

Introduction to DB2 information directory Center

DB2 cursor and usage

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.