Skip to content
Skip to page content
soylai.com

Database Management System — Notes

8 sections 9 min readBeta

1. Data, information, database and DBMS

Data are raw facts as recorded: the number, date, customer and amount of an invoice. Information is data processed (sorted, filtered, totalled, related) into a form that supports a decision: dues by customer, sales by city.

A database is an organised collection of related data stored together. A database management system (DBMS) is the software that defines the database, stores and retrieves records, enforces rules on them, lets many users share them and protects them. Accounting software is built on a DBMS: vouchers are stored once and ledgers, trial balance and statements are drawn from them.

Terms. A relational database stores data in tables (relations); each column is a field (attribute) with a data type; each row is a record (tuple). A field left empty holds NULL.

Table of basic terms: data, information, database, database management system, table, field, record and null
TermMeaning
DataRaw, unprocessed facts (an invoice amount, a date, a code)
InformationData processed into a meaningful form that supports a decision
DatabaseAn organised collection of related data, stored together
DBMSSoftware to define, store, retrieve, check, share and protect a database
Table (relation)Data about one kind of thing, in rows and columns
Field (attribute)A column: one item of data about each record, with a data type
Record (tuple)A row: all the data about one thing (one customer, one invoice)
NULLNo value entered in a field
A DBMS turns stored data into information.
Imagined data. 5 fields (columns) × 6 records (rows); NULL = no agent.
CustCodeCustNameCityCreditLimitAgent
C01Anupam AnnapurtiSehore100000Anshul
C02Sanchi ProvisionsVidisha80000NULL
C03Saptarshi TradersBegamganj120000Ruchika
C04Nirmay StoresSironj60000Anshul
C05Gaurang MartVidisha80000NULL
C06Aarohi FoodsGanjbasoda90000Ruchika

Key terms

Data

Raw, unprocessed facts.

Information

Processed, meaningful data that supports a decision.

DBMS

Software that defines, stores, retrieves, checks, shares and protects a database.

2. Types of DBMS

  • Hierarchical: records form a tree; each child record has exactly one parent (region → depot → retailer). Fast top-down access; a record needing two parents must be repeated, and changes to the structure are hard.
  • Network: records form a graph linked by pointers; a record may have several owners (a consignment owned by a customer and a truck). Flexible but complex.
  • Relational: data is kept in tables linked by common key fields (CustCode in Customers and in Invoices). Simple to understand, flexible queries in SQL; the model used by most accounting software.
  • Object-oriented: data is stored as objects that carry both their data and the operations on it; suits complex data such as designs and media.
Table of the four types of database management system: hierarchical tree, network graph, relational tables and object-oriented objects, with an example and a strength or weakness of each
TypeStructureExample at MonalStrength / weakness
HierarchicalTree; each child has one parentRegion → depot → retailerFast top-down look-ups; a record with two parents must be repeated
NetworkGraph; a record may have several owners (pointers)A consignment linked to both its customer and its truckFlexible; complex to design and change
RelationalTables linked by common key fieldsCustomers, Invoices, Receipts linked by CustCodeSimple, flexible queries; the usual choice for accounting software
Object-orientedObjects holding data and the operations on itA Product object with its own pricing rulesSuits complex data such as drawings or media
Imagined structures for Monal Agro Foods.

Key terms

Hierarchical DBMS

Tree structure: one parent per record.

Network DBMS

Graph structure: a record may have several owners.

Relational DBMS

Tables linked through key fields.

3. Features and advantages (and limitations)

Features and advantages:

  1. Controlled redundancy and consistency: each fact stored once.
  2. Integrity: rules on keys, data types and links stop wrong entries.
  3. Data independence: programs do not change when storage changes.
  4. Sharing and concurrency control: many users at once, with record locking.
  5. Security: passwords, user rights, audit trail.
  6. Backup and recovery from a failure using backups and a transaction log.
  7. Query language and reports: information on demand.

Limitations: cost of software, hardware and training; complexity; dependence on one system, which must itself be secured and backed up.

