Table of contents
what is a database?
A database is an organized collection of data that can be modified, retrieved and updated.
The data stored in the database is in a row and column format, which is called a table.
Every website which needs us to sign up uses a database.
There is no internet without a database.
Types of database
Object-oriented databases
object-oriented databases are databases that represent data in the form of objects and classes. in object-oriented terminology, an object is a real-world entity and a class is a collection of objects. Example- PostgreSQL
Relational database
A relational database is a collection of data items with predefined relationships between them. These items are organized as set of tables with columns and rows. Example- MySQL
Distributed database
A distributed database is an integrated collection of databases that is physically distributed across sites in a computer network. Example- Cassandra
Hierarchical database
a hierarchical database is a database in which data is stored in the form of records and organized in a tree-like structure or parent-child structure. in which one has many child nodes connected through links. example - IBM information systems.
What is DBMS?
the database management system is software for storing and retrieving users' data while considering appropriate security measures.
it consists of a group of programs that manipulate the data.
the DBMS accepts the request for data from an application and instructs the operating system to provide the specific data.
in large systems, DBMS helps users and third-party software to store and retrieve data.
DBMS allows users to create their own databases as per their requirements. it provides an interface between data and the software application.
Characteristics of DBMS
Real World Entity
Relational database
Structured Query Language
Isolation of data and application
ACID properties.
Multiuser and concurrent access.
Translational processing
Less Redundancy and consistency.
Data security and integrity.
Application of DBMS
Banking
Airlines
Universities
Telecommunication
Finance
sales
manufacturing
HR management
Database Architecture in DBMS
1-Tier Architecture
1 tier architecture in DBMS is the simplest architecture of a database in which the client, server and database all reside in the same machine. A simple one-tier Architecture example would be anytime you install a database in your system and access it you practice SQL queries. but such architecture is rarely used in production.
2-Tier Architecture
A 2-Tier Architecture in DBMS is database architecture where the where presentation layer runs on the client ( pc, mobile, tab etc.) and data is stored on a server called the second tier. two-tier architecture provides additional security to DBMS as it is not exposed to the end user directly. it also provides direct and faster communication.
3-Tier Architecture
A 3 Tier Architecture in DBMS is the most popular client-server architecture in DBMS in which the development and maintenance of functional processes, logic, data access, data storage, and the user interface are done independently as separate modules. Three Tier architecture contains a presentation layer, an application layer, and a database server.
Schema
A database schema defines its entities and relationships among them. it contains a descriptive detail database which can be depicted using a schema diagram. It's the database dsignineres who design the schema to help the programmers understand the database and make it make more useful.
A database schema can be divided broadly into 2 categories
- Physical database schema - this schema pertains to the actual storage of data and its forms of storage like files and indices etc. it defines how the data will be stored in secondary storage.
logical database schema - This schema defines all the logical constraints that need to be applied to the data stored. it defines tables, views and integrity constraints.
E-R model
E-R model stands for entity-relationship model. it is a high-level data model.
This model is used to define the data elements and relationships for specified systems.
it develops the conceptual design for the database. it also develops a very simple and easy view of data.
in E-R modeling the database structured is portrayed as a diagram called Entity- Relationship Diagram.
Entity:
An entity may be any object, class, person or people or place.
In the ER diagram, an entity can be represented as a rectangle
Consider an organization as an example- manager, product and employee
department etc. can be taken as entities.
Weak Entity:
An entity that depends on another entity is called a weak entity. the weak entity doesn't contain any key attribute of its own. The weak entity is represented by a double rectangle.
Attribute:
The attribute is used to describe the property of an entity. Eclipse is used to represent an attribute.
For example, id, age, contact number, name, etc. can be attributes of a student.
Key Attribute
The key attribute is used to represent the main characteristics of an entity. It represents a primary key. The key attribute is represented by an ellipse with the text underlined.
b. Composite Attribute
An attribute that composed of many other attributes is known as a composite attribute. The composite attribute is represented by an ellipse, and those ellipses are connected with an ellipse.
c. Multivalued Attribute
An attribute can have more than one value. These attributes are known as a multivalued attribute. The double oval is used to represent multivalued attribute.
For example, a student can have more than one phone number.
d. Derived Attribute
An attribute that can be derived from other attribute is known as a derived attribute. It can be represented by a dashed ellipse.
For example, A person's age changes over time and can be derived from another attribute like Date of birth.
Relationship
A relationship is used to describe the relation between entities. Diamond or rhombus is used to represent the relationship.
Types of relationship are as follows:
a. One-to-One Relationship
When only one instance of an entity is associated with the relationship, then it is known as one to one relationship.
For example, A female can marry to one male, and a male can marry to one female.
b. One-to-many relationship
When only one instance of the entity on the left, and more than one instance of an entity on the right associates with the relationship then this is known as a one-to-many relationship.
For example, Scientist can invent many inventions, but the invention is done by the only specific scientist.
c. Many-to-one relationship
When more than one instance of the entity on the left, and only one instance of an entity on the right associates with the relationship then it is known as a many-to-one relationship.
For example, Student enrolls for only one course, but a course can have many students.
d. Many-to-many relationship
When more than one instance of the entity on the left, and more than one instance of an entity on the right associates with the relationship then it is known as a many-to-many relationship.
For example, Employee can assign by many projects and project can have many employees.