SQL Presentation2
SQL Presentation2
• Equal =
• Not equal <>
• Less than <
• Greater than >
• Less than or equal to <=
• Greater than or equal to >=
EQUAL TO (=)
e_no e_name e_add
Data is retrieved from the tables based e1 Ravi Delhi
on equality operator.
e2 Manish Pune
•
e3 Ram Hyd
Q. Find the details of employee whose
name is Manish?
Ans. Select * from emp
where e_name='Manish';
NOT EQUAL TO (<>)
e_no e_name e_add
e1 Ravi Delhi
• Q. Find the details of employees e2 Manish Pune
who are not working in Delhi?
e3 Ram Hyd
• Ans. Select * from emp where
e_add <> 'Delhi';
LESS THAN (<)
[trigger_body]
EXPLANATION
• Before
When we use before tag then trigger get invoked before execution of
DML command.
• After
When we use after tag then trigger get invoked after execution
of DML command.
EXAMPLE
• Student table
• Insert marks for student 1 Sub1 = 50, Sub2 = 50, Sub3 = 80.
• Requirement Before inserting marks we require addition of three subject and
set total.
• create trigger stud_marks
• before INSERT
• on
• Student
• for each row
• set Student.total = Student.subj1 + Student.subj2 +
Student.subj3;
E-R DIAGRAM
Cardinality
Defines no. Of entities in one set associated with
no. Of entities in other set.
1. One to one
One entity from entity set A can be associated
with at most one entity of entity set B and vice
versa.
2. One to many
One entity from entity set A can be
associated with more than one entities of
entity set B however an entity from
entity set B, can be associated with at
most one entity.
3. Many-to-one
More than one entities from entity set A
can be associated with at most one
entity of entity set B, however an entity
from entity set B can be associated with
more than one entity from entity set A.
4. Many-to-many
One entity from A can be associated with more than one entity from B and vice
versa.
REPRESENTATION OF
ER DIAGRAM
CARTESIAN PRODUCT