LEARNING OBJECTIVES
1. What is a database system, and how does it differ from file-oriented systems?
2. What is a relational database system?
3. How do you design a well-structured set of tables in a relational database?
4. How do you query a relational database system?
Databases and Files
1. What is the nature of data stored in an accounting system
For financial reporting, an accounting system must necessarily store data about :
• Assets
• Liabilities and equity
• revenue and expense transactions.
• audit, tax, and control information needs.
• information about budgets, transactions in progress
File-Oriented Systems
In early processing systems, an organization’s information was
stored as groups of records in separate files. These file
processing systems constituted of a few data files and many
application programs. Each file called a flat file contained and
processed information for one specific function, such as
accounting or inventory.
Limitations of File Processing System:
• Separated and Isolated Data: To make a decision, a user
might need data from two separate files.
• Data Redundancy: Often, the same information was stored
in more than one file. the replication of data caused loss of
data integrity. no one would know which information was
correct.
• Difficulty in representing data from user’s view: it was
difficult to determine relationships between isolated data in
order to meet user requirements
Database Systems
• Databases were developed to address the proliferation of
redundant data in the files of systems using the file approach.
• The goal of the database approach is to create an organization-
wide database that stores all of the data needed to operate the
business while linking data across various functions and
eliminating redundancy
• In summary, a database is an organized collection of data about a
set of entities stored with as little data redundancy as possible. A
database’s value comes from the consolidation of data into a
common pool that can serve a variety of users and data
processing applications.
The Advantages of Database Systems
• DBMS offers a variety of techniques to store & retrieve data
• Uniform administration procedures for data
• A DBMS uses various powerful functions to store and retrieve data efficiently.
• Offers Data Integrity and Security
• The DBMS implies integrity constraints to get a high level of protection against prohibited
access to data.
• Reduced Application Development Time
• Consume lesser space
• Reduction of redundancy.
• Data independence.
A database Management System
(DBMS)
• is the program that manages and controls the data and the
interfaces between the data and the application programs that
use the data stored in the database
• The database administrator (DBA) is responsible for coordinating,
controlling, and managing the database
LOGICAL AND PHYSICAL VIEWS OF DATA
The logical view is how people conceptually organize and understand the relationships among data
items.
For example : a sales manager views all customer information as being stored in a table.
The physical view refers to the way data are physically arranged and stored in the
computer system.
The DBMS allows users to access, query, or update the database without reference to how or where
data are physically stored.
Separating the logical and physical views of data also means that users can change their logical view
of data without changing the way data are physically stored
The Database approach provides two separate views of the data: the physical view and the
logical view
A schema
Physical Schema
 It is also known as Internal level.
 This is the lowest level of the architecture.
 This data is stored in the external hard drives in the form of bits.
 This level describes how the data actually stored in the storage device.
 This physical level also discuess encryption techniques.
 This level is also responsible for allocating space of the data.
Conceptual Schema
 It is also known as logical level.
 The conceptual level is a higher level than the physical level.
 This level is maintained by DBA(database administrator).
 The whole design of the database such as relationship among data ,schema of data etc.are
described in this level.
 It is the middle level between external or internal levels.
External Schema
It is also known as view level.
 This is highest level architecture and closest to the user.
 The user doesn’t need to know the database schema details such as data structure, table
definition etc.
 External level is related to the data which is viewed by individual end users.
A data dictionary
A data dictionary can be defined as a collection of metadata such as object name, data
type, size, classification, and relationships with other data assets. A data dictionary acts
as a reference guide on a dataset.
DBMS Language
A DBMS has several languages :
The data definition language (DDL) :
 builds the data dictionary
 creates the database
 describes logical views for each user, and specifies record or field security constraints
