DCIT 24 Reviewer
DCIT 24 Reviewer
System (SMIS)
                                                 •   Records/basic info
Database
                                                 •   Records (academics)
   •   Storage                                   •   Medical Records
   •   Server                                    •   Enrollment
   •   Manage                                    •   Capability Enhancement records
   •   File compilation
                                              Superadmin
   •   Report Generation
                                              Admin
Goals: Good decision making requires good     End users
information derived from raw facts
Data Vs Information                           Advantages of a DBMS:
   • Collection of programs
   • Manages structure and controls access
     to data
Database location(s)                                • Database design focuses on design of
                                                      database structure used for end-user
1. Centralized Database
                                                      data
   • Data located in a single location
                                                          – Designer      must      identify
2. Distributed Database                                     database’s expected use
   • Different sites/branches with each             • Well-designed database:
     other own database
                                                          – Facilitates data management
   • Cloud database (main database)
                                                          – Generates accurate and valuable
3. Relational Database
                                                            information
   • Rows/columns tables
                                                    • Poorly designed database:
   • Compare data on database
                                                          – Causes difficult-to-trace errors
Two types of distributed database
                                                  Evolution of File System Data Processing
1. Operational Database (OLTP)
                                                    • Reasons for studying file systems:
   • Online      Transaction    Processing
     database                                             – Complexity of database design
   • extent of usage/data usage                             is easier to understand
   • supports a company’s day-to-day
                                                          – Understanding file system
     operations
                                                            problems helps to avoid
   • Transactional or production database
                                                            problems with DBMS systems
2. Data Warehouse (OLAP)
                                                          – Knowledge of file system is
   • Online Analytic Processing Database                    useful for converting file system
     system                                                 to database system
   • stores data used for tactical or strategic
                                                    • File systems typically composed of
     decisions.
                                                      collection of file folders, each tagged
Homogenous Database                                   and kept in cabinet
   • Same on all databases                                – Organized by expected use
Heterogenous Database                               • Contents of each file folder are
                                                      logically related
   • Different OS, hardware and software
                                                    • Manual file systems
MS Access
                                                          – Served as a data repository for
   • Single and work
                                                            small data collections
   • Centralized
                                                          – Cumbersome          for     large
Why Database Design Is Important
                                                            collections
                                                    • Computerized file systems
        – Data processing (DP) specialist               tasks for which spreadsheets are
          converted      computer     file              not appropriate – database
          structure from manual system                  substitute.
              • Wrote software        that   Problems with       File   System      Data
                managed the data             Processing
              • Designed the application       • File systems were an improvement
                programs                         over manual system
  • Initially, computer file      systems            – File systems used for more than
    resembled manual systems                           two decades
  • As number of files increased, file               – Understanding the shortcomings
    systems evolved                                    of file systems aids in
                                                       development     of      modern
        – Each file used its own
                                                       databases
          application program to store,
          retrieve, and modify data                  – Many problems not unique to
                                                       file systems
        – Each file was owned by
          individual or department that        • Even simple file system retrieval task
          commissioned its creation              required extensive programming
                                                     – Ad hoc queries impossible
                                                     – Changing      existing   structure
                                                       difficult
                                               • Security features difficult to program
                                                     – Often omitted in file system
                                                       environments
                                               • Summary of file system limitations:
File System Redux: Modern End-User
Productivity Tools                                   – Requires                 extensive
                                                       programming
  • Ubiquitous     use    of      personal
    productivity tools can introduce the             – Cannot perform ad hoc queries
    same problems as the old file systems            – System    administration        is
  • Microsoft Excel                                    complex and difficult
3. External Level (Visual)- 60% even more          The relational model is widely used in
abstract than the logical level. For end users     relational database management systems
with lowest degree of detail. This is what an      (RDBMS) and forms the basis for SQL
end-user gets to see. He/she does not get the      databases.
entire database, but depending on the queries      Referential Integrity Rule in Relational
made from the front-end the user gets to see       Database Model
the data. It may be a single data from the
entire database or a collection of data in         Referential Integrity Rule in DBMS is based
tabular format. Multiple views of the same         on Primary and Foreign Key. The Rule
data are available to the user, the                defines that a foreign key have a matching
representation can be a table, a graph, or a pie   primary key. Reference from a table to
chart. View Level is the highest level of data     another table should be valid.
abstraction in DBMS.                               Referential Integrity Rule examples
                   Lesson 3
       Relational Database Model
      & Entity Relationship Diagram
                                                   The rule states that the DEPT_ID in the
                                                   Employee     table   has   a   matching
