Professional Documents
Culture Documents
Introduction to DBMS
• Introduction :
• Basic concepts
• Advantages of DBMS over file processing systems
• Data abstraction
• Database languages
• Data models
• Data independence
• Components of a DBMS, Overall structure of DBMS
• Multi-user DBMS architecture, System catalogs
• Data Modelling: Basic concepts, Entity, attributes, relationships, constraints, keys.
• Case Study :- MySQL Database
•
• Text Books
• a telephone book
• airline reservation system
• motor vehicle registration records
• files on your computer hard drive
Why do we need a database?
• Keep records of :
• Clients
• Staff
• Volunteers
• To keep a record of activities;
• Keep sales records;
• Develop reports;
• Perform research
• Longitudinal tracking
What is the ultimate purpose of a database
management system?
Is to transform
•Almost everyone:
•Business
•Doctors
•Teachers
•Students
Purpose of Database System
1.let's look at a typical file-processing system" supported by a
conventional operating system.
• Highest level.
Conceptual Level
Physical Level
The Elements of a Database
Record
Instances and Schemas
• Instances :-Instances is collection of the Information store in the database
at a particular moment is called Instances.
schema construct
Known data:
name of record types, data items
Example: University Database
Conceptual schema:
Physical schema:
Course_info(cid:string, enrollment:integer)
The DDL , just like any programming languages , gets an input some
instructions and generates some output.
The data dictionary is considered to be a special type of table, which can only
be accessed and updated by the database system itself.
• Referential Integrity –
• There are cases where we wish to ensure that a value that
appears in relation for a given set of attributes also appears for
a certain set of another relation.
• Database modifications can cause violations of referential
integrity.
• When a referential integrity constraints is violated , the normal
procedure is to reject the action that caused the violation.
• Assertions –
• An assertion is any condition that the database must always
satisfy.
• Domain constraints and referential integrity constraints are
special forms of assertion.
• There are many constraints that we cannot express by using
only these special forms.
• E.g. “Every loan has at least one customer who maintains an
account with minimum balance of $10,000” must be expressed
as an assertion.
• Authorization –
• We may want to differentiate among the users as far as the type
of access they permitted on various data values in database.
• These differentiation are expressed in terms of authorization.
• E.g. Read authorization, insert authorization , delete
authorization , update authorization
Data Manipulation Language (DML)
• A data manipulation language (DML) is a language that enables
users to access or manipulate data.
• The goal is to provide efficient human interaction with the
system.
Data Manipulation is:
• Deletion of information in the database
• Modification of information in the database
There are two types of DML: -
Student entity set has four entities john, smith , sana , Lee
Attributes
• An entity is represented by a set of attributes, that is
descriptive properties possessed by all members of an
entity set.
Example:
customer = (customer-id, customer-name,
customer-street, customer-city)
Attributes of
Supplier
Attributes
Attribute types:-
Simple and composite attributes.
Single-valued and multi-valued attributes
E.g. multivalued attribute: phone-numbers
Derived attributes
Can be computed from other attributes
E.g. age, given date of birth
• Composite Attributes
Relationship:-
A relationship is an association among several entities.
e.g. A cust_acct relationship associates a customer with each
account he or she has.
The set of all relationships of the same type is called the
relationship set.
Example:
Hayes depositor A-102
customer entity relationship set account entity
• Relationships between more than two entity sets are rare. Most
relationships are binary.
Ternary relationship set
Branch
city
Branch
Name Assets
Branch
Social
security Street
Account
Balance
No
Cust city
Name
Note: Some elements in A and B may not be mapped to any elements in the
other set
Mapping Cardinalities
3. Division- department. A division will have one or many departments. A department will
belong to only 1 division.
4. A person can own more than one car. A car can only have one owner. So Owner to Car
will be a one to many or 1:M relationship.
5. A person can buy one or many movie tickets. A ticket will belong to only one person.
• The many to many relationship m:m
• Examples:
• 1. Student - professor. A student will have one or more
professors. The same professor will have lots of students.
• 4. A student will have lots of subjects and the same subject can
be taken by lots of students
Database Modeling and Implementation
Process
Relational DBMS
Implementation
Keys
The key is defined as the column or attribute of the database
table.
The following are the various types of keys available in the
DBMS system.
Super Key –
An attribute or a combination of attribute that is used to
identify the records uniquely is known as Super Key.
A table can have many Super Keys.
E.g. of Super Key
1 ID
2 ID, Name
3 ID, Address
4 ID, Department_ID
5 ID, Salary
6 Name, Address
7 Name, Address, Department_ID
………… So on as any combination which can identify the records
uniquely will be a Super Key.
• Candidate Key –
• It can be defined as minimal Super Key or irreducible Super Key.
• In other words an attribute or a combination of attribute that
identifies the record uniquely but none of its proper subsets can
identify the records uniquely.
Security enforcement:-
Ensuring that users only have access to information they are
permitted to see.
Concurrency control:-
Preserving data consistency when there are concurrent users.
Database Administrator
• The database administrator is a person having central control
over data and programs accessing that data.
• Scheme definition:-
• The creation of the original database scheme.
• This involves writing a set of definitions in a DDL , compiled
by the DDL compiler into a set of tables stored in the data
dictionary.
• Storage structure and access method definition:-
• writing a set of definitions translated by the data storage and definition language compiler.
• Scheme and physical organization modification: -
• writing a set of definitions used by the DDL compiler to generate modifications to appropriate
internal system tables (e.g. data dictionary).
• This is done rarely, but sometimes the database scheme or physical organization must be modified.
Are computer professionals interacting with the system through DML calls embedded in a program
written in a host language (e.g. C, Pascal).
Sophisticated users:-
Naive users:-
• Components include:-
File manager :-
manages allocation of disk space and data structures used to
represent information on disk.
• Database manager :-
• The interface between low-level data and application programs
and queries.
• Query processor :-
• Translates statements in a query language into low-level
instructions the database manager understands.
• DML precompiler :-
• Converts DML statements embedded in an application program
to normal procedure calls in a host language.
• The precompiler interacts with the query processor.
• DDL compiler :-
• Converts DDL statements to a set of tables containing metadata
stored in a data dictionary.
• In addition, several data structures are required for physical
system implementation :-
• Data files :-
• Store the database itself.
• Data dictionary :-
• Stores information about the structure of the database. It is used
heavily.
• Great emphasis should be placed on developing a good design
and efficient implementation of the dictionary.
Indices :-
Provide fast access to data items holding particular values.
Overall System Structure
Constraints
• Constraints are used to limit the type of data that can go into a
table.
• Constraints can be specified when a table is created (with the
CREATE TABLE statement) or after the table is created (with
the ALTER TABLE statement).
• The following SQL creates a PRIMARY KEY on the "P_Id" column when the
"Persons" table is created:
• CREATE TABLE Persons
• (
• P_Id int NOT NULL PRIMARY KEY,
• LastName varchar(255) NOT NULL,
• FirstName varchar(255),
• Address varchar(255),
• City varchar(255)
• )
• SQL PRIMARY KEY Constraint on ALTER TABLE
1 77895 3
4 24562 1
• Note that the "P_Id" column in the "Orders" table points to the
"P_Id" column in the "Persons" table.
•MySQL Database
https://www.w3schools.in/
What is MySQL?
• MySQL is a database system used for developing web-based
software applications.
• MySQL used for both small and large applications.
• MySQL is a relational database management system (RDBMS).
• MySQL is fast, reliable, and flexible and easy to use.
• MySQL supports standard SQL (Structured Query Language).
• MySQL is free to download and use.
• MySQL was developed by Michael Widenius and David Axmark in
1994.
• MySQL is presently developed, distributed, and supported by
Oracle Corporation.
• MySQL Written in C, C++.
Main Features of MySQL
• MySQL server design is multi-layered with independent modules.
• MySQL is fully multithreaded by using kernel threads. It can
handle multiple CPUs if they are available.
• MySQL provides transactional and non-transactional storage
engines.
• MySQL has a high-speed thread-based memory allocation system.
• MySQL supports in-memory heap table.
• MySQL Handles large databases.
• MySQL Server works in client/server or embedded systems.
• MySQL Works on many different platforms.
https://www.w3schools.in/
Who uses MySQL
https://www.w3schools.in/
• MySQL is a very popular, open source DBMS
• MySQL databases are relational
• Officially pronounced “my Ess Que Ell” (not my sequel).
• Handles very large databases; very fast performance;
reliable.
• MySQL is compatible with standard SQL
• Why are we using MySQL?
• Free (much cheaper than Oracle!)
• Each student can install MySQL locally.
• Multi-user access to a number of databases offered
• Easy to use Shell for creating tables, querying tables, etc.
• Easy to use with Java JDBC
• MySQL is frequently used by PHP and Perl
History of MySQL
• Founded and developed by David Axmark, Allan
Larsson, and Michael “Monty” Widenius
• Named after Monty's daughter, My
• Written in C and C++
• Works on many different platforms
Thank You!!!