Lesson
14 of 26
Translate

DBMS & SQL Fundamentals

Database concepts, types (Relational, Hierarchical, Network), SQL commands (SELECT, INSERT, UPDATE, DELETE), keys, and normalization for UPSSSC AGTA.

What is a Database?

A database is an organized collection of structured data stored electronically. Think of it as a digital filing cabinet where information is arranged systematically for easy access, retrieval, and management.

Examples of databases in daily life:

  • Bank records (account numbers, balances, transactions)
  • Aadhaar database (biometric data of all Indians)
  • PM-KISAN beneficiary list (farmer details, payment records)
  • School records (student names, marks, attendance)

What is DBMS?

A DBMS (Database Management System) is software that manages databases — it allows users to create, read, update, and delete data while maintaining security and integrity.

Popular DBMS Software:

DBMSDeveloperType
MySQLOracle (open source)Relational
MS AccessMicrosoftRelational
OracleOracle CorporationRelational
PostgreSQLCommunity (open source)Relational
MongoDBMongoDB Inc.Non-relational (NoSQL)
SQL ServerMicrosoftRelational

Types of Database Models

ModelStructureExample
Relational (RDBMS)Data in tables with rows and columnsMySQL, Oracle, Access
HierarchicalTree-like structure (parent-child)IBM IMS
NetworkComplex web of relationshipsIDMS
Object-OrientedData as objects (like programming)db4o
NoSQLFlexible, non-tabular (document, key-value)MongoDB, Cassandra

RDBMS (Relational DBMS) is the most widely used type. Data is stored in tables with defined relationships between them.


Database by Location

TypeDescription
CentralizedAll data on one computer/server
DistributedData spread across multiple locations/servers
CloudData stored on remote cloud servers (AWS, Azure, Google Cloud)

Relational Database Concepts

Tables, Records, and Fields

TermMeaningAlso Called
TableCollection of related data in rows/columnsRelation
RecordOne row — a complete entryTuple
FieldOne column — a single attributeAttribute
CellIntersection of one row and one columnValue

Example — Farmer Database:

FarmerIDNameVillageCropArea (Hectare)
101Ram SinghSultanpurWheat2.5
102Geeta DeviFaizabadRice1.8
103Anil KumarVaranasiSugarcane3.2

Here: FarmerID, Name, Village, Crop, Area are fields. Each row is a record. The whole thing is a table.

erDiagram
FARMER ||--o{ CROP_RECORD : grows
FARMER {
int FarmerID PK
string Name
string Village
string AadhaarNo
}
CROP_RECORD {
int RecordID PK
int FarmerID FK
string Crop
float Area_Hectare
string Season
}
CROP_RECORD }o--|| CROP_MASTER : references
CROP_MASTER {
int CropID PK
string CropName
string CropType
float MSP
}
ER Diagram — Farmer Database Relationships

DBMS Architecture — Three Levels of Abstraction

flowchart TD
A["👤 External Level (View)<br/>What users see — customized per user/app"]
B["📐 Conceptual Level (Logical)<br/>Full structure — tables, relationships, constraints"]
C["💽 Internal Level (Physical)<br/>How data is stored on disk — files, indexes, blocks"]
A --> B --> C
Three-Level DBMS Architecture (Data Abstraction)

A DBMS organizes data access through three levels, each providing a different view of the data:

LevelWho Uses ItWhat They See
External Level (View)End users / ApplicationsOnly the data relevant to them (e.g., a farmer sees only their own records)
Conceptual Level (Logical)Database designers / DBAsThe full logical structure — all tables, relationships, constraints
Internal Level (Physical)System / Storage engineHow data is physically stored on disk — files, indexes, blocks

This separation is called data abstraction — it hides complexity from users while giving full control to administrators.

Key DBMS Components

ComponentRole
Query ProcessorTranslates user queries (SQL) into low-level instructions the database can execute
Transaction ManagerEnsures all operations complete fully or not at all (ACID properties)
Storage ManagerHandles reading/writing data to physical storage devices
Data DictionaryA system catalog that stores metadata — definitions of all tables, fields, types, constraints
Report WriterExtracts data and presents it in formatted reports

