Professional Documents
Culture Documents
Dbms Practical File
Dbms Practical File
Dbms Practical File
DEPARTMENT
OF
LABORATORY MANUAL
For
Submitted To : -
INDEX
SR
NO.
EXPERIMENT
DATE
01
5/09/16
02
12/09/16
03
26/09/16
04
3/10/16
05
17/10/16
06
24/10/16
07
7/11/16
08
28/11/16
SIGNATURE
INDEX
SR
NO.
EXPERIMENT
DATE
09
5/12/16
10
12/12/16
SIGNATURE
Experiment 1
Aim To create a table of employees for various departments.
values ( 3,103,'Priya','Vyas',20,'F','Secretary',to_date('16-12-2016','dd-mmyyyy'),15000,10,999111);
insert into Emp
values ( 4,104,'Ajay','Dholpuriya',23,'M','Manager',to_date('01-12-2016','dd-mmyyyy'),35000,20,454890);
insert into Emp
values ( 5,105,'Riya','Sen',25,'F','DBA',to_date('20-12-2016','dd-mmyyyy'),70000,10,909123);
insert into Emp
values ( 6,111,'Shubham','Kushwah',30,'M','CEO',to_date('12-11-2016','dd-mmyyyy'),100000,20,555123);
insert into Emp
values ( 7,110,'Rishabh','Gupta',23,'M','HR',to_date('23-12-2016','dd-mmyyyy'),25000,40,787956);
insert into Emp
values ( 9,170,'Kajal','Gupta',25,'F','Receptionist',to_date('27-12-2016','dd-mmyyyy'),10000,20,555626);
Experiment 2
Aim To delete duplicate record from the table.
create table Emp
(
recordNo int,
empID int,
eName varchar(10),
eSurname varchar(10),
age int,
sex char(1),
job varchar(15),
hiredate date,
salary number(8,2),
deptNo number(3,0),
mobNo int
);
Experiment 3
Aim To display the alternate records or rows from the table.
create table Emp
(
recordNo int,
empID int,
eName varchar(10),
eSurname varchar(10),
age int,
sex char(1),
job varchar(15),
hiredate date,
salary number(8,2),
deptNo number(3,0),
mobNo int
);
Experiment 4
Aim To find the third highest paid and the third lowest paid salary.
create table Emp
(
recordNo int,
empID int,
eName varchar(10),
eSurname varchar(10),
age int,
sex char(1),
job varchar(15),
hiredate date,
salary number(8,2),
deptNo number(3,0),
mobNo int
);
Experiment 5
Aim To display the 3rd, 4th and 6th rows from the table.
values ( 3,103,'Priya','Vyas',20,'F','Secretary',to_date('16-12-2016','dd-mmyyyy'),15000,10,999111);
insert into Emp
values ( 4,104,'Ajay','Dholpuriya',23,'M','Manager',to_date('01-12-2016','dd-mmyyyy'),35000,20,454890);
insert into Emp
values ( 5,105,'Riya','Sen',25,'F','DBA',to_date('20-12-2016','dd-mmyyyy'),70000,10,909123);
insert into Emp
values ( 6,111,'Shubham','Kushwah',30,'M','CEO',to_date('12-11-2016','dd-mmyyyy'),100000,20,555123);
insert into Emp
values ( 7,110,'Rishabh','Gupta',23,'M','HR',to_date('23-12-2016','dd-mmyyyy'),25000,40,787956);
insert into Emp
values ( 9,170,'Kajal','Gupta',25,'F','Receptionist',to_date('27-12-2016','dd-mmyyyy'),10000,20,555626);
Experiment 6
Aim To display the employees name , which start with R and S.
create table Emp
(
recordNo int,
empID int,
eName varchar(10),
eSurname varchar(10),
age int,
sex char(1),
job varchar(15),
hiredate date,
salary number(8,2),
deptNo number(3,0),
mobNo int
);
Experiment 7
Aim Updating the multiple rows in using single update statement.
create table Emp
(
recordNo int,
empID int,
eName varchar(10),
eSurname varchar(10),
age int,
sex char(1),
job varchar(15),
hiredate date,
salary number(8,2),
deptNo number(3,0),
mobNo int
);
update Emp
set age = 21
where age = 20;
Experiment 8
Aim To display the employees who were hired during the first half of the month.
create table Emp
(
recordNo int,
empID int,
eName varchar(10),
eSurname varchar(10),
age int,
sex char(1),
job varchar(15),
hiredate date,
salary number(8,2),
deptNo number(3,0),
mobNo int
);
Displaying the employees who were hired during the first half of the month
select * from emp where hiredate between '01-dec-2016' and '15-dec-2016
Experiment 9
Aim To display Employee name , job and salary column from the table.
values ( 3,103,'Priya','Vyas',20,'F','Secretary',to_date('16-12-2016','dd-mmyyyy'),15000,10,999111);
insert into Emp
values ( 4,104,'Ajay','Dholpuriya',23,'M','Manager',to_date('01-12-2016','dd-mmyyyy'),35000,20,454890);
insert into Emp
values ( 5,105,'Riya','Sen',25,'F','DBA',to_date('20-12-2016','dd-mmyyyy'),70000,10,909123);
insert into Emp
values ( 6,111,'Shubham','Kushwah',30,'M','CEO',to_date('12-11-2016','dd-mmyyyy'),100000,20,555123);
insert into Emp
values ( 7,110,'Rishabh','Gupta',23,'M','HR',to_date('23-12-2016','dd-mmyyyy'),25000,40,787956);
insert into Emp
values ( 9,170,'Kajal','Gupta',25,'F','Receptionist',to_date('27-12-2016','dd-mmyyyy'),10000,20,555626);
Displaying Employee name , job and salary column from the table Emp
Experiment 10
Aim To Study the E-R diagram.
E-R Diagram
ER-Diagram is a visual representation of data that describes how data is related to each other.
The ER model defines the conceptual view of a database. It works around real-world entities and
the associations among them. At view level, the ER model is considered a good option for
designing databases.
An entity-relationship diagram (ERD) is a graphical representation of an information system that
shows the relationship between people, objects, places, concepts or events within that system. An
ERD is a data modeling technique that can help define business processes and can be used as the
foundation for a relational database.
Weak Entity
Weak entity is an entity that depends on another entity. Weak entity doesn't have key attribute of
their own. Double rectangle represents weak entity.
2) Attribute
An Attribute describes a property or characteristics of an entity. For example, Name, Age,
Address etc can be attributes of a Student. An attribute is represented using eclipse.
Key Attribute
Key attribute represents the main characteristics of an Entity. It is used to represent Primary key.
Ellipses with underlying lines represent Key Attribute.
Composite Attribute
An attribute can also have its own attributes. These attributes are known as Composite attribute.
3) Relationship
A Relationship describes relations between entities. Relationship is represented using diamonds.
Binary Relationship
Recursive Relationship
Ternary Relationship
Binary Relationship
Binary Relationship means relation between two Entities. This is further divided into three types.
1. One to One : This type of relationship is rarely seen in real world.
The above example describes that one student can enroll only for one course and a course
will also have only one Student. This is not what you will usually see in relationship.
2. One to Many : It reflects business rule that one entity is associated with many number of same
entity. The example for this relation might sound a little weird, but this menas that one student
can enroll to many courses, but one course will have one Student.
The arrows in the diagram describes that one student can enroll for only one course.
3. Many to One : It reflects business rule that many entities can be associated with just one entity.
For example, Student enrolls for only one Course but a Course can have many Students.
4. Many to Many :
The above diagram represents that many students can enroll for more than one courses.
Recursive Relationship
When an Entity is related with itself it is known as Recursive Relationship.
Ternary Relationship
Relationship of degree three is called Ternary relationship.
Experiment 10
Aim To desing an E-R diagram for hospital management system.