DBMS UNIT 2 Notes
DBMS UNIT 2 Notes
Describe DBMS_EMP_TEST;
Desc DBMS_EMP_TEST;
=========================================================================
=======
2.Alter table is used to add or drop or modify columns in existing
table.(DDL Command)
4.DROP table is used to delete the table with rows.The structure does not
remains.You need to create the table again.(DDL Command)
DROP Table <Table_Name>
DROP Table DEPT0;
=========================================================================
=======
5.Rename table is used to rename the old table name to new table
name.(DDL Command)
=========================================================================
=======
8.delete the rows in table:(DML Command)
=========================================================================
=======
9.Different Options of data retrieve statements:(DQL Command)
=========================================================================
=========
11.Entity Integrity Constraints:
1)Primary Key
Create Table DBMS_EMP_TEST9 (Empid char(6) CONSTRAINT empid_pk PRIMARY
KEY,Empname Varchar2(50),Salary number(7,2),Address Varchar2(1000),DOJ
date);
ALTER Table DBMS_EMP_TEST10 add CONSTRAINT empid_pk101 PRIMARY
KEY(Empid);
2)Foreign KEY
Create Table DBMS_Product(Empid char(6) references
DBMS_EMP_TEST9(Empid),ProdcutName Varchar2(25));
=========================================================================
=========
12.Domain Integrity Constraints:
2) Check constraint
Create table EMP909(Empid number(6),Empname varchar2(25) NOT NULL,salary
number(11,2) constraint chk_emp check(salary is NOT NULL and
salary>20000),phoneno number(10));
=========================================================================
=========
13.Rollback:It used to undo transanction that have not already been saved
to the database and undo transanction since last commit and rollback.
ROLLBACK;
Rollback To SAVEPOINT_NAME;
GRANT {privileges}
ON object_name
To username
with grant option.
2)Not Equal operator (!=) :check two operand are equal or not if equal
7)Not equal to <>:Checks if the values of two operands are equal or not,
if values are not equal then condition becomes true.
not equal
=========================================================================
=========
Logical Operator
AND Operator
OR Operator
=========================================================================
=========
1)IN Operator:If you know the exact value you want to return for at least
one of the columns.
Between:search for values that are within set of values given min and max
value
NOT Between:search for values that are not within set of values given min
and max value
SELECT * FROM DBMS_EMP_TEST where salary NOT BETWEEN '5000.8' AND
'40000.8';
=========================================================================
=========
Pattern Matching
SELECT * FROM DBMS_EMP_TEST where EMPNAME like 'R%h' Start with R and
end with h
Is NULL: check if data exist in row or not.It will dispaly empty row
Is NOT NULL: check if data exist in row or not.It will not dispaly empty
row
Alias(nickname)
=========================================================================
=========
Set Operator
MINUS:All distinct rows selected by the first query but not the second
=========================================================================
=========