SQL DDL and Oracle utilities Murali Mani Datatypes

  • Slides: 8
Download presentation
SQL DDL and Oracle utilities Murali Mani

SQL DDL and Oracle utilities Murali Mani

Datatypes in SQL l l l INT (or) INTEGER FLOAT (or) REAL DECIMAL (n,

Datatypes in SQL l l l INT (or) INTEGER FLOAT (or) REAL DECIMAL (n, m) CHAR (n) VARCHAR (n) DATE, TIME Murali Mani

SQL DDL l l l DDL = Data Definition Language Create tables, columns of

SQL DDL l l l DDL = Data Definition Language Create tables, columns of tables, types of columns, primary key constraints, unique constraints, foreign key constraints Drop tables, add/drop columns, add/drop constraints – primary key, unique, foreign key Murali Mani

Creating Tables CREATE TABLE <table. Name> ( <col> <type>, … <col> <type>, [CONSTRAINT <c.

Creating Tables CREATE TABLE <table. Name> ( <col> <type>, … <col> <type>, [CONSTRAINT <c. Name>] PRIMARY KEY (…), [CONSTRAINT <c. Name>] UNIQUE (…), [CONSTRAINT <c. Name>] FOREIGN KEY (…) REFERENCES <table. Name> (…) ); Murali Mani

Dropping tables DROP TABLE <table. Name> Murali Mani

Dropping tables DROP TABLE <table. Name> Murali Mani

Adding/Dropping Columns ALTER TABLE <table. Name> ADD <col> <type>; ALTER TABLE <table. Name> DROP

Adding/Dropping Columns ALTER TABLE <table. Name> ADD <col> <type>; ALTER TABLE <table. Name> DROP COLUMN <col>; Murali Mani

Adding/Dropping Constraints ALTER TABLE <table. Name> ADD [CONSTRAINT <c. Name>] … ALTER TABLE <table.

Adding/Dropping Constraints ALTER TABLE <table. Name> ADD [CONSTRAINT <c. Name>] … ALTER TABLE <table. Name> DROP CONSTRAINT <c. Name> Murali Mani

SQL DML: Basic l l l DML = Data Manipulation Language Consists of Queries

SQL DML: Basic l l l DML = Data Manipulation Language Consists of Queries and Modification: Inserting/Deleting values from table Insert a value into a table INSERT INTO <table. Name> VALUES (…) eg: INSERT INTO Student VALUES (1, ‘Dave’); Delete all values from a table DELETE FROM <table. Name> Murali Mani