39
CS3270 DATABASE – I Mr. Dilawar Lecturer, Computer Science Faculty, Bakhtar University Kabul, Afghanistan.

CS3270 - DATABASE SYSTEM - Lecture (1)

Embed Size (px)

Citation preview

Page 1: CS3270 - DATABASE SYSTEM -  Lecture (1)

CS3270DATABASE – I

Mr. Dilawar

Lecturer,Computer Science Faculty,

Bakhtar UniversityKabul, Afghanistan.

Page 2: CS3270 - DATABASE SYSTEM -  Lecture (1)

Course ObjectivesAfter successfully completing this course, you will be able to: • Understand the underlying concepts of database, and database management

system (DBMS).• Learn the concept of relational data model.• Analysis and design of database application or information system.• Experience with SQL.• Implement the database using SQL.• Learn to work with Microsoft SQL Server environment.

Page 3: CS3270 - DATABASE SYSTEM -  Lecture (1)

Course Outline• Introduction to Databases

• Database Environment

• Database Architecture and the Web

• The Relational Model

• Relational Algebra and Relational Calculus

• SQL: Data Manipulation

• SQL: Data Definition

Page 4: CS3270 - DATABASE SYSTEM -  Lecture (1)

Course Outline• Database Planning, Design, and Administration

• Fact-Finding Techniques

• Entity-Relationship Modeling

• Enhanced Entity-Relationship Modeling

• Normalization

• Advanced Normalization

• Design Methodologies

Page 5: CS3270 - DATABASE SYSTEM -  Lecture (1)

Text Books to Follow• Database Systems: A Practical Approach to Design, Implementation, and

Management, Connolly, T. M., and Begg, C. E. 6th Edition, Addison Wesley, 2015.

• Modern Database Management, Hoffer, Jeffrey A., and Prescott, Mary B., and McFadden, Fred R. 10th Edition, Prentice Hall, 2011.

• Database Processing Fundamentals, Design and Implementation, Kroenke, David M. 12th Edition, Prentice Hall.

• An Introduction to Database Systems, Date, C. J. 8th Edition, Addison Wesley, 2003.

Page 6: CS3270 - DATABASE SYSTEM -  Lecture (1)

Introduction to DatabasesChapter – 1

Page 7: CS3270 - DATABASE SYSTEM -  Lecture (1)

Lecture Outline• Introduction

• Traditional File-Based Systems

• Database Approach

• Roles in the Database Environment

• History of DBMS

• Advantages and Disadvantages of DBMSs

Page 8: CS3270 - DATABASE SYSTEM -  Lecture (1)

Introduction• Collection of logically related data is called database.

• A database may be of any size and complexity.• Salesperson may contain a small database of customer contacts.• A large corporation may build a large database.

Page 9: CS3270 - DATABASE SYSTEM -  Lecture (1)

Introduction• Other examples of database applications can be:• Purchases from the supermarket.• Purchasing using your credit card.• Booking a holiday at the travel agent.• Using the local library.• Using the internet.• Studying at university.

Page 10: CS3270 - DATABASE SYSTEM -  Lecture (1)

Introduction• A software or tool that is used to manage and control the access to

the database is called database management systems.

• A database application is simply a program that interacts with the database at some point in its execution.

• A database system is a collection of application programs that interact with the database along with the DBMS and database itself.

Page 11: CS3270 - DATABASE SYSTEM -  Lecture (1)

Traditional File Processing System• File-based system is a collection of application programs that perform

services for the end-users such as the production of reports.• Each program defines and manages its own data.

• Early attempt to computerize the manual filing system.• Files in cabinet and locks for security.• For searching we may have indexing system that helps locate what we want quickly.

• Works well• While number of items to be stored is small.• For only storage or retrieval functionality of large number of items.

Page 12: CS3270 - DATABASE SYSTEM -  Lecture (1)

Traditional File Processing System• The manual system becomes more inefficient while processing the

information in the files.• Typical real estate agent’s office holds two separate files:

• File for each property for sale or rent.

• File for each buyer and renter, and each member of staff.