Logical View of The Data                           valid DEPT_ID in the Department table.
A logical view of data refers to the               To allow join, the referential integrity rule
representation of data without necessarily         states that the Primary Key and Foreign Key
considering the physical implementation or         have same data types.
storage details. It focuses on how data is
organized, structured, and related to each
other in a way that makes sense for the users
and the applications interacting with the data.
The logical view is often expressed through
data models, which define the relationships,
constraints, and rules governing the data.
Entity Integrity Rule                               • Note: Secondary Key is not a Foreign
                                                      Key.
   • Make sure that each tuple in a table is
     unique.                                     Let’s say you selected Student_ID as
   • Every table must have a primary key,        primary                              key,
     for example, Student_ID for a Student       therefore Student_Enroll and Student_Em
     table.                                      ail will be Secondary Key (candidates of
   • Every entity is unique.                     primary key).
   • The relations Primary Key must have
     unique values for each row.
   • Primary Key cannot have NULL value
     and must be unique.
   • Example              can            be
     an Employee_ID cannot be null in an         C. SUPER KEY
     Employee table.                             Super Key is an attribute (or a set of
Key                                              attributes) uniquely identifying a tuple, i.e.,
                                                 an entity in an entity set.
A. COMPOSITE KEY
                                                 It is a superset of Candidate Key, since
   • A primary key having two or more
                                                 Candidate Keys are selected from super key.
     attributes is called composite key. It is
     a combination of two or more columns.       Let us see an example −
   • An example can be −
                                                 C. SURROGATE KEY
                                                 A Surrogate Key’s only purpose is to be a
                                                 unique identifier in a database, for example,
B. SECONDARY KEY
                                                 incremental key, GUID, etc. It has
   • Secondary Key is the key that has not
                                                 Surrogate Key has no actual meaning and is
     been selected to be the primary key.
                                                 used to represent existence. It has an
     However, it is considered a candidate
                                                 existence only for data analysis.
     key for the primary key.
                                                 Let us see an example −
   • Therefore, a candidate key not selected
     as a primary key is called secondary
     key. Candidate key is an attribute or set
     of attributes that you can consider as a
     Primary key.
D. FOREIGN KEY                                  Language). Relational algebra operations are
                                                used to perform various tasks on sets of
   • A Foreign Key creates a link between
                                                relations (tables) in a database.
     tables. It references the primary key in
     another table and links it.                Fundamental Operators
   • For example, the DeptID in the             1. Selection(σ)- The selection operation is
     Employee table is a foreign key −          used to retrieve rows from a table that satisfy
                                                a given condition.
Let us see an example −
                                                Notation − σp(r)
                                                Where σ stands for selection predicate and r
                                                stands for relation. p is prepositional logic
                                                formula which may use connectors like and,
                                                or, and not. These terms may use relational
E. UNIQUE KEY                                   operators like − =, ≠, ≥, < , >, ≤.
   • Many users consider Primary Key as
     Unique Key, since both uniquely
     identify a table, but Unique Key is
     different from Primary Key. Unique
     Key accepts null values and Primary
     Key cannot have null.
   • Let us compare Primary Key and
     Unique Key and understand its concept
     −
                                                2. Projection(π)
                                                The projection operation is used to retrieve
                                                specific columns from a table.
5. Intersection (∩)
The intersection operation returns a relation    b. Natural Join - If we join R1 and R2 on
containing only the rows that are common to      equal condition then it is called natural join
both input relations. It displays the common     or equi join. Generally, join is referred to as
values in R1 & R2. It is denoted by ∩.           natural join.
6. Join (⨝)
The join operation combines rows from two        Relationships     within    the    Relational
relations based on a common attribute.           Database
Different types of joins include Theta Join,     In a relational database, relationships are
Natural Join, Outer Join (Left Outer Join,       established between tables to organize and
Right Outer Join, Full Outer Join)               link related data. The relationships are
                                                 defined using keys, which are columns or sets
of columns that uniquely identify records          A junction (or associative) table is used to
within a table. There are several types of         manage this relationship.
relationships in a relational database:
                                                   Example: A "Student" table and a "Course"
Several types of relationships in a relational     table connected by a "StudentCourse"
database:                                          junction table.
1. Primary        Key     -    Foreign     Key     These relationships help maintain data
Relationship:                                      integrity, avoid data redundancy, and provide
                                                   a way to navigate and retrieve related
•This is the most         common type of
                                                   information across multiple tables in a
relationship.
                                                   relational database.
The primary key in one table is referenced as
a foreign key in another table.
                                                                    Lesson 4
It establishes a link between the two tables.
                                                   ENTITY RELATIONSHIP DIAGRAM
Example: Connecting an "Employee" table
with a "Department" table using the                An Entity Relationship Diagram is made up
DepartmentID as a foreign key in the               of many different components:
Employee table.
                                                      • Entity
2. One-to-One Relationship:                           • Relationship
Each record in the first table is related to one      • Attribute
and only one record in the second table,           Symbols and notations
and vice    versa.
                                                   Chen
Example: Storing detailed information about
employees in a separate table from their basic     Example of the symbols used with the Chen
information.                                       notation style.
3. One-to-Many Relationship:
Each record in the first table can be related to
multiple records in the second table, but each
record in the second table is related to only
one record in the first table.
Example: One department has many
employees, but each employee belongs to
only one department.
4. Many-to-Many Relationship:
Each record in the first table can be related to   Crow’s Foot
multiple records in the second table, and vice
versa.
          Barker
Logical
Bachman
Physical