DB2 Create statement

DB2 DDL Statement DB2 Alter Statement

Advertisements


CREATE statement is used to create the DB2 objects.

The database objects include schemas, tables, views, sequences, catalogs, indexes, and aliases


Syntax:

	CREATE SCHEMA Schema-name

TABLE:
	CREATE TABLE Table name
	(Columns definition,
	Primary key/foreign key definition,
	[LIKE reference table name]
	ON database name. tablespace name)

VIEW:
	CREATE VIEW View name[Columns names] AS
	(SELECT *[columns names] FROM database name. tablespace name.tablename)
	ONdatabase name. tablespace name

	CREATE SEQUENCE sequence-name
	CREATE ALIAS alias-name
	CREATE INDEX index-name

CREATE can be performed on the below list of Objects.


						
CREATE ALIAS
CREATE DATABASE
CREATE FUNCTION
CREATE INDEX
CREATE PACKAGE
CREATE PROCEDURE 
CREATE ROLE
CREATE SEQUENCE
CREATE STOGROUP
CREATE SYNONYM
CREATE TABLE
CREATE TABLESPACE
CREATE TRIGGER
CREATE TYPE
CREATE VIEW


DB2 DDL Statement DB2 Alter Statement

Advertisements