What is Metadata?

Metadata is “data about data” — it describes the structure, type, and rules of the actual data stored.

Metadata TypeExample
DescriptiveTable name = “Farmers”, Column name = “Crop”
StructuralFarmerID is INTEGER, Name is VARCHAR(50)
AdministrativeCreated on 28/03/2026, Last modified by Admin

Keys in Databases

Key TypePurposeExample
Primary KeyUniquely identifies each record — no duplicates, no nullsFarmerID (101, 102, 103)
Foreign KeyLinks to primary key of another table — creates relationshipsCropID in Farmer table → references Crop table
Candidate KeyAny field that could be a primary keyFarmerID, Aadhaar Number
Composite KeyPrimary key made of two or more fields combined(StudentID + SubjectID)
Unique KeyLike primary key but allows one NULL valueEmail address

SQL — Structured Query Language

SQL (Structured Query Language) is the standard language for communicating with relational databases. It allows you to create, read, update, and delete data.

flowchart TD
SQL["SQL Commands"]
SQL --> DDL["DDL<br/>(Define Structure)"]
SQL --> DML["DML<br/>(Modify Data)"]
SQL --> DQL["DQL<br/>(Query Data)"]
SQL --> DCL["DCL<br/>(Permissions)"]
SQL --> TCL["TCL<br/>(Transactions)"]
DDL --> D1["CREATE / ALTER<br/>DROP / TRUNCATE"]
DML --> D2["INSERT / UPDATE<br/>DELETE"]
DQL --> D3["SELECT"]
DCL --> D4["GRANT / REVOKE"]
TCL --> D5["COMMIT / ROLLBACK"]
SQL Command Categories

SQL Command Categories

CategoryFull FormPurposeCommands
DDLData Definition LanguageDefine/modify table structureCREATE, ALTER, DROP, TRUNCATE
DMLData Manipulation LanguageAdd/modify/delete dataINSERT, UPDATE, DELETE
DQLData Query LanguageRetrieve dataSELECT
DCLData Control LanguagePermissionsGRANT, REVOKE
TCLTransaction Control LanguageTransaction managementCOMMIT, ROLLBACK

Essential SQL Commands

CREATE TABLE — Creates a new table

CREATE TABLE Farmers (FarmerID INT PRIMARY KEY, Name VARCHAR(50), Crop VARCHAR(30));

INSERT INTO — Adds a new record

INSERT INTO Farmers VALUES (101, 'Ram Singh', 'Wheat');

SELECT — Retrieves data

SELECT * FROM Farmers;                    -- All records
SELECT Name, Crop FROM Farmers;           -- Specific columns
SELECT * FROM Farmers WHERE Crop='Wheat'; -- With condition

UPDATE — Modifies existing data

UPDATE Farmers SET Crop='Rice' WHERE FarmerID=101;

DELETE — Removes records

DELETE FROM Farmers WHERE FarmerID=103;

DROP TABLE — Deletes entire table

DROP TABLE Farmers;

Decision Support Systems (DSS)

A Decision Support System is a computer-based information system that helps managers and decision-makers analyze complex data and make better-informed decisions. Unlike simple databases that just store data, a DSS actively helps you interpret and act on that data.

Types of Decisions

Decision TypeClarityExampleDSS Role
StructuredClear rules existCalculating farmer subsidy based on land sizeAutomate using checklists and formulas
Semi-StructuredSome rules, some judgmentDeciding which crop to recommend for a regionProvide data analysis + human judgment
UnstructuredNo clear rulesSetting long-term agriculture policy for a stateProvide trends and scenarios for human decision

Most real-world DSS tools focus on semi-structured decisions — where data helps but human expertise is still needed.

