SQL Statements Syntax
SQL Statements Syntax
SUB-LANGUAGES/STATEMENTS/COMMANDS
-------------------------------------
===================================================================================
==================================================================
DDL(DATA DEFINITION LANGUAGE):
------------------------------
RENAME A COLUMN:
DELETE A COLUMN:
4.TRUNCATE: Truncate is used to remove all records of a table at one shot. Truncate
makes a table empty. Truncate will not remove
-----------
the table from database instead it removes records from table.
To remove the table PERMANENTLY from DATABASE without storing in BIN we use PURGE.
BEFORE DROP: drop table table_name purge;
AFTER DROP: purge table table_name;
===================================================================================
================================================================
2.UPDATE: UPDATE is used to update existing data in a table with newer data.
--------
SYNTAX: update table_name
set col_name=value
where condition(s);
update table_name
set col_name=VALUE,col_name=value..
where condition(s);
===================================================================================
=============================================================
TCL(TRANSACTION CONTROL LANGAUGE): Since all the DML actions are not permanent, it
can be saved permanently using TCL
---------------------------------
1)ROLLBACK: Rollback statement is used to undo all the DML actions.
-----------
SYNTAX: rollback;
3)SAVEPOINT: Savepoint is a named point created for each and every DML actions.
------------
SYNTAX: savepoint savepoint_name;
===================================================================================
=============================================================
1)GRANT: Grant is mainly used to provide a permission for accessing of a data from
one database user to another.
--------
SYNTAX: grant permission_type on table_name to user_name;
2)REVOKE: Revoke is mainly used to take back a permission for accessing of a data
from one database user to another.
---------
SYNTAX: revoke permission_type on table_name from user_name;