1-8 DBMS Lab File (Karan-9018)
1-8 DBMS Lab File (Karan-9018)
Report File
Submitted To:
Submitted By:
MRS.NEETI TANEJA
KARAN TIWARI
MRS.RENUKA SHARMA
2201330109018
Assistant Professor, CSE
LAB - 2
AIM: Creating Entity-Relationship Diagram using case tools with Identifying (entities,
attributes, keys and relationships between entities, cardinalities, generalization, specialization
etc.).
Entities: Entities may be any object, class, person or place. These are represented as Rectangles.
For example, in this ER Diagram STUDENT, COURSE, LECTURER, SUBJECTS.
Attributes: Attribute is used to describe the property of an entity. Eclipse is used to represent an
attribute.
Key Attribute: It represents a primary key and is represented by an
ellipse with text underlined. For example, STUDENT_ID, LECTURER_ID,
COURSE_ID etc.
Composite Attribute: This attribute is composed of many other attributes. This is
represented by ellipse connected by other ellipses. For example, ADDRESS attribute is
made from STREET, CITY etc.
Multivalued Attribute: An attribute which has more than one values. These are
represented by double ovals. For example, HOBBY.
Derived Attribute: An attribute which can be derived from other attributes. This can be
represented by dashed ellipse. For example, AGE.
Relationship: It is used to describe relation between entities. This is represented by Diamond.
One to one Relationship: When only one instance of an entity is associated with only
one instance of other entity. For example, LECTURER teaches SUBJECTS.
One to many Relationship: When only one instance of an entity is associated with more
than one instance of other entity. For example, COURSE has SUBJECTS.
Many to one Relationship: When more than one instances of an entity is associated with
only one instance of other entity. For example, LECTURER teaches STUDENT.
Many to many Relationship: When more than one instances of an entity are associated
with more than one instances of other entity. For example, STUDENT attends Course
and LECTURER takes COURSE.
Experiment No.: - 6
Aim: - Practice Queries using COUNT, SUM, AVG, MAX, MIN, GROUP BY, HAVING,
VIEWS Creation and Dropping.
1. COUNT: - The COUNT () function returns the number of rows that matches a specified
criterion.
2. SUM: - The SUM () function returns the total sum of numeric column.
3. AVG: - The AVG () function returns the average value of a numeric column.
4. MAX: - The MAX () function returns the largest value of the selected column.
5. MIN: - The MIN () function returns the smallest value of the selected column.
6. GROUP BY: - The GROUP BY statement group rows that have same values into summary
rows, like “find the number of customers in each country”.
7. HAVING: - The HAVING clause was added to SQL because the WHERE keyword cannot
be used with aggregate function.
8. VIEWS: - A VIEW in SQL is a virtual table that is stored in the database with an associated
name.
a. CREATING VIEW: - To create view in a database, we can use the SQL CREATE VIEW statement.
b. DROPING VIEW: - The SQL DROP VIEW is used to delete an existing view, along with its definition
and information.
c. UPDATING VIEW: - The SQL UPDATING VIEW is used to update an existing view. In SQL, you can
update data through a view using the UPDATE statement as long as the view meets certain criteria,
such as being based on a single table and not containing certain complex constructs in the SELECT
statement
d. INSERTING IN VIEW: - If you want to insert data into a view, you should insert data into the
underlying table(s) that the view is based on. The view itself is a read-only representation of
the data, and any changes you make to the data should be done through the underlying
table(s).
e. DELETION IN VIEW: In SQL, you can delete data through a view under certain conditions,
but it's essential to keep in mind that the view must meet specific criteria for it to be
updatable (deletable).