SQL 6 DDL - 1
SQL 6 DDL - 1
SQL 6 DDL - 1
SQL
SQL Commands
Use char when the sizes of the column data entries are consistent.
char(10)--> takes 10 spaces in memory regardless of how much is used. Example: John (Column)
--> still take 10 spaces
Use varchar when the sizes of the column data entries varies.
varChar(10) --> may take up to 10 spaces in memory. Example: John (Column) --> It will only
take 4 spaces from memory and rest will be left to be used for something else
Create Command
Task:
Create a table called CLIENTS_YourNameDoB with 5 columns :
Client_ID,
First_Name,
Last_Name,
Postal_Address,
State_Address
Make
client ID datatype numbers --> should be NOT NULL Primary Key
First Name datatype varchar NOT NULL
Last Name datatype varchar not null
Postal Address varchar
State_ Address char
Insert Statement
Update Statement
Delete Statement
Used to delete ROWS in a Table
Alter Statement ADD Column
The ALTER TABLE statement is used to add, delete, or modify columns in an existing
table.
The ALTER TABLE statement is also used to add and drop various constraints on an
existing table.
To Add a column in a table, use the following syntax:
SYNTAX
SYNTAX
SYNTAX
SYNTAX
• Used to remove data / records from the table and NOT THE TABLE
ITSELF
• Keeps the TABLE in place but deletes All the DATA / RECORDS in the
Table
Drop Table Statement
Used to delete the Data and the Table from Database
Rename Table Statement
Used to Rename the Table from Database
Syntax
SELECT DROP
UPDATE RENAME REVOKE COMMIT
DELETE CREATE GRANT ROLLBACK
INSERT ALTER
TRUNCATE
SQL Commands
Data Manipulation Data Definition Language
Language DROP
SELECT RENAME
UPDATE CREATE
DELETE ALTER
TRUNCATE
INSERT (DR CAT)
(SUDI)
?
THANK YOU
QUESTIONS & ANSWERS