Page 13: CS3270 - DATABASE SYSTEM -  Lecture (1)

Traditional File Processing System

Sales Department

Contract Department

Page 14: CS3270 - DATABASE SYSTEM -  Lecture (1)

Traditional File Processing System• Consider the efforts that would be required to answer the following

questions:

Page 15: CS3270 - DATABASE SYSTEM -  Lecture (1)

File-Based Approach• The file-based system was developed in response to the needs of

industry for more efficient data access.• Based on decentralized approach, where each department, with the

assistance of Data Processing (DP) staff, stored and controlled its own data.

• Consider the DreamHome example.

Page 16: CS3270 - DATABASE SYSTEM -  Lecture (1)

File-Based Approach

Page 17: CS3270 - DATABASE SYSTEM -  Lecture (1)

File-Based Approach• Significant amount of duplication of data.

• Before to discuss the limitations, it is useful to understand the terminology used in file-based systems.• A file is simply a collection of records, which contains logically related data.

• For example, the PropertyForRent file contains six records, one for each property.

• Each record contains a logically connected set of one or more fields.• Each field represents some characteristics of the real-world object that is being modeled.

Page 18: CS3270 - DATABASE SYSTEM -  Lecture (1)

Limitations of File-Based Approach• Separation and isolation of data• Each program maintains its own set of data.• Users of one program may be unaware of potentially useful data held by

other programs.

• Duplication of data• Decentralized approach taken by each department.

• Same data is held by different programs.

• Wasted space, money and time and perhaps more importantly data integrity; in other words data consistency.

Page 19: CS3270 - DATABASE SYSTEM -  Lecture (1)

Limitations of File-Based Approach• Data Dependence

• File structure is defined in the program code.• Also known as a Program-Data dependence.

• Incompatible file formats• Programs are written in different languages, and so cannot easily access each

other’s files.

• Fixed Queries/Proliferation of application programs• Programs are written to satisfy particular functions.• Any new requirement needs a new program.

Page 20: CS3270 - DATABASE SYSTEM -  Lecture (1)

Database Approach• All the above limitations of file-based approach can be listed as:• The definition of the data is embedded in the application programs, rather

than being stored separately and independently.• There is no control over the access and manipulation of data outside that

forced by the application programs.

• The above limitations were overcome with the new approach called database approach (database and DBMS).

Page 21: CS3270 - DATABASE SYSTEM -  Lecture (1)

The Database• A shared collection of logically related data, and a description of this

data, designed to meet the information needs of an organization – Database.• Integrated with a minimum amount of duplication.• Shared corporate resource.• Also holds the description of the data.

• Description of data is known as the system catalog (or data dictionary or metadata – the ‘data about data’).• Data abstraction.

Page 22: CS3270 - DATABASE SYSTEM -  Lecture (1)

Database Management System• A software system that enables users to define, create, maintain, and

control access to the database.

• The DBMS is the software that interacts with the users’ application programs and the database.

Page 23: CS3270 - DATABASE SYSTEM -  Lecture (1)

Database Management System• Typically, a DBMS provides the following facilities:• It allows users to define the database, usually through a Data Definition

Language. • The DDL allows users to specify the data types and structures and the constraints on the

data to be stored in the database.

• It allows users to insert, update, delete, and retrieve data from the database, usually through Data Manipulation Language (DML).• It provides controlled access to the database.

• Data security, data integrity, concurrency control system, recovery control system, and a user-accessible catalog.

Page 24: CS3270 - DATABASE SYSTEM -  Lecture (1)

(Database) Application Programs• A computer program that interacts with the database by issuing an

appropriate request (typically an SQL statement) to the DBMS.• The programs might be a desktop application or an online application.

• The application program may be written in some programming languages or in some 4GL.

Page 25: CS3270 - DATABASE SYSTEM -  Lecture (1)

(Database) Application Programs

Page 26: CS3270 - DATABASE SYSTEM -  Lecture (1)

(Database) Application Programs• Allows each user to have his or her own view of the database – View.

• A view is essentially some subset of the database.

