Structured Query Language
SQL - Day 2
Agenda
    Entity
    Different types of attributes.
        Multi valued attributes.
        Simple/ Atomic attributes.
        Compound/Composite attributes.
        Derived attributes.
        Stored attributes
        Complex attributes
        Key attributes
        Non-Key attributes
        Required attributes
        Optional / null value attributes.
Database Management System    SQL            Rooman Technologies
What is an Entity?
Objects whose information can be stored inside a database are referred as
“Entity”.
Let’s look into few examples of entities in database.
Example 1:
                    Student
     University
     Database       Professor       Entities of University Database
                    Courses
Example 2:
                    Patients
      Hospital
                    Doctors         Entities of Hospital Database
     Database
                    Tablets
Example 3:
                    Employees
      Company
                    Department     Entities of Company Database
     Database
                    Clients
Database Management System             SQL                     Rooman Technologies
Example 4:
                    Customers
        Bank
                    Account Sections          Entities of Company Database
     Database
                    Transaction Details
Types of Entities:
   1. Tangible Entity
   2. Intangible Entity
Tangible Entity:
Tangible Entities are those entities which exist in the real world physically.
Example: student, professor, doctors, employees, clients, customers etc.
Intangible Entity:
Intangible Entity: Intangible Entities are those entities which exist only logically
and have no physical existence.
Example: Bank Account, courses, tablets, department, transaction details,
account sections.
Database Management System              SQL                      Rooman Technologies
Let Us understand what is
                                Table
                                Rows
                                Columns
                                Cells
Table:
A table is a data structure that organizes information into rows and columns. It
can be used to both store and display data in a structured format.
For example, databases store data in tables so that information can be quickly
accessed.
Database Management System            SQL                     Rooman Technologies
Rows:
A row is a series of data placed out horizontally in a table. It is a horizontal
arrangement of the objects, words, numbers, and data. In Row, data objects are
arranged face-to-face with lying next to each other on the straight line.
Rows are also called as tuples or record.
Database Management System             SQL                     Rooman Technologies
Columns
A column is a vertical series of cells in a table. It is an arrangement of figures,
facts, words, etc.
Columns are mostly placed one after another in the continuous sequence. In a
table, columns are mostly separated from each other by lines, which help to
enhance readability and attractiveness.
Columns are also called as attributes.
Database Management System               SQL                      Rooman Technologies
Cells:
The intersections of both rows and columns is known as cells.
Cells are also known as Fields.
Let’s Understand Different types of
Attributes or Columns.
Different types of attributes/columns available are:
             Single valued attributes.
             Multi valued attributes.
             Simple/ Atomic attributes.
             Compound/Composite attributes.
             Derived attributes.
             Stored attributes
             Complex attributes
             Key attributes
             Non-Key attributes
             Required attributes
             Optional / null value attributes.
Database Management System               SQL                    Rooman Technologies
Let’s understand each type of
attributes one by one…
Single valued attributes.
Single-valued attribute is an attribute that can have only a single value.
For example: A person can have only one age, only one gender, and a manufactured
part can have only one serial number.
Multi valued attributes.
An attribute that can hold multiple values is known as multivalued attribute. It is
represented with double ovals in an ER Diagram.
For example – A person can have more than one phone numbers or email ids so the
phone number or email id attributes are multivalued attribute.
Composite attribute
Composite attribute is an attribute where the values of that attribute can be
further subdivided into meaningful sub-parts."
For examples – Persons ‘Name’ is a composite attribute which can be stored as
first name, last name, middle initial.
‘Address’ is a composite attribute which can be divided into street number, city,
state, country etc.
Simple/ Atomic attributes.
Simple/    Atomic     attributes   is    an    attribute   where   the    values   of
that attribute cannot be further subdivided into sub-parts.
For examples – Date of birth of a person cannot be further divided into sub parts.
Database Management System               SQL                       Rooman Technologies
Derived attribute
Derived attributes are the attributes that do not exist in the physical database,
but their values are derived from other attributes present in the database.
For example:
      Age of a person can be derived from the date of birth attribute.
      Duration of the course can be derived from start date of joining and end
       date of course.
Stored attribute.
Stored attributes are the attributes whose values cannot be derived using other
attributes.
For Example - student_id, name, roll_no, course_Id, mobile number, email.
Complex attribute.
Complex Attribute is a type of attribute in database. It is formed by nesting
composite attributes and multi-valued attributes in arbitrary way. We can say
this as the both are in the attribute.
For Example- Address attribute, address can be a combination of all the other
attributes like street Number, Locality Number, city, state, country.
Key attribute.
A key attribute is the unique characteristic of the entity.
For Example- USN of Student, Bank Account Number, Employee Id.
Database Management System               SQL                   Rooman Technologies
Non-Key Attribute.
Attributes that are not unique (attributes other than Key Attribute).
For Example- Name, Address, DOB, AGE.
Required Attribute.
A required attribute is an attribute that must have a value in it.
For Example- Name, Address, DOB, AGE.
Optional/null value Attribute.
Optional attribute may or may not have a value in it or it can be left blank.
For Example-Middle name of person.
                 Thank You
Database Management System              SQL                      Rooman Technologies