Limitations: cost of software and training, complexity, and dependence on one system that must be protected.
FeatureWhat it means at Monal
Controlled redundancy and consistencyA retailer’s name and city are stored once, in Customers; invoices carry only the code
Integrity rulesNo duplicate or blank invoice number; no invoice for a customer who does not exist
Data independenceReports keep working when the storage is moved or reorganised
Sharing and concurrency controlSeveral clerks enter invoices and receipts at the same time without clashes
SecurityPasswords and user rights: a clerk may enter receipts but not delete customers
Backup and recoveryRegular copies and a transaction log restore the books after a failure
Query language and reportsQuestions such as total dues by city are answered in seconds

Key terms

Data redundancy

The same data stored in more than one place.

Data integrity

Accuracy and consistency of data, protected by rules.

Data independence

Programs unaffected by changes in how data is stored.

4. Tables, data types and keys

Designing a table: name it after the thing it records; list its fields; give each a data type (text, number, currency, date, Yes/No); choose a primary key.

Keys:

  • Primary key: a field whose value is unique and never blank in every record (CustCode, InvNo, AssetNo).
  • Candidate key: any field that could be the primary key.
  • Composite key: two or more fields unique only together (BoatCode + TripDate).
  • Foreign key: a field that refers to the primary key of another table (CustCode in Invoices). It may repeat but must match an existing record.

Integrity rules the DBMS enforces (see the table): it refuses a duplicate or blank primary key, a foreign key with no matching parent, a value of the wrong type, and the deletion of a parent record still referred to.

Table of keys: the primary key is unique and never blank, a candidate key could be the primary key, a composite key is unique only as a combination, and a foreign key refers to the primary key of another table
KeyMeaningMonal example
Primary keyField (or fields) whose value is unique and never blank in every recordCustCode in Customers; InvNo in Invoices
Candidate keyAny field that could serve as the primary keyInvNo; a GST number, if every customer had one
Composite keyTwo or more fields that are unique only togetherBoatCode + TripDate in a trips table
Foreign keyField that refers to the primary key of another tableCustCode in Invoices and in Receipts
Table of data types: text for names and codes, number for quantities, currency for money, date for dates and yes or no for two-way answers
Data typeUse forExample field
TextNames, codes, addresses (labels, not quantities)CustCode, CustName
NumberCounts and quantitiesQuintals, Bags
CurrencyMoney amountsAmount, CreditLimit
DateDates (sort and compare correctly)InvDate, PurchaseDate
Yes/NoTwo-way answersPaid, InUse
Table of the integrity rules a database enforces: unique and non-blank primary keys, matching foreign keys, correct data types, and no deletion of a parent record still referred to
RuleChecked whenRefusal
Primary key uniqueA record is added or its key changedDuplicate primary key
Primary key not blankA record is addedPrimary key left blank
Foreign key matchesA child record is addedNo matching record in the parent table
Data typeA value is enteredWrong data type
Parent still referred toA parent record is deletedRefused while child records refer to it
Verdicts produced by the chapter’s database engine.
Proposed changeDBMS verdict
Invoice 511, 2 May 2026, customer C07, ₹26,000Rejected: no matching record in Customers (foreign key)
Customer C03, Udaygiri Traders, VidishaRejected: duplicate primary key
Invoice with no number, customer C02, ₹9,000Rejected: primary key left blank
Invoice 511, 2 May 2026, customer C04, ₹26,000Accepted
Delete customer C04 (invoice 506 is still on file)Refused: 1 record(s) in Invoices refer to C04

Key terms

Primary key

Unique, never blank; identifies each record.

Foreign key

Refers to the primary key of another table.

Composite key

Several fields that are unique only together.

5. Relationships, forms, reports and indexing

Relationships: one-to-one (an employee and one salary account), one-to-many (a customer and its invoices: the primary key of the one side goes into the many side as a foreign key), many-to-many (invoices and products: a linking table holds both keys).