• The benefits of views are:• Reduce complexity.• Provide a level of security.• Provide a mechanism to customize the appearance of the database.• Present a consistent, unchanging picture of the structure of the database,

even if the underlying database is changed.

Page 27: CS3270 - DATABASE SYSTEM -  Lecture (1)

Components of the DBMS Environment

Page 28: CS3270 - DATABASE SYSTEM -  Lecture (1)

Roles in the Database Environment• Data Administrator (DA)• The DA is responsible for the management of the data resource including database

planning, development and maintenance of standards, policies and procedures.

• Database Administrator (DBA)• Physical realization of the database.• Physical database design and implementation.• Security and integrity control.• Maintenance of the operational system.• Ensuring satisfactory performance of the applications for users.

Page 29: CS3270 - DATABASE SYSTEM -  Lecture (1)

Roles in the Database Environment• Database Designers (Logical and Physical)• The logical database designer must have a thorough and complete

understanding of the organization’s data and any constraints on this data.• Identifying the data (entities, attributes, relationships, and constraints).

• Constraints are some called business rules.

Page 30: CS3270 - DATABASE SYSTEM -  Lecture (1)

Roles in the Database Environment• Database Designers (Logical and Physical)• The physical database designer decides how the logical database design is to

be physically realized.• Mapping the logical database design into a set of tables and integrity constraints.

• Selecting specific storage structures and access methods for the data to achieve good performance.

• Designing any security measures required on the data.

Page 31: CS3270 - DATABASE SYSTEM -  Lecture (1)

Roles in the Database Environment• Application Programmers• Once the database is implemented, the application programs that provide the

required functionality for the end-users must be implemented.

• End Users (naive and sophisticated)

Page 32: CS3270 - DATABASE SYSTEM -  Lecture (1)

History of Database Management Systems• Roots of the DBMS• Apollo moon-landing project, 1960s.• NAA (North American Aviation), prime contractor for the project. • Developed a software GUAM (Generalized Update Access Method),

hierarchical.• In mid – 1960s IBM joined NAA, result was IMS (Information Management

System).

Page 33: CS3270 - DATABASE SYSTEM -  Lecture (1)

History of Database Management Systems• IDS ( Integrated Data Store)• By General Electric, network, mid-1960.

• CODASYL (Conference on Data Systems Languages)• DBTG (Data Base Task Group)

• Proposal in 1971.

• Network schema, subschema, and data management language.

• DDL, subschema DDL, and DML.

Page 34: CS3270 - DATABASE SYSTEM -  Lecture (1)

History of Database Management Systems• E. F. Codd, 1970• IBM Research Laboratory• Relational model • Result of this project

• Development of SQL

• Commercial relational DBMS products e.g. DB2, SQL/DS from IBM, Oracle from Oracle Corp.

Page 35: CS3270 - DATABASE SYSTEM -  Lecture (1)

Advantages of DBMSs• Control of data redundancy

• Data consistency

• More information from the same amount of data

• Sharing of data

• Improved data integrity (constraints)

• Improved security (authentication, rights)

• Enforcement of standards (data formats, naming conventions, documentation etc.)

Page 36: CS3270 - DATABASE SYSTEM -  Lecture (1)

Advantages of DBMSs• Economy of scale (economical cost)

• Balance conflicting requirements

• Improved data accessibility and responsiveness (ad hoc queries)

• Increased productivity (developer)

• Improved maintenance through data independence

• Increased concurrency

• Improved backup and recovery services

Page 37: CS3270 - DATABASE SYSTEM -  Lecture (1)

Disadvantages of DBMSs• Complexity

• Size (disk space for DBMS)

• Cost of DBMS

• Additional hardware costs

• Cost of conversion

• Performance

• Higher impact of a failure

Page 38: CS3270 - DATABASE SYSTEM -  Lecture (1)

Summery• Introduction

• Traditional File-Based Systems

• Database Approach

• Roles in the Database Environment

• History of DBMS

• Advantages and Disadvantages of DBMSs

Page 39: CS3270 - DATABASE SYSTEM -  Lecture (1)

Thank YouFor your Patience