Examples of DDL commands in structured query language (SQL) would be the CREATE, DROP,
and ALTER statements.
DBMS Language
A DBMS has several languages :
The data manipulation language (DML)
changes database content, including data, updates, insertions, and deletions
SQL examples
would include INSERT, UPDATE, TRUNCATE, and DROP statements
DBMS Language
A DBMS has several languages :
The data query language (DQL)
is a high-level, English-like language that contains powerful, easy-to-use commands that
enable users to retrieve, sort, order, and display data.
SQL examples
the SELECT statement in the SQL language
Relational data model
A two-dimensional table representation of data; each row represents a unique entity (record)
and each column is a field where record attributes are stored
Inventory Relation
Attribute/Column Name
Row/Record
/Tuple
Filed
Type Of Attribute
Simple Attributes
The Student is an entity represented by a rectangle
It consists of attributes: Roll_no, class, and Age.
We can't further subdivide the Roll_no attribute and even the other two attributes into sub-
attributes.
These attributes are also known as atomic attributes
Composite Attributes
The Student is an entity represented by a rectangle
It consists of attributes: Roll_no, class, and Age.
We can't further subdivide the Roll_no attribute and even the other two attributes into sub-
attributes.
These attributes are also known as atomic attributes
Basic Requirements Of A Relational
Database
We now turn to the guidelines used to develop a properly structured relational
database.
 . Every column in a row must be single valued
 Primary keys cannot be null.
 Foreign keys, if not null, must have values that correspond to the value of a primary key in
another table
 All nonkey attributes in a table must describe a characteristic of the object identified by the
primary key
These four constraints produce a well-structured (normalized) database in which
data are
consistent and data redundancy is minimized and controlled.
Two Approaches to Database
Desgine
 normalization
begins by assuming that everything is initially stored in one large table. Rules are then
followed to decompose that initial table into a set of tables that are called third normal form
(3NF)
 semantic data modeling
the designer uses knowledge of business processes and information needs to create a
diagram that shows what to include in the database. This diagram is used to create a set of
relational tables that are already in 3NF
Database Systems And The Future of Accounting
 Database systems expand accounting’s ability to produce real-time dynamic reports of all aspects
of the accounting equation
 Databases are capturing increasing amounts of transaction data beyond what was captured
through accounting journals and ledgers in double entry accounting.
 Presently, data about even the smallest movements of materials in production, inventory
defects, machine operations, and employee effort can be captured in real time.
 Management can access the information they need whenever they want it. For example, tables
storing information about assets can include historical costs as well as current replacement
costs, market values, and real-time utilization
Chapter Quiz
1. What is each row in a relational database table called?
a. tuple
b. relation
c. attribute
d. anomaly
2. An employee database that consolidates payroll, personnel, and job skills master files is referred to
as
a. data integration.
b. data sharing.
c. data independence.
Chapter Quiz
3. Which of the following describes a situation where non-primary key items are stored multiple
times, leading to data inconsistencies?
a. update anomaly
b. insert anomaly
c. delete anomaly
4. The internal-level schema of a database system consists of an individual user’s view of portions
of a database and is also called a subschema.
a. True
b. False
Chapter Quiz
5. Which of the following is an individual user’s view of the database?
a. internal-level schema
b. conceptual-level schema
c. external-level schema
d. logical-level schema
6. Which of the following would managers most likely use to retrieve information about sales
during the month of October?
a. DQL
b. DML
c. DSL
d. DDL
Chapter Quiz
7. Which of the following is not considered an advantage of a database system?
a. Data are independent of the programs that use them.
b. Integrated data can be shared with authorized users.
c. Data can be stored multiple times in multiple locations.
d. Master files are consolidated and accessible to many application programs.
8. The constraint that all foreign keys must have either null values or the value of a primary key in
another table is referred to as which of the following?
a. referential integrity rule
b. entity integrity rule
c. foreign key value rule
d. null value rule
Chapter Quiz
9. The constraint that all primary keys must have non-null data values is referred to as which of the
following?
a. referential integrity rule
b. entity integrity rule
c. normalization rule
d. relational data model rule
10.Which of the following is not a basic requirement of a relational database?
a. Primary keys cannot be null.
b. Every column in a row must be single valued.
c. Foreign keys cannot be null.
d. All non-key attributes in a table must describe a characteristic of the object identified by the
primary key
Chapter 4 Chapter Relational DB - Copy.pptx