Database objects:

  • Form: screen for entering, viewing and editing one record at a time, with checks and drop-down lists.
  • Query: a question asked of the data (in SQL).
  • Report: formatted output of many records, grouped and sorted with subtotals and totals, for printing; may combine related tables (sales by city: invoices linked to customers).
  • Index: a sorted list of a field’s values with pointers to records; speeds up searching and sorting, costs space and slows saving a little.
Table of the three relationship types with an accounting example and how each is built with keys
RelationshipMeaningAccounting exampleHow it is built
One-to-oneEach record matches at most one record on the other sideAn employee and his single salary bank accountSame key in both tables, or a unique foreign key
One-to-manyOne record matches many on the other sideA customer and his invoicesPrimary key of the "one" side placed as a foreign key on the "many" side
Many-to-manyMany records match manyInvoices and the products on themA third (linking) table holding both keys
Primary key (PK) on the one side, foreign key (FK) on the many side.
Table of database objects: tables store records, forms are entry screens, queries ask questions, reports present grouped totals and indexes speed up searching
ObjectPurposeMonal example
TableStores the recordsCustomers, Invoices, Receipts
FormScreen to enter, view and edit one record at a time, with checks and drop-down listsInvoice entry screen with a list of customer codes
QueryQuestion asked of the dataInvoices above ₹40,000 in April
ReportFormatted, grouped output with totals, for printing or sharingSales by city with a grand total
IndexSorted list of a field’s values with pointers to the recordsIndex on CustCode in Invoices
An index speeds up search and sort; it costs space and must be updated on every new invoice.
CustCode (sorted)Points to invoices
C01501, 504
C02502, 507
C03503, 510
C04506
C05505, 509
C06508
Join Invoices to Customers on CustCode, group by City, total Amount.
CitySales (₹)
Sehore78,000
Vidisha2,16,000
Begamganj79,000
Sironj22,000
Ganjbasoda18,000
Total4,13,000

Key terms

One-to-many

One record on one side matches many on the other.

Report

Formatted, grouped output with totals.

Index

Sorted list of a field’s values pointing to the records.

6. SQL basics: SELECT, WHERE, AND, OR, UPDATE, DELETE

  • SELECT field1, field2 FROM table WHERE condition; shows the chosen fields of the records that meet the condition; SELECT * shows all fields. SELECT never changes data.
  • AND: both conditions true (narrows). OR: at least one true (widens). AND is applied before OR; use brackets to change the order.
  • UPDATE table SET field = value WHERE condition; changes values; the new value may use the old one (CreditLimit = CreditLimit + 20000).
  • DELETE FROM table WHERE condition; removes records; the table design remains.
  • Without WHERE, UPDATE and DELETE act on every record. Run the same WHERE with SELECT first.

Text and dates are written in single quotes ('Vidisha', '2026-04-15'); numbers are not. Dates written year-month-day compare correctly.

