SQL-syntax (Panimalar)
SQL-syntax (Panimalar)
b) RENAME :
▪ It is used to change the name of the table.
Syntax:
Rename existing_table_name to new_table_name;
c)ALTER :
▪ It is used to modify the structure of the table.
1.TO ADD A COLUMN :
Syntax:
ALTER TABLE Table_Name
ADD Column_Name Datatype Constraint_type ;
Syntax:
ALTER TABLE Table_Name
RENAME COLUMN Column_Name TO new_Column_Name ;
Syntax:
ALTER TABLE Table_Name
MODIFY COLUMN_NAME New_Datatype;
d)TRUNCATE :
▪ IT IS USED TO REMOVE ALL THE RECORDS FROM
THE TABLE PREMANENTLY
Syntax:
TRUNCATE TABLE Table_Name ;
e)DROP :
▪ IT IS USED TO REMOVE THE TABLE FROM THE
DATABASE.
2|Page
Cust
Cid Cname Phone_no Address DROP
1 A 1234567890 Bglr BIN
2 B 1234567899 Mysore
3 C 1234567880 Mglr
3|Page
TYPES OF DML STATEMENTS:
1.INSERT : It is used to insert / create records in the table .
Syntax:-1
INSERT INTO Table_Name VALUES( v1 , v2 , v3 …… ) ;
Syntax:-2
2.REVOKE :
▪ This statement is used to remove the permission from other user.
Syntax:
5|Page
REVOKE SQL_STATEMENT
ON TABLE_NAME
FROM USER_NAME ;
6|Page