Database
Database
1 Laboratory
- Introduction to SQL
Ms. Janelli M. Mendez, MIT
Instructor
Introduction to Database
Learning Outcomes
1. Define Database Management System (DBMS) and
database.
2. Describe the advantages and disadvantages of DBMS to
file based system.
3. Explain logical database design and the data models.
4. Define the components of a database management system.
Database
What is a database?
Database is a organized collection of data. For example a
database of a college would be having a collection of data such
as-
1. Personal records of Students
2. Students performance history
3. Teachers data
4. Financial department data etc.
Database Management System(DBMS)
A database management system is a software application which is used for
managing different databases. It helps us to create and manage database. With
the help of DBMS we take care following tasks –
1. Data Security
2. Data Backup
3. Manages huge amount of data
4. Data export & import
5. Serving multiple concurrent database requests
6. Gives us way to manage the data using programming languages.
Purpose of Database System
In the early days, database applications were built on top of file systems
Drawbacks of using file systems to store data:
◦ Data redundancy and inconsistency
◦ Multiple file formats, duplication of information in different files
◦ Difficulty in accessing data
◦ Need to write a new program to carry out each new task
◦ Data isolation — multiple files and formats
◦ Integrity problems
◦ Integrity constraints (e.g. account balance > 0) become part of program code
◦ Hard to add new constraints or change existing ones
Purpose of Database System
Drawbacks of using file systems (cont.)
◦ Atomicity of updates
◦ Failures may leave database in an inconsistent state with partial updates carried out
◦ E.g. transfer of funds from one account to another should either complete or not
happen at all
◦ Concurrent access by multiple users
◦ Concurrent accessed needed for performance
◦ Uncontrolled concurrent accesses can lead to inconsistencies
◦ E.g. two people reading a balance and updating it at the same time
◦ Security problems
• Most database management systems are often complex systems, so the training for
users to use the DBMS is required.
• In some organizations, all data is integrated into a single database which can be
damaged because of electric failure or database is corrupted on the storage media.
• Use of the same program at a time by many users sometimes lead to the loss of some
data.
Physical Data Independence – the ability to modify the physical schema without
changing the logical schema
• Applications depend on the logical schema
• In general, the interfaces between the various levels and components should be well defined
so that changes in some parts do not seriously influence others.
Logical Database Design
Physical view
• Involves how data is stored on and retrieved from
storage media
◦ Hard disks, magnetic tapes, or CDs
Logical view
• Involves how information appears to users and
how it can be organized and retrieved
• Includes more than one logical view of data,
depending on the user
Data Models
•Hierarchical Model
•Entity-Relationship Model
•Relational Model
•Network Model
Network Model
• Similar to the hierarchical model but
records are organized differently
• Includes multiple parent and child
records
Sample of Network Model
Components of DBMS
•Database Engine
•Data Definition Language
•Data Manipulation Language
•Application Generation
•Data Administration
Components of DBMS
Database Engine
•Heart of DBMS software
•Responsible for data storage, manipulation, and retrieval
•Converts logical requests from users into their physical
equivalents
• By interacting with other components of the DBMS
Components of DBMS
Data Definition Language
•Creates and maintains the data dictionary
•Defines the structure of files in a database
•Makes changes to a database’s structure
• Adding and deleting fields
• Changing field size and data type
Components of DBMS
Data Manipulation Language
•Used to add, delete, modify, and retrieve records from a database
•Uses a query language
• Structured Query Language (SQL)
◦ Standard fourth-generation query language that consists of several keywords
specifying actions to take
• Query by example (QBE)
◦ Involves requesting data from a database by constructing a statement formed by query
forms
Components of DBMS
Application Generation
•Designs elements of an application using a database
• Data entry screens
• Interactive menus
• Interfaces with other programming languages