[go: up one dir, main page]

0% found this document useful (0 votes)
9 views8 pages

Dbms Notes 2

A Data Model organizes and represents data in a database, detailing how data is stored, connected, and accessed. There are various types of data models, including Relational, Entity-Relationship, Object-Based, and Semi-Structured models, each suited for different applications. Database Languages, such as DDL, DML, DCL, and TCL, are used to create, manipulate, control, and manage transactions in databases.

Uploaded by

Siddharth
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views8 pages

Dbms Notes 2

A Data Model organizes and represents data in a database, detailing how data is stored, connected, and accessed. There are various types of data models, including Relational, Entity-Relationship, Object-Based, and Semi-Structured models, each suited for different applications. Database Languages, such as DDL, DML, DCL, and TCL, are used to create, manipulate, control, and manage transactions in databases.

Uploaded by

Siddharth
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

🧠 What is a Data Model?

A Data Model is a way to organize and represent data in a database.


It tells how data is stored, how it is connected, and how we can
access it.

Think of it like a map or design that shows how data looks and how it
relates to other data.

🔷 Types of Data Models (with Examples)

1️⃣ Relational Data Model

📌 What it is:

 Data is stored in tables (also called relations).

 Each table has rows (records) and columns (fields).

 Different tables can be linked using keys.

🎓 Real-Life Example (College Database):

Table: Student

StudentID Name Age

101 Alice 18

102 Rahul 19

Table: Course

CourseID CourseName

CSE101 DBMS

CSE102 Python

Table: Enrollment

StudentID CourseID

101 CSE101

102 CSE102

🧩 These tables are connected using StudentID and CourseID.

📍 Where it is used:

 MySQL
 Oracle

 PostgreSQL

 Microsoft SQL Server

✅ Why it's popular:

 Simple and easy to understand

 Powerful for storing structured data

 Most commonly used model in real-world applications

2️⃣ Entity-Relationship (ER) Model

📌 What it is:

 Used for designing a database before creating it.

 Uses:

o Entities (objects like Student, Course)

o Attributes (properties like name, age)

o Relationships (like Enrolls, Owns)

🎓 Real-Life Example:

Entities:

 Student

 Course

Relationship:

 Student ENROLLS in Course

ER Diagram:

student enroll course


s
📍 Where it is used:

 While planning or designing a database.

 Used by database designers and developers.

✅ Why it's useful:


 Easy to understand relationships

 Helps in converting real-world data into a database structure

3️⃣ Object-Based Data Model

📌 What it is:

 Stores data as objects, like in object-oriented programming.

 Each object has attributes (data) and methods (functions).

🎓 Real-Life Example:

In a Library System, a Book object may have:

Book {

Title: "DBMS Simplified"

Author: "John Smith"

Price: 350

Method: displayBookDetails()

Each Book is treated like a real-world object with both data and actions.

📍 Where it is used:

 CAD/CAM systems (Computer-Aided Design)

 Multimedia applications (images, videos)

 Object-oriented databases like db4o, ObjectDB

✅ Why it’s used:

 Great for storing complex data

 Works well with object-oriented programming languages like Java or


C++

4️⃣ Semi-Structured Data Model


📌 What it is:

 Data doesn’t follow a strict table format.

 Uses tags or key-value pairs (like XML or JSON).

 Useful when data format can vary from record to record.

🎓 Real-Life Example (JSON Data):

"name": "Alice",

"age": 18,

"subjects": ["Math", "Science"]

Here:

 No fixed format

 Easy to send data on the web (used in APIs)

📍 Where it is used:

 Web applications

 NoSQL databases (like MongoDB, CouchDB)

 REST APIs (used by websites and mobile apps)

✅ Why it’s used:

 Flexible structure

 Easy to store data from real-world documents, web forms, etc.

📊 Summary Table

Data Model Description Real-Life Use Used In


Example

Relational Data in tables with Student MySQL, Oracle,


Model rows & columns database in a SQL Server
college

ER Model Visual design of Designing a During database


entities & hospital planning
relationships database

Object- Data stored as Storing 3D CAD systems,


Based objects (with models in design multimedia DBs
Model methods) software

Semi- Flexible format Online shopping MongoDB, Web


Structured using XML/JSON cart data APIs, NoSQL DBs
Model

✅ Final Thoughts

 A data model is like a blueprint of how your data looks and works.

 Different models are used based on the type of data and


application.

 The relational model is most common, but others are growing fast
(like JSON in web apps).

🧠 What is a Database Language?

A Database Language is a set of commands used to create, store,


modify, and retrieve data in a database.

Just like we use English or Hindi to talk to people, we use database


languages to talk to databases.
✅ Types of Database Languages

There are four main types of database languages:

🔹 1. Data Definition Language (DDL)

📌 What it does:

 Used to define or create the structure of a database.

 We can create, modify, and delete tables and schemas.

✏️Examples:

 CREATE – to create a table

 ALTER – to change structure (like add a column)

 DROP – to delete a table

 TRUNCATE – to delete all data in a table

🔹 2. Data Manipulation Language (DML)

📌 What it does:

 Used to insert, update, delete, or retrieve data from tables.

✏️Examples:

 INSERT – to add new data

 UPDATE – to modify existing data

 DELETE – to remove data

 SELECT – to get data from table

🔹 3. Data Control Language (DCL)

📌 What it does:

 Used to control access to data in the database.

 Mainly used for security.

✏️Examples:

 GRANT – give permission

 REVOKE – remove permission


🔹 4. Transaction Control Language (TCL)

📌 What it does:

 Used to manage transactions (group of operations done


together).

 Helps in saving or cancelling changes made to data.

✏️Examples:

 COMMIT – save changes permanently

 ROLLBACK – undo changes

 SAVEPOINT – mark a point to rollback to

✏️Examples:

 COMMIT – save changes permanently

 ROLLBACK – undo changes

 SAVEPOINT – mark a point to rollback to

Think of TCL as an undo/redo button for your database changes.

📋 Summary Table
Language Purpose Common Commands
Type

DDL Defines structure of CREATE, ALTER, DROP,


tables TRUNCATE

DML Works with data inside INSERT, UPDATE, DELETE,


tables SELECT

DCL Controls GRANT, REVOKE


access/permissions
TCL Manages transactions COMMIT, ROLLBACK,
SAVEPOINT

🎓 Real-Life Analogy
Activity Database
Language Used

Designing the form or table – what fields DDL


are needed (name, age)

Filling or changing data in that form DML

Giving permission to someone else to view DCL


or edit the form

Saving or canceling all the changes TCL

You might also like