Text and dates go in single quotes; numbers do not. A statement ends with a semicolon.
Statement / clauseWhat it doesForm
SELECT … FROMShows chosen fields (or * for all) of a tableSELECT InvNo, Amount FROM Invoices;
WHEREKeeps only the records that meet a conditionWHERE Amount > 40000
ComparisonEqual, not equal, less, greater, at most, at least= <> < > <= >=
ANDBoth conditions must be trueCity = 'Vidisha' AND Amount > 40000
ORAt least one condition must be trueCustCode = 'C02' OR CustCode = 'C05'
UPDATE … SET … WHEREChanges values in the records that meet the conditionUPDATE Customers SET CreditLimit = 90000 WHERE CustCode = 'C04';
DELETE FROM … WHERERemoves the records that meet the conditionDELETE FROM Invoices WHERE InvNo = 506;
A comparison with a NULL value is never true, so use IS NULL to find blanks.
OperatorMeaningExample
=Equal toCity = 'Vidisha'
<>Not equal toMode <> 'Cash'
< >Less than, greater thanAmount > 40000
<= >=At most, at leastInvDate >= '2026-04-15'
IS NULLNo value enteredAgent IS NULL
`SELECT InvNo, CustCode, Amount FROM Invoices WHERE Amount > 40000;` — 5 rows.
InvNoCustCodeAmount
501C0148000
503C0352000
505C0575000
507C0241000
509C0564000
Two queries on Monal's invoices: with and, invoices above forty thousand rupees from fifteen April give five hundred five, five hundred seven and five hundred nine; with or, invoices of customers C zero two or C zero five give five hundred two, five hundred five, five hundred seven and five hundred nine
QueryInvoices returnedRows
SELECT InvNo FROM Invoices WHERE Amount > 40000 AND InvDate >= '2026-04-15';505, 507, 5093
SELECT InvNo FROM Invoices WHERE CustCode = 'C02' OR CustCode = 'C05';502, 505, 507, 5094
AND is applied before OR; use brackets to change the order.
QueryRead asReturns
SELECT InvNo FROM Invoices WHERE CustCode = 'C01' OR CustCode = 'C03' AND Amount > 30000;C01, OR (C03 AND over 30000)501, 503, 504
SELECT InvNo FROM Invoices WHERE (CustCode = 'C01' OR CustCode = 'C03') AND Amount > 30000;(C01 OR C03) AND over 30000501, 503
Run on a copy; the deck’s other examples use the original tables.
Statement (run in order)Result
UPDATE Customers SET CreditLimit = CreditLimit + 20000 WHERE City = 'Vidisha';2 records changed (C02 now ₹1,00,000, C05 now ₹1,00,000)
DELETE FROM Customers WHERE CustCode = 'C04';Refused: 1 record(s) in Invoices refer to C04
DELETE FROM Invoices WHERE InvNo = 506;1 record deleted
DELETE FROM Customers WHERE CustCode = 'C04';1 record deleted

Key terms

WHERE clause

The condition a record must meet.

AND / OR

Both conditions / at least one condition.

UPDATE

Statement that changes stored values.

7. Aggregate functions: COUNT, SUM, AVG, MAX, MIN

Aggregate functions return one value from many records: COUNT(*) (number of records), COUNT(field) (records with a value in that field), SUM(field), AVG(field), MAX(field), MIN(field).

  • WHERE is applied first, then the function: SELECT SUM(Amount) FROM Invoices WHERE CustCode = 'C05'; gives the sales to one customer.
  • NULLs are skipped by every function except COUNT(*); AVG divides by the number of values present.
  • Several functions may be used together: SELECT MAX(Balance), MIN(Balance) FROM Debtors;.

Accounting uses: total sales or dues, number of invoices, average invoice, highest balance, smallest receipt.

Aggregate functions on Monal's invoices: count ten, sum rupees four lakh thirteen thousand, average rupees forty-one thousand three hundred, maximum rupees seventy-five thousand, minimum rupees eighteen thousand, and sum for Gaurang Mart rupees one lakh thirty-nine thousand
QueryGivesResult
SELECT COUNT(*) FROM Invoices;Number of invoices10
SELECT SUM(Amount) FROM Invoices;Total credit sales413000
SELECT AVG(Amount) FROM Invoices;Average invoice41300
SELECT MAX(Amount) FROM Invoices;Largest invoice75000
SELECT MIN(Amount) FROM Invoices;Smallest invoice18000
SELECT SUM(Amount) FROM Invoices WHERE CustCode = 'C05';Sales to Gaurang Mart139000
SUM, AVG, MAX and MIN also skip NULLs.
Query on CustomersResultWhy
SELECT COUNT(*) FROM Customers;6Counts every record
SELECT COUNT(Agent) FROM Customers;4Skips the two NULL agents (C02, C05)

Key terms

Aggregate function

A function that summarises many records into one value.

COUNT(*)

Counts every record, blanks included.

8. DBMS in business: debtors and creditors, bank reconciliation, asset accounting

Accounting information. Each source document is entered once (through a form) into linked tables; ledgers, the trial balance, statements and management reports are drawn from them, so they always agree.

Debtors and creditors. Customers and Suppliers are master tables; invoices, bills, receipts and payments carry the party code as a foreign key. A report gives each balance (opening + invoices − receipts), dues past their date, and parties over their credit limit.

