Course Title: Database Programming with SQL
Course Code: DEE 431
TOPICS COVER:
Database Terminologies
Drawbacks of Traditional System
Data processing Modes
Application of DBMS
Types of Database
Histroy of Database
Characteristics of Database
Advantages and Disadvantages of Database
Types of database architecture: 1 Tier, 2 Tier, 3 Tier
1. D.E.I TECHNICAL COLLEGE
COURSE TITLE: DATABASE PROGRAMMING WITH SQL
COURSE CODE: DEE431
SLIDE: 1
CLASS: DIPLOMA IN INFORMATION TECHNOLOGY VOCATIONAL
SEMESTER: FOURTH
SESSION: 2019-20
2. SYLLABUS (PRACTICAL)
PART:1 Introduction to SQL. Important concepts and terminology associated with relational databases.
Create and run SQL commands to create tables, use data types, and add rows to tables.
PART:2 Single-Table Queries. Using SQL commands to query a single table. Simple and compound conditions;
computed columns; the SQL BETWEEN, LIKE and IN operators; using SQL functions; nesting queries; grouping
data; and retrieving columns with null values. Advanced queries, sub-querying, CTEs and temp tables. Review of
Views; Using system functions
PART:3 Multiple-Table Queries. Using SQL commands to query multiple tables. Use SQL IN and EXISTS
operators; queries with subqueries; using aliases; joining a table to itself; SQL set operations; use of ANY and ALL
operators.
PART:4 Updating Data. Using SQL commands to create new tables from existing tables; update data in existing
tables; add new rows to tables; delete data from tables; delete tables. Understand the concept of a transaction,
and the use of COMMIT and ROLLBACK commands.
PART:5 SQL Scripting, using variables, error handling, dynamic sql, Procedural Programming with Stored
Procedures, SQL Functions and Procedures, Triggers, Cursors. Basics of Database Administration.
2
3. BASIC DBMS TERMINOLOGIES
DATA: Basic raw fact or unorganized fact. Ex- rollno, name, marks.
Record/Tuple: Collection of data or Records in table are called Tuples. Ex- <101 SAM 86.58>
Table/Entity: Collection of record or Structure inside database that contains data.
Colum/Field/Attribute/Feature: Attributes of entity or table are called Field.
Database: Collection of logically related data or collection of similar records or collection of table.
Management: Through set of programs.
DBMS: Collections of logically related data and set of programs to access those data.
Examples: Oracle, MySQL, Microsoft SQL Server, MS-Access, IBM DB2, SQLite, Bigtable, Hazelcast, etc.,
Schema: Logical structure of database. 3
4. DATA PROCESSING MODES
Batch processing:
Transactions are collected in a group & processed together.
On-line (interactive) processing:
Transactions are processed as & when they appear.
Real-time processing:
It is a parallel time relationship with on-going activity & the information
produced is useful in controlling the current / dynamic activity.
4
5. TRADITIONAL METHOD OF DATA STORAGE
In the traditional approach, we used to store information in flat files which are maintained by
the file system under the operating system’s control.
Application programs go through the file system to access these flat files
Problems: traditional approach
Data Security
Data Redundancy
Data Isolation
Program / Data Dependence
Lack of Flexibility
Concurrent Access Anomalies
5
6. THESE DIFFICULTIES PROMPTED THE DEVELOPMENT
OF DATABASE SYSTEMS.
Constraints:
restriction, limitation
Inconsistency:
lacking uniformity or agreement
Centralized:
Systems where decision making, flow of data, or the beginning of activities are initiated at the
same central point and disseminated to remote points in the chain or organization.
6
7. DATABASE MANAGEMENT SYSTEM
Collection of interrelated files and set of programs which allows users to access
and modify files
Primary Goal is to provide a convenient and efficient way to store, retrieve and
modify information
Layer of abstraction between the application programs and the file system
Application programs request the DBMS to retrieve, modify, insert or delete
data for them
It is a general purpose software system that facilitates the process of defining,
constructing, manipulating, and applications.
7
8. HISTORY OF DBMS
1960 - Charles Bachman designed first DBMS system
1970 - Codd introduced IBM'S Information Management System (IMS)
1976- Peter Chen coined and defined the Entity-relationship model also know as the ER
model
1980 - Relational Model becomes a widely accepted database component
1985- Object-oriented DBMS develops.
1990s- Incorporation of object-orientation in relational DBMS.
1991- Microsoft ships MS access, a personal DBMS and that displaces all other personal
DBMS products.
1995: First Internet database applications
1997: XML applied to database processing. Many vendors begin to integrate XML into
DBMS products.
8
9. EVOLUTION OF DATABASE
Databases have evolved since their inception in the early 1960s.
In the 1980s, Relational databases became popular, followed by object-oriented
databases in the 1990s.
More recently, NoSQL databases came about as a response to the growth of the internet
and the need for faster speed and processing of unstructured data.
Today, Cloud databases and self-driving databases are breaking new ground when it comes
to how data is collected, stored, managed, and utilized.
9
10. CHARACTERISTICS OF DATABASE MANAGEMENT SYSTEM
Data stored into Tables
Reduced Redundancy
Data Consistency
Support Multiple Users and concurrent access
Query Language
Security
Transactions
10
11. DIFFERENCE BETWEEN FILE AND DBMS OPERATIONS
11
End User
Application Programs
Interface through high level language
READ CUSTOMER_DETAILS-FILE AT END
STOP RUN
Operating System
(Disk Manager, File Manager)
File System (Disk Storage)
End User
Application Programs
Interface through Query (SQL)
SELECT * FROM Customer_Details
Operating System
(Disk Manager, File Manager)
Database(Disk Storage)
DBMS
File system Interface DBMS Interface
Customer_Details file
Customer_Loan file
Customer_Details table
Customer_Loan table
12. ADVANTAGES OF DATABASE MANAGEMENT SYSTEM
Data independence
Reduction in data redundancy
Better security
Better flexibility
Effective data sharing
Enforces integrity constraints
Enables backup and recovery
12
13. DISADVANTAGES OF DATABASE MANAGEMENT SYSTEM
Cost of Hardware and Software
Except MySQL, which is open source, licensed DBMSs are generally costly.
They are large in size.
Higher impact of failure
Complexity
13
15. USERS OF A DBMS
Database Administrator (DBA)
Managing information contents
Liaison with users
Enforcing security and integrity rules
Strategizing backup & recovery
Monitoring performance
Database designers
Application programmers
End users 15
16. COMPONENTS OF DBMS
The database management system can be divided into five major components,
they are:
Hardware
Software
Data
Procedures
Database Access Language
16
SOFTWARE
HARDWARE
END USER
PROCEDURE
DAL
DATA
17. WHAT IS DBMS ARCHITECTURE?
DBMS architecture helps in design, development, implementation, and
maintenance of a database. A database stores critical information for a
business. Selecting the correct Database Architecture helps in quick and
secure access to this data.
1 tier Architecture
2-tier Architecture
3-tier Architecture
17
18. 1-TIER ARCHITECTURE
The simplest of Database Architecture are 1 tier where the Client, Server,
and Database all reside on the same machine. Anytime you install a DB in
your system and access it to practice SQL queries it is 1 tier architecture.
But such architecture is rarely used in production.
18
PRESENTATION LAYER
APPLICATION LAYER
DATABASE LAYER
CLIENT TIER
19. 2-TIER ARCHITECTURE
A two-tier architecture is a database architecture
where
Presentation layer runs on a client (PC, Mobile, Tablet,
etc.,)
Data is stored on a Server.
An application interface which is called ODBC (Open
Database Connectivity) an API which allows the
client-side program to call the DBMS. Today most of
the DBMS offers ODBC drivers for their DBMS. 2 tier
architecture provides added security to the DBMS as
it is not exposed to the end user directly.
Example of Two-tier Architecture is a Contact
Management System created using MS- Access.
19
DATABASE SYSTEM
APPLICATION
USER
SERVERCLIENT
20. 3-TIER ARCHITECTURE
In a three-tier architecture
Client Machine
the client machine acts as merely a front end and
does not contain any direct database calls
Instead, the client end communicates with an application server, usually through a forms
interface
Application Server
The application server in turn communicates with a database system to access data.
20
21. CONTINUE…
Important
The business logic of the
application, which says what actions
to carry out under what conditions,
is embedded in the application
server, instead of being
distributed across multiple
clients.
Three-tier applications are more
appropriate
for large applications, and
for applications that run on the
World Wide Web.
21
DATABASE SYSTEM
APPLICATION
LAYER
GUI/PRESENTATION
LAYER
END USER/CLENT
APPLICATION
SERVER
23. CONTINUE..
23
Centralized Distributed
All data is located at a single site.
Allows for greater control over accessing and updating
data.
Vulnerable to failure as they depend on the availability of
resources at the central site
Example:
The account information of customers is stored in a
branch office of a bank. This information must be shared
across all Automated Teller Machines (ATM), so that
customers can withdraw money from their accounts. Instead
of storing the customer information in every ATM machine it
can be stored at a common place (the branch office of the
bank) and shared over a network.
The database is stored on several computers - from
personal computers up to mainframe systems.
Computers in a distributed system communicate with
one another through various communication media, such
as high speed networks or telephone lines.
Distributed databases are geographically separated and
managed.
Distributed databases are separately administered.
Distributed databases have a slower interconnection.
Example: Consider the bank system. The bank’s head office
is located at Chicago and the branch offices are at
and Tokyo. The bank database is distributed across the
branch offices. The branch offices are connected through a
network
24. CONTINUE…
Relational Database: This database is based on the relational data model, which stores data
in the form of rows(tuple) and columns(attributes), and together forms a table(relation).
NoSQL Database: Non-SQL/Not Only SQL is a type of database that is used for storing a
wide range of data sets. It is not a relational database as it stores data not only in tabular
form but in several different ways.
Cloud Database: A type of database where data is stored in a virtual environment and
executes over the cloud computing platform
Object-oriented Databases: The type of database that uses the object-based data model
approach for storing data in the database system.
Hierarchical Databases: It is the type of database that stores data in the form of parent-
children relationship nodes. Here, it organizes data in a tree-like structure.
24
25. CONTINUE…
Network Databases: It is the database that typically follows the network data model. Here,
the representation of data is in the form of nodes connected via links between them.
Personal Database: Collecting and storing data on the user's system defines a Personal
Database. This database is basically designed for a single user.
Operational Database: The type of database which creates and updates the database in
real-time. It is basically designed for executing and handling the daily data operations in
several businesses
Enterprise Database: Large organizations or enterprises use this database for managing a
massive amount of data. It helps organizations to increase and improve their efficiency.
25