Learning Objectives

By the end of this chapter, you will be able to:

  • Build the hierarchy character to database without mixing levels.
  • Pick a primary key and correct data type for each field in a retail or hotel file.
  • Separate data, information, and knowledge with a shop or PMS example.
  • Test a table for accuracy, completeness, consistency, timeliness, relevance, validity.
  • Size a retail or hotel file on 2081 BS with storage and error cost.

Data hierarchy

Facts are stored in layers. Each layer groups the one below.

flowchart BT
  C[Character] --> F[Field]
  F --> R[Record]
  R --> FI[File or Table]
  FI --> D[Database]
Layer What it is Example for a hotel PMS View
Bit and byte 0 or 1, 8 bits is one byte A as 01000001 Physical
Character One letter, digit, symbol S Atom
Field Related characters as one attribute Sita Sharma for GuestName Column
Record Related fields for one entity Row G-1842, Sita Sharma, Room 204, 9841XXXXXX, 2 nights Row
File or table Related records Guests table with 4,200 rows Table
Database Related files managed together Guests plus Bookings plus Bills plus Stock System

Row is record, column is field.

Keys and types

Concept Rule Good pick for retail or hotel Poor pick
Primary key Unique, never empty, never duplicated GuestID, SKU, BillNo Guest name, phone, room number
Data type Declares what the field may hold Phone as text, price as number, check in as date, paid as boolean Text for date, number for phone

Phone is text, not number. You never add phones and must keep leading zero. SKU can be text even when it looks numeric.

GuestID as key Guest name Room Nights Phone as text
G-1842 Sita Sharma 204 2 9841000222
G-1843 Ram Thapa 205 1 9851000333

Same pattern for a mart SKU table or a supplier dispatch file.

Data, information, knowledge

Raw facts become useful only after processing.

flowchart LR
  D[Data: raw] --> I[Information: in context]
  I --> K[Knowledge: guides decision]
Layer Nature Answers Hotel or retail example
Data Raw fact What is recorded 120, 2081-11-10
Information Data in context What happened 120 rooms nights sold this week
Knowledge Pattern plus action What to do Sales up 20 percent after Instagram reels, so add one reel per day during Tihar
Aspect Data Information Knowledge
Meaning Little alone Meaningful Guides choice
Form 85, 72, 91 Average daily rate Rs 6,200 Raise weekend rate by Rs 400, keep weekday
User Recorder Analyst Manager and owner

A manager acts on knowledge built from clean daily posting.

Good data

Good data passes a test. Garbage in remains garbage out.

Characteristic Test Symptom if failed in a shop or lodge
Accurate Matches real world Bill to wrong guest, wrong VAT
Complete No missing required field Bill without GuestID cannot audit
Consistent Same fact equal everywhere Guest phone differs in Front Office and Billing
Timely Up to date when needed Rate change of 2081-10-15 applied on 2081-11-30
Relevant Serves the decision Favourite colour for a purchase order
Valid Format and range correct Future check in date, letters in phone
Unique No duplicate entity One guest with two IDs splits history
Auditable Source and time logged Owner asks who waived charge and there is no log

Check any table with those rows before you trust a dashboard.

Self-check

Nepal worked example: Lakeside lodge file on 2081-11-16 (NPR)

A 28 room lodge in Pokhara holds 4,200 guest rows in its PMS archive. On 2081-11-16 it cleans the file before audit. Each record is 520 bytes.

  • Size = 4,200 times 520 = 2,184,000 bytes, about 2.08 MB. With indexes plus 30 percent about 2.7 MB. Storage is not the issue, error is.
  • Scan finds 68 rows without citizenship or PAN for invoice, 22 duplicate phones, 14 addresses that differ between Guests and Bills, 9 future check in dates. 113 defective rows, 2.7 percent.
  • Cost if dirty: rework 113 times 18 minutes = 33.9 hours at Rs 350 per hour = Rs 11,865 plus reprint and courier Rs 1,800 = Rs 13,665. A control that forces GuestID as primary key, phone as text, and blocks future dates costs Rs 3,500 once.
  • Fix: GuestID as primary key, phone and citizenship as text, validity on check in before or equal to today, unique on phone where appropriate, consistency check on guest address across tables.

Decision: do not buy disk, buy fewer defective rows. Duplicate GuestID splits stay history and loyalty points.

Summary

  • Hierarchy is character to database, on bits and bytes.
  • Primary key identifies the row, type guards the field, phone stays text.
  • Data is raw, information is context, knowledge guides action.
  • Good data is accurate, complete, consistent, timely, valid, unique, auditable.

Next: database vs file system, database models, DBMS.

Key Takeaways

  • Record is row, field is column.
  • Name is no key because names repeat.
  • Size is trivial, error cost is not. Budget validation first.

Discussion Questions

  1. Why must phone and SKU with leading zero be text even when they look numeric.
  2. Give a lodge example where one guest has two phones in two tables. Which characteristic fails.
  3. How does a primary key cut duplicate bill numbers more than a manual check.

Exercises

Short answer

  1. Define field, record, and file with one line example each from a hotel or mart.
  2. Why can guest name not be a primary key. Name two fields that can for a lodge and a mart.
  3. Separate data from information from knowledge with one trio from retail or hospitality.

Long answer

  1. Explain the hierarchy with a table from character to database, using 4,200 guests at 520 bytes each, name keys and types, and explain why phone is text.
  2. Explain data, information, and knowledge and list characteristics of good data with a test each. Use the Pokhara scan on 2081-11-16 with 113 defective rows to compute defect rate and Rs 13,665 rework, and propose constraints that block that class.