Bank reconciliation. The bank statement is imported as a table and matched with the bank column of the cash book on the reference. Unmatched items are the reconciling items: cheques issued but not presented and bank-only credits are added to the cash book balance; cheques deposited but not credited and bank-only debits are subtracted, giving the pass book balance.

Asset accounting. A fixed asset register table holds each asset’s number, category, date, cost, rate and location; the DBMS computes depreciation and written-down values and totals them by category.

Total due ₹2,27,000 = 4,13,000 − 1,86,000.
CustCodeCustomerInvoicesReceiptsBalanceCredit limitWithin limit?
C01Anupam Annapurti78,00048,00030,0001,00,000Yes
C02Sanchi Provisions77,00036,00041,00080,000Yes
C03Saptarshi Traders79,00052,00027,0001,20,000Yes
C04Nirmay Stores22,000022,00060,000Yes
C05Gaurang Mart1,39,00050,00089,00080,000No (over by 9,000)
C06Aarohi Foods18,000018,00090,000Yes
Each transaction is entered once; every report is drawn from the same tables.
Both started April at ₹1,20,000.
RefIn cash bookIn bank statementStatus
CH20160,00060,000Matched
CH20225,00025,000Matched
DP0148,00048,000Matched
DP0236,00036,000Matched
CH20334,000—Cheque not yet presented
DP0350,00050,000Matched
CH20415,000—Cheque not yet presented
DP0452,000—Deposit not yet credited
INT4—1,500Credited by bank only
CHG4—700Debited by bank only
INS4—4,800Debited by bank only
Bank reconciliation statement of Monal on thirty April: cash book balance rupees one lakh seventy-two thousand, add cheques not presented and interest, less the deposit not credited, charges and premium, gives the pass book balance of rupees one lakh sixty-five thousand
Particulars₹₹
Balance as per cash book (bank column), 30 April 20261,72,000
Add: cheques issued but not yet presented: CH203 34,000; CH204 15,000+49,000
Add: credited by the bank, not yet in the cash book: INT4 1,500+1,500
Less: cheques deposited but not yet credited: DP04 52,000−52,000
Less: debited by the bank, not yet in the cash book: CHG4 700; INS4 4,800−5,500
Balance as per pass book (bank statement), 30 April 20261,65,000
`SELECT SUM(Cost) FROM Assets WHERE Category = 'Machinery';` returns 620000.
AssetNoAssetCategoryCostRate %Depreciation 2026-27WDV 31-3-2027
A01Flour millMachinery2,40,0001024,0001,44,000
A02Pulse graderMachinery2,60,0001026,0001,82,000
A03Office furnitureFurniture50,000105,00025,000
A04Delivery truckVehicle6,00,0001590,0004,20,000
A05WeighbridgeMachinery1,20,0001012,00084,000
A06Billing computerComputer80,0002016,00048,000
Total13,50,0001,73,0009,03,000

Key terms

Asset register

Table of fixed assets with cost, date, rate and depreciation.

Reconciling item

An entry found in only one of the cash book and the bank statement.

Credit limit

The most a customer may owe at a time.

Exam tips

Common mistakes

  • Calling a code field "number" because it holds digits: codes are text.
  • Saying a foreign key must be unique (only the primary key must be).
  • Forgetting that a primary key can never be blank.
  • Mixing AND and OR without brackets, or forgetting that AND comes first.
  • Writing text or dates without quotes, or numbers with them.
  • Using UPDATE or DELETE without WHERE.
  • Counting a NULL in COUNT(field) or dividing AVG by all the rows when some are NULL.
  • In a bank reconciliation, adding a deposit not yet credited instead of subtracting it.

How marks are usually split

  • 1 mark: a term, a key, a function, or the result of one simple query.
  • 2 marks: a distinction (data and information, form and report), or one query with its result.
  • 3 marks: three features or types, three key verdicts, or the outputs of three queries.
  • 5 marks: a design (fields, types, keys and relationship), or queries with outputs, or a debtors report or bank reconciliation from tables.

Figures and firms in SOYL practice are imagined; software is described generically.