SQL Overview
SQL Overview
--==============================================================
===================================================================
SQL Overview :-
These commands can be classified into the following groups based on their nature.
DDL - Data Definition Language
--------------------------------
1 CREATE :- Creates a new table, a view of a table, or other object in the database.
2 ALTER :- Modifies an existing database object, such as a table.
3 DROP :- Deletes an entire table, a view of a table or other objects in the database.
Ex:-
CREATE TABLE XXSD_TEST_TL(
EMP_NO VARCHAR2(10),
EMP_NAME VARCHAR2(100),
SALARY NUMBER
)
select * from XXSD_TEST_TL
ALTER TABLE XXSD_TEST_TL ADD ( DOB DATE)
DROP TABLE XXSD_TEST_TL
--=====================================================================
DML - Data Manipulation Language
--------------------------------
1 SELECT :- Retrieves certain records from one or more tables.
2 INSERT :- Creates a record.
3 UPDATE :- Modifies records.
4 DELETE :- Deletes records.
Ex:-
select * from XXSD_TEST_TL
Insert into XXSD_TEST_TL values( 'A123','Sunil','20000')
commit;
UPDATE XXSD_TEST_TL
set EMP_NAME = 'Rakesh'
where EMP_NO = 'A123'
commit;
DELETE FROM XXSD_TEST_TL
where EMP_NO = 'A123'
commit;
--=======================================================================
DCL - Data Control Language
--------------------------------
1 GRANT :- Gives a privilege to user.
2 REVOKE :- Takes back privileges granted from user.
Ex:-
select * from XXSD_TEST_TL
GRANT SELECT ON XXSD_TEST_TL TO XXSD
REVOKE SELECT ON XXSD_TEST_TL FROM XXSD
--==============================================================
===================================================================
SQL Overview :-
These commands can be classified into the following groups based on their nature.
DDL - Data Definition Language
--------------------------------
1 CREATE :- Creates a new table, a view of a table, or other object in the database.
2 ALTER :- Modifies an existing database object, such as a table.
3 DROP :- Deletes an entire table, a view of a table or other objects in the database.
Ex:-
CREATE TABLE XXSD_TEST_TL(
EMP_NO VARCHAR2(10),
EMP_NAME VARCHAR2(100),
SALARY NUMBER
)
select * from XXSD_TEST_TL
ALTER TABLE XXSD_TEST_TL ADD ( DOB DATE)
DROP TABLE XXSD_TEST_TL
DML - Data Manipulation Language
--------------------------------
1 SELECT :- Retrieves certain records from one or more tables.
2 INSERT :- Creates a record.
3 UPDATE :- Modifies records.
4 DELETE :- Deletes records.
Ex:-
select * from XXSD_TEST_TL
Insert into XXSD_TEST_TL values( 'A123','Sunil','20000')
commit;
UPDATE XXSD_TEST_TL
set EMP_NAME = 'Rakesh'
where EMP_NO = 'A123'
commit;
DELETE FROM XXSD_TEST_TL
where EMP_NO = 'A123'
commit;
--=======================================================================
DCL - Data Control Language
--------------------------------
1 GRANT :- Gives a privilege to user.
2 REVOKE :- Takes back privileges granted from user.
Ex:-
select * from XXSD_TEST_TL
GRANT SELECT ON XXSD_TEST_TL TO XXSD
REVOKE SELECT ON XXSD_TEST_TL FROM XXSD
Comments
Post a Comment