Home | Articles | SQLPLUS | Sql | DDL Statements In Oracle SQLPLUS

DDL Statements In Oracle SQLPLUS

By
Font size: Decrease font Enlarge font

DDL :  Data Definition Language

  1. CREATE    :Use to create objects like CREATE TABLE, CREATE FUNCTION, CREATE SYNONYM, CREATE VIEW. Etc.
  2. ALTER   :Use to Alter Objects like ALTER TABLE, ALTER USER, ALTER TABLESPACE, ALTER DATABASE. Etc.
  3. DROP    :Use to Drop Objects like DROP TABLE, DROP USER, DROP TABLESPACE, DROP FUNCTION. Etc.
  4. REPLACE      :Use to Rename table names.
  5. TRUNCATE   :Use to truncate (delete all rows) a table.

CREATE : To create tables, views, synonyms, sequences, functions, procedures, packages etc.

Example To Create Table With Integrity constraints (Primary Key )

CREATE TABLE employees (

emp_id  int NOT NULL AUTO_INCREMENT,
name varchar(100) NOT NULL,
mobile varchar(15) NOT NULL,
created_at timestamps NOT NULL,
updated_at timestamps NOT NULL,
PRIMARY KEY (emp_id)
);

ALTER : Use the ALTER TABLE statement to alter the structure of a table.

ADD new column :- 

ALTER TABLE employees add (address varchar(250),

country int(3),

state int(4),

city int(4)

  );

B. To Drop Column:

ALTER TABLE employees DROP COLUMN (city) 

  • Email to a friend Email to a friend
  • Print version Print version
  • Plain text Plain text

Tagged as:

No tags for this article

Rate this article

0