Professional Documents
Culture Documents
Lecture1 Introduction
Lecture1 Introduction
Management
Md. Manowarul Islam
Associate Professor, Dept. of CSE
Jagannath University
Contents:
Course Outline
Recommended textbook
Introduction to Database
Application
program End-user
Md. Manowarul Islam, Dept. of CSE, JnU
Database Management Systems
Application
program End-user
Md. Manowarul Islam, Dept. of CSE, JnU
DBMS:
DBMS contains information about a particular enterprise
Collection of interrelated data
Set of programs to access the data
This data is called database
Goals of DBMS
Provide an environment that is both convenient
and efficient
Manage large bodies of information
Ensure the safety and security of the information
Avoid possible anomalous results
3. Data isolation
Multiple file formats, duplication of information in
different files
Writing new application programs to retrieve the
appropriate data is difficult.
4. Integrity problems
Integrity constraints (e.g. account balance > 0) become
“buried” in program code rather than being stated explicitly
Hard to add new constraints or change existing ones
7. Security problems
Hard to provide user access to some, but not all, data
every user of the database system should be able to
access all the data
Level of abstraction
Physical level
Logical level
View level
Logical level
Describes what data stored in database
Describes what relationships exist among those data
View Level
Describe only part of the entire database.
Views can also hide information (such as an employee’s
salary) for security purposes.
Schemas
The overall design of the database
Schemas are changed infrequently
Variable declaration (with type definition) of a
programming language
Instance
Actual content of the database at a particular point in time
Analogous to the value of a variable
Microsoft Access
FoxPro
dBase
Data Model
Database Language
Data
High-level
Query Q Answer
Translates Q into
best execution plan
DBMS for current conditions,
runs plan
Data
High-level
Query Q Answer
Translates Q into
best execution plan
DBMS for current conditions,
runs plan
Keeps data safe
and correct
despite failures,
concurrent Data
updates, online
processing, etc.
Md. Manowarul Islam, Dept. of CSE, JnU
Describing Data: Data Models
A data model is a collection of concepts for
describing data.
A schema is a description of a particular
collection of data, using a given data model.
The relational model of data is the most widely
used model today.
Main concept: relation, basically a table with rows and
columns.
Every relation has a schema, which describes the
columns (fields, attributes) and keys.
Courses(cid text,
cname text,
credits integer)
Enrolled(sid text,
cid text,
grade text)
Smith 17 1 CS
Brown 8 2 CS
unique name
An example of a record-based model
• database is structured in fixed-format records of
several types
•Each table contains records of a particular type
•Each record type defines a fixed no. of fields, or
attributes
Slide 1- 50
Md. Manowarul Islam, Dept. of CSE, JnU
Data Manipulation Language (DML)
Language for accessing and manipulating the data organized
by the appropriate data model
DML also known as query language
Two classes of languages
Procedural – user specifies what data is required and how to
o Presentation Layer
Static or dynamically generated content rendered by the
browser (front-end)
oLogic Layer
o A dynamic content processing and generation level
application server, e.g., Java EE, ASP.NET, PHP
o Business logic acts as an interface between Client layer
and Data Access Layer
o All business logic – like validation of data, calculations,
data insertion/modification are written under business logic
layer.
o It makes communication faster and easier between the
client and data layer
o Data Layer
A database, comprising both data sets and the database
management system or RDBMS software that manages and
provides access to the data (back-end)
Presentation Layer
oProvides user interface
oHandles the interaction
with the user
oSometimes called the
GUI or client view or
front-end
oShould not contain
business logic or data
access code
Logic Layer
oThe set of rules for
processing information
oCan accommodate many
users
oSometimes called
middleware/ back-end
oShould not contain
presentation or data access
code
Data Layer
oThe physical storage layer
for data persistence
oManages access to DB or
file system
oSometimes called back-
end
oShould not contain
presentation or business
logic code
Independence of Layers
oEasier to maintain
oComponents are reusable
oFaster development (division of work)
o Web designer does presentation
o Software engineer does logic
o DB admin does data model
clerical staff
requirements
SQL
Domain type in SQL
Creating a Database
Operation on database
DML
Integrity
View definition
Transaction control
Embedded SQL
Authorization
show databases;
use bcc;
Show tables;
Show tables;
DESCRIBE person;
When
During table creation
After table creation, by modifying the existing
table
How
Column level approach
Table level approach
OR:
CREATE TABLE Product (
name CHAR(30),
category VARCHAR(20)
PRIMARY KEY (name))
Column level
Table level
INSERT INTO
Allowed
Not allowed:
already exists
describe student;
ALTER TABLE
student
ADD UNIQUE
(Name)
Create a table
create table std (
id int NOT NULL )