Chapter 4 Chapter Relational DB - Copy.pptx

  • 1.
    LEARNING OBJECTIVES 1. Whatis a database system, and how does it differ from file-oriented systems? 2. What is a relational database system? 3. How do you design a well-structured set of tables in a relational database? 4. How do you query a relational database system?
  • 2.
    Databases and Files 1.What is the nature of data stored in an accounting system For financial reporting, an accounting system must necessarily store data about : • Assets • Liabilities and equity • revenue and expense transactions. • audit, tax, and control information needs. • information about budgets, transactions in progress
  • 3.
    File-Oriented Systems In earlyprocessing systems, an organization’s information was stored as groups of records in separate files. These file processing systems constituted of a few data files and many application programs. Each file called a flat file contained and processed information for one specific function, such as accounting or inventory.
  • 4.
    Limitations of FileProcessing System: • Separated and Isolated Data: To make a decision, a user might need data from two separate files. • Data Redundancy: Often, the same information was stored in more than one file. the replication of data caused loss of data integrity. no one would know which information was correct. • Difficulty in representing data from user’s view: it was difficult to determine relationships between isolated data in order to meet user requirements
  • 5.
    Database Systems • Databaseswere developed to address the proliferation of redundant data in the files of systems using the file approach. • The goal of the database approach is to create an organization- wide database that stores all of the data needed to operate the business while linking data across various functions and eliminating redundancy • In summary, a database is an organized collection of data about a set of entities stored with as little data redundancy as possible. A database’s value comes from the consolidation of data into a common pool that can serve a variety of users and data processing applications.
  • 7.
    The Advantages ofDatabase Systems • DBMS offers a variety of techniques to store & retrieve data • Uniform administration procedures for data • A DBMS uses various powerful functions to store and retrieve data efficiently. • Offers Data Integrity and Security • The DBMS implies integrity constraints to get a high level of protection against prohibited access to data. • Reduced Application Development Time • Consume lesser space • Reduction of redundancy. • Data independence.
  • 8.
    A database ManagementSystem (DBMS) • is the program that manages and controls the data and the interfaces between the data and the application programs that use the data stored in the database • The database administrator (DBA) is responsible for coordinating, controlling, and managing the database
  • 9.
    LOGICAL AND PHYSICALVIEWS OF DATA The logical view is how people conceptually organize and understand the relationships among data items. For example : a sales manager views all customer information as being stored in a table. The physical view refers to the way data are physically arranged and stored in the computer system. The DBMS allows users to access, query, or update the database without reference to how or where data are physically stored. Separating the logical and physical views of data also means that users can change their logical view of data without changing the way data are physically stored The Database approach provides two separate views of the data: the physical view and the logical view
  • 10.
  • 11.
    Physical Schema  Itis also known as Internal level.  This is the lowest level of the architecture.  This data is stored in the external hard drives in the form of bits.  This level describes how the data actually stored in the storage device.  This physical level also discuess encryption techniques.  This level is also responsible for allocating space of the data.
  • 12.
    Conceptual Schema  Itis also known as logical level.  The conceptual level is a higher level than the physical level.  This level is maintained by DBA(database administrator).  The whole design of the database such as relationship among data ,schema of data etc.are described in this level.  It is the middle level between external or internal levels.
  • 13.
    External Schema It isalso known as view level.  This is highest level architecture and closest to the user.  The user doesn’t need to know the database schema details such as data structure, table definition etc.  External level is related to the data which is viewed by individual end users.
  • 14.
    A data dictionary Adata dictionary can be defined as a collection of metadata such as object name, data type, size, classification, and relationships with other data assets. A data dictionary acts as a reference guide on a dataset.
  • 15.
    DBMS Language A DBMShas several languages : The data definition language (DDL) :  builds the data dictionary  creates the database  describes logical views for each user, and specifies record or field security constraints Examples of DDL commands in structured query language (SQL) would be the CREATE, DROP, and ALTER statements.
  • 16.
    DBMS Language A DBMShas several languages : The data manipulation language (DML) changes database content, including data, updates, insertions, and deletions SQL examples would include INSERT, UPDATE, TRUNCATE, and DROP statements
  • 17.
    DBMS Language A DBMShas several languages : The data query language (DQL) is a high-level, English-like language that contains powerful, easy-to-use commands that enable users to retrieve, sort, order, and display data. SQL examples the SELECT statement in the SQL language
  • 18.
    Relational data model Atwo-dimensional table representation of data; each row represents a unique entity (record) and each column is a field where record attributes are stored Inventory Relation Attribute/Column Name Row/Record /Tuple Filed
  • 19.
  • 20.
    Simple Attributes The Studentis an entity represented by a rectangle It consists of attributes: Roll_no, class, and Age. We can't further subdivide the Roll_no attribute and even the other two attributes into sub- attributes. These attributes are also known as atomic attributes
  • 21.
    Composite Attributes The Studentis an entity represented by a rectangle It consists of attributes: Roll_no, class, and Age. We can't further subdivide the Roll_no attribute and even the other two attributes into sub- attributes. These attributes are also known as atomic attributes
  • 22.
    Basic Requirements OfA Relational Database We now turn to the guidelines used to develop a properly structured relational database.  . Every column in a row must be single valued  Primary keys cannot be null.  Foreign keys, if not null, must have values that correspond to the value of a primary key in another table  All nonkey attributes in a table must describe a characteristic of the object identified by the primary key These four constraints produce a well-structured (normalized) database in which data are consistent and data redundancy is minimized and controlled.
  • 23.
    Two Approaches toDatabase Desgine  normalization begins by assuming that everything is initially stored in one large table. Rules are then followed to decompose that initial table into a set of tables that are called third normal form (3NF)  semantic data modeling the designer uses knowledge of business processes and information needs to create a diagram that shows what to include in the database. This diagram is used to create a set of relational tables that are already in 3NF
  • 24.
    Database Systems AndThe Future of Accounting  Database systems expand accounting’s ability to produce real-time dynamic reports of all aspects of the accounting equation  Databases are capturing increasing amounts of transaction data beyond what was captured through accounting journals and ledgers in double entry accounting.  Presently, data about even the smallest movements of materials in production, inventory defects, machine operations, and employee effort can be captured in real time.  Management can access the information they need whenever they want it. For example, tables storing information about assets can include historical costs as well as current replacement costs, market values, and real-time utilization
  • 25.
    Chapter Quiz 1. Whatis each row in a relational database table called? a. tuple b. relation c. attribute d. anomaly 2. An employee database that consolidates payroll, personnel, and job skills master files is referred to as a. data integration. b. data sharing. c. data independence.
  • 26.
    Chapter Quiz 3. Whichof the following describes a situation where non-primary key items are stored multiple times, leading to data inconsistencies? a. update anomaly b. insert anomaly c. delete anomaly 4. The internal-level schema of a database system consists of an individual user’s view of portions of a database and is also called a subschema. a. True b. False
  • 27.
    Chapter Quiz 5. Whichof the following is an individual user’s view of the database? a. internal-level schema b. conceptual-level schema c. external-level schema d. logical-level schema 6. Which of the following would managers most likely use to retrieve information about sales during the month of October? a. DQL b. DML c. DSL d. DDL
  • 28.
    Chapter Quiz 7. Whichof the following is not considered an advantage of a database system? a. Data are independent of the programs that use them. b. Integrated data can be shared with authorized users. c. Data can be stored multiple times in multiple locations. d. Master files are consolidated and accessible to many application programs. 8. The constraint that all foreign keys must have either null values or the value of a primary key in another table is referred to as which of the following? a. referential integrity rule b. entity integrity rule c. foreign key value rule d. null value rule
  • 29.
    Chapter Quiz 9. Theconstraint that all primary keys must have non-null data values is referred to as which of the following? a. referential integrity rule b. entity integrity rule c. normalization rule d. relational data model rule 10.Which of the following is not a basic requirement of a relational database? a. Primary keys cannot be null. b. Every column in a row must be single valued. c. Foreign keys cannot be null. d. All non-key attributes in a table must describe a characteristic of the object identified by the primary key