cheat sheet module 2
cheat sheet module 2
MySQL/DB2: CREATE TABLE table_name CREATE TABLE statement is to create the table.
Each column in the table is specified with its MySQL/DB2: CREATE TABLE employee (
CREATE (col1 datatype optional keyword, col2
employee_id char(2) PRIMARY KEY,
datatype optional keyword,col3 datatype name, data type and an optional keyword
TABLE first_name varchar(30) NOT NULL, mobile
optional keyword,..., coln datatype which could be PRIMARY KEY, NOT int);
optional keyword) NULL, etc.,
MySQL/DB2:
MySQL/DB2
Option 1. ALTER TABLE table_name ADD
ALTER column_name_1 datatype....ADD COLUMN Option 1. ALTER TABLE employee ADD income
TABLE - column_name_n datatype; ALTER TABLE statement is used to add the bigint;
ADD columns to a table.
COLUMN
Option 2. ALTER TABLE table_name ADD Option 2. ALTER TABLE employee ADD COLUMN
COLUMN column_name_1 datatype....ADD income bigint;
COLUMN column_name_n datatype;
ALTER
TABLE - statement is used to MySQL/DB2:
MySQL/DB2: ALTER TABLE table_name DROP ALTER TABLE DROP COLUMN
DROP COLUMN column_name_1 ; remove columns from a table. ALTER TABLE employee DROP COLUMN mobile ;
COLUMN
Author(s)
Himanshu Birla
Niveditha Pandith TS