flowchart LR
A[("📊 Database<br/>(Raw Data)")] --> D["🧠 Model Base<br/>(Analysis & Forecasting)"]
B[("📚 Knowledge Base<br/>(Rules & Expertise)")] --> D
D --> E["🖥️ User Interface<br/>(Dashboard & Reports)"]
E --> F["👤 Decision Maker"]
Decision Support System — Components

Components of DSS

ComponentWhat it Does
DatabaseStores raw data — farmer records, weather history, market prices
Model BaseMathematical and statistical models that analyze the data — forecasting, optimization, simulation
User InterfaceDashboard, charts, reports — how the decision-maker interacts with the system
Knowledge BaseRules and expertise stored in the system (optional, used in advanced DSS)

DSS Limitations

  • Data quality — Poor or incomplete data leads to poor decisions (GIGO applies here too)
  • Over-reliance — Users may blindly trust DSS output without applying judgment
  • Complexity — Advanced models may be difficult for non-technical users to interpret
  • Cost — Building and maintaining a DSS requires investment in software, data, and training
  • Inappropriate analysis — DSS may run statistical tests on data even when they are not suitable

DSS in Agriculture

ApplicationHow DSS Helps
Crop selectionAnalyzes soil type, weather forecast, market prices to recommend the best crop
Irrigation schedulingCombines soil moisture data + weather prediction to decide when and how much to irrigate
Pest managementPredicts pest outbreaks based on temperature, humidity, and historical patterns
Market intelligenceTracks mandi prices across regions to suggest the best time and place to sell
Fertilizer planningRecommends fertilizer type and quantity based on soil health card data
Disaster responseAnalyzes weather alerts and crop insurance data to trigger early warnings

Key Takeaways

  • Database is organized data; DBMS is software to manage it
  • RDBMS (Relational) is most common — data in tables with relationships
  • Three levels of abstraction: External (user view), Conceptual (logical), Internal (physical)
  • Data Dictionary stores metadata (data about data) — table names, field types, constraints
  • Primary Key uniquely identifies records; Foreign Key links tables
  • SQL categories: DDL (structure), DML (data), DQL (queries), DCL (permissions)
  • SELECT retrieves data, INSERT adds, UPDATE modifies, DELETE removes
  • DSS helps with semi-structured decisions — components: Database + Model Base + User Interface
  • DSS limitations: data quality, over-reliance, cost, inappropriate analysis

Summary Cheat Sheet

ConceptKey Details
DatabaseOrganized collection of structured data
DBMSSoftware to manage databases — MySQL, Oracle, Access
RDBMSRelational — data in tables, most widely used
TableRows (records/tuples) × Columns (fields/attributes)
Primary KeyUnique identifier — no duplicates, no nulls
Foreign KeyLinks to primary key of another table
SQLStructured Query Language — standard for RDBMS
DDLCREATE, ALTER, DROP — table structure
DMLINSERT, UPDATE, DELETE — data manipulation
DQLSELECT — data retrieval
SELECTRetrieves data: SELECT * FROM table WHERE condition
INSERTAdds record: INSERT INTO table VALUES (…)
UPDATEModifies: UPDATE table SET field=value WHERE condition
DELETERemoves: DELETE FROM table WHERE condition
3 LevelsExternal (user view), Conceptual (logical), Internal (physical)
Data DictionarySystem catalog — stores metadata (table definitions, field types)
MetadataData about data — Descriptive, Structural, Administrative
Query ProcessorConverts SQL queries into low-level instructions
DSSDecision Support System — helps analyze data for decisions
Structured DecisionClear rules exist — can be automated
Semi-StructuredSome rules + human judgment — main DSS focus
UnstructuredNo clear rules — requires expertise and experience
DSS ComponentsDatabase + Model Base + User Interface + Knowledge Base
DSS in AgricultureCrop selection, irrigation, pest management, market prices
DSS LimitationPoor data quality, over-reliance, cost, inappropriate analysis

Knowledge Check

Take a dynamically generated quiz based on the material you just read to test your understanding and get personalized feedback.

Lesson Doubts

Ask questions, get expert answers

Lesson Doubts is a Pro feature.Upgrade