Computer Science

Class 12 DBMS Notes (NEB Unit 1): डेटाबेस नेपाली र अंग्रेजीमा

NEB कक्षा १२ कम्प्युटर विज्ञानको Unit 1 — database, DBMS, keys, ER diagram, normalization र SQL, नेपालीमा बुझाइ र परीक्षाका नमुना उत्तर सहित।

By 26 min read

Class 12 NEB Unit 1 DBMS notes in Nepali and English covering database, keys, ER diagram, normalization and SQL
On this page

छोटो उत्तर — Quick answer

Database भनेको सम्बन्धित डेटाको व्यवस्थित सङ्ग्रह हो, र DBMS (Database Management System) भनेको त्यो डेटाबेस बनाउन, डेटा राख्न, खोज्न, बदल्न र सुरक्षित राख्न प्रयोग हुने सफ्टवेयर हो। MySQL, Oracle, MS Access र PostgreSQL सबै DBMS हुन् — डेटाबेस होइनन्।

Exam line: A database is an organised collection of logically related data, and a DBMS is the software that allows users to create, store, retrieve, update and control access to that database.

यो पाना NEB कक्षा १२ कम्प्युटर विज्ञान (Com. 428) को Unit 1: Database Management System को पूरा नोट हो — नेपाली र अंग्रेजी दुवैमा। हरेक अवधारणा पहिले नेपालीमा बुझाइएको छ, त्यसपछि परीक्षामा लेख्नुपर्ने ठ्याक्कै अंग्रेजी वाक्य दिइएको छ।

Unit 1 का तथ्यहरू — key facts

कुराविवरण
विषयComputer Science, Grade 12
विषय संकेत (subject code)Com. 428 (कक्षा ११ को Com. 427; हालका NEB प्रश्नपत्रमा 4281 छापिन्छ)
UnitUnit 1 — Database Management System
शिक्षण घण्टा (teaching hours)12 घण्टा, जम्मा 80 घण्टाको पाठ्यक्रममा
सबैभन्दा ठूलो unitUnit 2 (Data Communication & Networking) — 15 घण्टा
लिखित बोर्ड परीक्षा50 पूर्णाङ्क (75 होइन)
बाह्य मूल्याङ्कन75 = लिखित 50 + प्रयोगात्मक 25
आन्तरिक मूल्याङ्कन25 (कक्षा सहभागिता 3, त्रैमासिक परीक्षा 6, project work 16)
क्रेडिट घण्टा / कार्य घण्टा5 / 160

यति घण्टा र अंकको अर्थ के? Unit 1 लाई 80 मध्ये 12 घण्टा दिइएको छ — अर्थात् पाठ्यक्रमको करिब 15%। लिखित पेपर 50 को हुने हुनाले Unit 1 बाट सामान्यतया 6–8 अंक आउँछ: एउटा छोटो उत्तर र केही वस्तुगत प्रश्न, वा एउटा लामो प्रश्न।

यो नोट कसरी पढ्ने

हरेक शीर्षकमा तीन कुरा छन्:

  1. नेपालीमा व्याख्या — अवधारणा साँच्चै बुझ्नका लागि।
  2. Exam line — परीक्षामा जस्ताको तस्तै लेख्न मिल्ने अंग्रेजी परिभाषा।
  3. उदाहरण वा तालिका — किनभने NEB मा उदाहरण दिए अंक बढ्छ।

सुझाव: उत्तरपुस्तिकामा अंग्रेजीमै लेख्नु। नेपाली यहाँ बुझ्नका लागि मात्र हो। Diagram माग्ने प्रश्नमा diagram नकोरी पूरा अंक आउँदैन — ER diagram र normalization का उदाहरण अभ्यास गर्नु।

यस पानामा के-के छ — Contents

तल NEB पाठ्यक्रमकै क्रममा सबै शीर्षक छन्। परीक्षा नजिक छ भने सीधै नमुना उत्तर, शब्दावली र बारम्बार सोधिने प्रश्न मा जानुहोस्।

डेटा र सूचना — Data and Information

डेटा (Data) के हो?

नेपालीमा: डेटा भनेको कच्चा तथ्य र अंक हो — जसको आफैँमा कुनै अर्थ लाग्दैन। जस्तै 85, राम, पोखरा — यी छुट्टाछुट्टै हेर्दा केही भन्दैनन्।

Exam line: Data are raw, unprocessed facts and figures that have no meaning on their own.

सूचना (Information) के हो?

नेपालीमा: डेटालाई प्रशोधन (process) गरेपछि जुन अर्थपूर्ण नतिजा आउँछ, त्यही सूचना हो। राम को कम्प्युटरमा 85 अंक आयो — अब यसले अर्थ दियो।

Exam line: Information is processed data that has been organised and given context so that it becomes meaningful and useful for decision making.

डेटा र सूचना बीचको भिन्नता

आधारData (डेटा)Information (सूचना)
अर्थकच्चा तथ्य, अर्थ छैनप्रशोधित, अर्थपूर्ण
निर्भरतासूचनामा निर्भर छैनडेटामा निर्भर छ
निर्णयसिधै निर्णय लिन मिल्दैननिर्णय लिन प्रयोग हुन्छ
रूपसंख्या, अक्षर, चिन्हतालिका, रिपोर्ट, ग्राफ
उदाहरण85, 72, 91“कक्षाको औसत अंक 82.67”

डेटाका प्रकार

प्रकारनेपालीमाउदाहरण
Primary dataआफैँले नयाँ सङ्कलन गरेकोसर्वेक्षण, प्रश्नावली, प्रत्यक्ष अवलोकन
Secondary dataअरूले पहिले नै सङ्कलन गरिसकेकोवित्तीय विवरण, जनगणना रिपोर्ट, पुस्तक

डेटा प्रशोधन चक्र — Data Processing Cycle

   INPUT                PROCESSING              OUTPUT
  (डेटा हाल्ने)   →   (छाँट्ने, जोड्ने,   →   (अर्थपूर्ण सूचना)
                       क्रमबद्ध गर्ने,
                       गणना गर्ने)
                            ↓
                        STORAGE
                     (भण्डारण — पछि
                      फेरि प्रयोगका लागि)

Exam line: Data processing is the sequence of operations — input, processing, output and storage — by which raw data is converted into meaningful information.

फाइल प्रणाली र यसका समस्या — The file-based system

DBMS किन चाहियो भन्ने बुझ्न, पहिले यो आउनुअघि के थियो भन्ने बुझ्नुपर्छ।

नेपालीमा: पहिले हरेक विभागले आफ्नै छुट्टाछुट्टै फाइल राख्थ्यो। भर्ना विभागको आफ्नै फाइल, परीक्षा विभागको आफ्नै, पुस्तकालयको आफ्नै। एउटै विद्यार्थीको नाम र ठेगाना तीनै ठाउँमा दोहोरिन्थ्यो। विद्यार्थीले ठेगाना बदल्यो भने तीनै ठाउँमा बदल्नुपर्थ्यो — एक ठाउँ बिर्सियो भने डेटा बाझिन्छ।

  भर्ना विभाग        परीक्षा विभाग        पुस्तकालय
  ┌──────────┐      ┌──────────┐       ┌──────────┐
  │ Roll     │      │ Roll     │       │ Roll     │
  │ Name     │      │ Name     │       │ Name     │   ← एउटै डेटा
  │ Address  │      │ Marks    │       │ Address  │      तीन ठाउँमा!
  └──────────┘      └──────────┘       └──────────┘
   admission.dat     exam.dat           library.dat

फाइल प्रणालीका सीमा — limitations (परीक्षामा सोधिन्छ)

समस्यानेपालीमा के हो
Data redundancyएउटै डेटा धेरै ठाउँमा दोहोरिनु — ठाउँ खेर जान्छ
Data inconsistencyएक ठाउँमा बदल्यो, अर्कोमा बदलेन → डेटा बाझियो
Difficulty in accessing dataनयाँ किसिमको रिपोर्ट चाहियो भने नयाँ program नै लेख्नुपर्ने
Data isolationडेटा छुट्टाछुट्टै फाइल र ढाँचामा छरिएको, जोड्न गाह्रो
Integrity problems“अंक 0 देखि 100 बीचमै हुनुपर्छ” जस्ता नियम program भित्र लेख्नुपर्ने
Atomicity problemकाम बीचैमा बिग्रियो भने आधा मात्र भएर अड्किने
Concurrent access anomaliesधेरै जनाले एकैचोटि लेख्दा डेटा बिग्रिने
Security problemsकुन प्रयोगकर्ताले कुन डेटा हेर्न पाउने भनी छुट्याउन गाह्रो

Exam line: In a file-based system each application maintains its own separate files, which leads to data redundancy, inconsistency, poor security, data isolation and difficulty in accessing data — the problems a DBMS was designed to solve.

फाइल प्रणाली र डेटाबेस प्रणालीको तुलना

आधारFile-based systemDatabase system
डेटा भण्डारणछुट्टाछुट्टै फाइलमाएउटै केन्द्रीय डेटाबेसमा
Redundancyधेरैनियन्त्रित, न्यून
Consistencyकमबढी
Data independenceछैनछ
Sharingगाह्रोसजिलो
Securityकमजोरबलियो, प्रयोगकर्ता अनुसार
Backup/recoveryहातैलेस्वचालित
Queryनयाँ program लेख्नुपर्नेSQL ले तुरुन्तै
लागतसस्तोमहँगो

डेटाबेस, DBMS र डेटाबेस प्रणाली

यी तीन शब्द फरक हुन् — परीक्षामा यही भिन्नता सोधिन्छ।

शब्दअर्थउदाहरण
Databaseसम्बन्धित डेटाको व्यवस्थित सङ्ग्रहविद्यालयको school_db
DBMSत्यो डेटाबेस चलाउने सफ्टवेयरMySQL, Oracle, MS Access
Database systemDatabase + DBMS + hardware + प्रयोगकर्ता, सबै मिलेरपूरै विद्यालय प्रणाली

बारम्बार हुने गल्ती: “MySQL एउटा database हो” भन्नु गलत हो। MySQL एउटा DBMS हो; school_db चाहिँ database हो।

DBMS ले भित्र के-के गर्छ — functions

कार्यनेपालीमा
Data definitionतालिका र क्षेत्रको संरचना बनाउने (CREATE)
Data manipulationडेटा थप्ने, हेर्ने, बदल्ने, मेट्ने (INSERT/SELECT/UPDATE/DELETE)
Data securityकसले के गर्न पाउने भन्ने नियन्त्रण (GRANT/REVOKE)
Data integrityनियम भङ्ग हुने डेटा छिर्नै नदिने
Concurrency controlधेरै प्रयोगकर्ता एकैचोटि काम गर्दा नबिग्रियोस् भन्ने
Backup and recoveryबिग्रिएमा पुरानो अवस्थामा फर्काउने
Data dictionary managementडेटाबेसको आफ्नै विवरण राख्ने

DBMS का फाइदा — advantages

  1. Reduction of data redundancy — दोहोरोपन घट्छ
  2. Data consistency — डेटा बाझिँदैन
  3. Data sharing — धेरै प्रयोगकर्ताले एउटै डेटा प्रयोग गर्न पाउँछन्
  4. Data independence — भण्डारण बदले पनि program बदल्नु पर्दैन
  5. Improved data integrity — नियम DBMS आफैँले लागू गर्छ
  6. Improved security — प्रयोगकर्ता अनुसार पहुँच
  7. Backup and recovery — स्वचालित
  8. Concurrent access — एकैचोटि धेरै जनाले सुरक्षित रूपमा
  9. Unforeseen queries — पहिले नसोचेको प्रश्नको पनि उत्तर SQL ले दिन्छ
  10. Multiple user interfaces — form, report, API

DBMS का बेफाइदा — disadvantages

  1. Expensive — सफ्टवेयर र hardware महँगो
  2. Complexity — बुझ्न र चलाउन जटिल
  3. Needs technical training — दक्ष जनशक्ति चाहिन्छ
  4. Larger size — धेरै memory र disk खान्छ
  5. Single point of failure — केन्द्रीय डेटाबेस बिग्रियो भने सबै रोकिन्छ
  6. Performance — सानो, सरल कामका लागि फाइल भन्दा ढिलो हुन सक्छ

डेटाबेसका आधारभूत शब्दहरू — basic terms

यी शब्द सबै अगाडिका अध्यायमा फेरि-फेरि आउँछन्, त्यसैले पहिले यिनै पक्का गर्नु।

शब्दनेपालीमाउदाहरण
Table / Relationपङ्क्ति र स्तम्भको ढाँचामा राखिएको डेटाSTUDENT तालिका
Field / Attribute / Columnतालिकाको एउटा स्तम्भ — एउटा गुणName, Address
Record / Tuple / Rowतालिकाको एउटा पङ्क्ति — एउटा वस्तुको पूरा विवरणराम को पूरै विवरण
Data item / Cellएउटा पङ्क्ति र एउटा स्तम्भ जोडिने ठाउँको एउटा मानपोखरा
Domainकुनै क्षेत्रमा राख्न मिल्ने मानहरूको समूहMarks को domain = 0–100
Degreeतालिकामा भएका स्तम्भको संख्या5 स्तम्भ भए degree = 5
Cardinalityतालिकामा भएका पङ्क्तिको संख्या40 विद्यार्थी भए cardinality = 40
Entityवास्तविक संसारको वस्तु जसको डेटा राखिन्छविद्यार्थी, पुस्तक, शिक्षक
Instanceकुनै क्षणमा डेटाबेसमा भएको डेटाआजको अवस्था
Schemaडेटाबेसको संरचनाको खाकातालिका र क्षेत्रको डिजाइन

सम्झने सजिलो तरिका: Degree = स्तम्भ (कति किसिमको जानकारी), Cardinality = पङ्क्ति (कति वटा रेकर्ड)। परीक्षामा यी दुई साटिन्छन् — ध्यान दिनु।

                    ← degree = ४ स्तम्भ →
            ┌────────┬────────┬──────────┬───────┐
            │ Roll   │ Name   │ Address  │ Marks │  ← field / attribute
            ├────────┼────────┼──────────┼───────┤
     ↑      │  101   │ Ram    │ Pokhara  │  85   │  ← record / tuple
cardinality │  102   │ Sita   │ Butwal   │  91   │
   = ३      │  103   │ Hari   │ Dharan   │  78   │
     ↓      └────────┴────────┴──────────┴───────┘
                         ↑
                    data item / cell

Keys — कुञ्जीहरू

नेपालीमा: तालिकाको कुनै पङ्क्तिलाई अरूबाट छुट्याएर चिन्नका लागि प्रयोग हुने क्षेत्र वा क्षेत्रहरूको समूहलाई key भनिन्छ। कक्षामा दुई जना “राम” हुन सक्छन्, तर Roll नम्बर दुईवटा उस्तै हुँदैन — त्यसैले Roll key हो।

Keyपरिभाषा (नेपालीमा)Exam definition
Super keyपङ्क्ति छुट्याउन सक्ने जुनसुकै क्षेत्र वा संयोजनAny attribute or set of attributes that uniquely identifies a row.
Candidate keyसबैभन्दा सानो super key — जसबाट कुनै क्षेत्र झिक्यो भने अद्वितीयता नै जान्छA minimal super key.
Primary keycandidate key मध्ये छानिएको मुख्य कुञ्जीThe candidate key chosen to uniquely identify each record; it cannot be NULL or duplicated.
Alternate keyprimary नछानिएका बाँकी candidate keyA candidate key that was not selected as the primary key.
Composite keyदुई वा बढी क्षेत्र मिलेर बनेको primary keyA primary key made up of two or more attributes.
Foreign keyअर्को तालिकाको primary key लाई देखाउने क्षेत्रAn attribute in one table that refers to the primary key of another table, creating a link between them.

उदाहरणबाट बुझौं

STUDENT तालिका
┌─────────┬───────────┬────────┬───────────┐
│ Roll(PK)│ Citizen#  │ Name   │ ProgramID │ ← foreign key
├─────────┼───────────┼────────┼───────────┤
│   101   │ 12-345-67 │ Ram    │    CS      │
│   102   │ 98-765-43 │ Sita   │    CS      │
└─────────┴───────────┴────────┴───────────┘
                                     │
                                     ↓ देखाउँछ
PROGRAM तालिका           ┌─────────────┬──────────────┐
                         │ ProgramID(PK)│ ProgramName │
                         ├─────────────┼──────────────┤
                         │     CS      │ Computer Sc. │
                         └─────────────┴──────────────┘

यहाँ Roll र Citizen# दुवैले विद्यार्थी अद्वितीय रूपमा चिन्न सक्छन् — त्यसैले दुवै candidate key हुन्। हामीले Roll लाई primary key बनायौं, त्यसैले Citizen# alternate key भयो। ProgramID ले अर्को तालिका देखाउँछ, त्यसैले त्यो foreign key हो।

Data integrity — डेटाको शुद्धता

नियमनेपालीमाभङ्ग भएको उदाहरण
Entity integrityPrimary key खाली (NULL) वा दोहोरिएको हुनु हुँदैनदुई विद्यार्थीको Roll दुवै 101
Referential integrityForeign key ले नभएको पङ्क्ति देखाउनु हुँदैनProgramID = 'EE' तर PROGRAM मा EE छँदै छैन
Domain integrityमान तोकिएको दायरा र प्रकारभित्रै हुनुपर्छMarks = 150 वा Marks = 'Ram'

Exam line: Data integrity means the accuracy, validity and consistency of data in a database, enforced by the DBMS through entity integrity, referential integrity and domain integrity constraints.

डेटाबेस मोडेलहरू — Database models

नेपालीमा: डेटाबेसमा डेटा कसरी मिलाएर राख्ने र एउटा डेटा अर्कोसँग कसरी जोड्ने — यो ढाँचालाई database model भनिन्छ।

1. Hierarchical model (पदानुक्रमिक मोडेल)

नेपालीमा: डेटा रूखको आकारमा मिलाइन्छ। माथि एउटा मात्र root हुन्छ, तलका हरेक child को एउटै मात्र parent हुन्छ। IBM को IMS यसैमा आधारित थियो।

              Gurukul College        ← root
                 /         \
            Science      Humanities   ← parent
            /     \
      Chemistry  Biology              ← child
फाइदाबेफाइदा
बुझ्न र बनाउन सजिलोMany-to-many सम्बन्ध राख्न सकिँदैन
एक-देखि-धेरै सम्बन्धमा छिटोसंरचना कडा — बदल्न गाह्रो
डेटा सुरक्षा राम्रोएउटै डेटा दोहोरिने सम्भावना
Child लाई parent बिना राख्न मिल्दैन

2. Network model (नेटवर्क मोडेल)

नेपालीमा: Hierarchical को कमजोरी हटाउन आएको। यहाँ एउटा child का धेरै parent हुन सक्छन्, त्यसैले संरचना रूख नभई जाल (graph) जस्तो हुन्छ। CODASYL ले मानक बनाएको थियो।

        Science ─────┐        ┌───── Humanities
            │        │        │
            ↓        ↓        ↓
         Chemistry   Statistics   History
                        ↑
                 (दुवै faculty सँग जोडिएको)
फाइदाबेफाइदा
Many-to-many सम्बन्ध राख्न सकिनेसंरचना जटिल
Hierarchical भन्दा लचिलोबनाउन र बदल्न गाह्रो
डेटामा छिटो पुग्नेप्रयोगकर्तालाई संरचना थाहा हुनुपर्ने

3. Relational model (सम्बन्धात्मक मोडेल) — सबैभन्दा प्रचलित

नेपालीमा: E. F. Codd ले 1970 मा प्रस्ताव गरेको। डेटा तालिका (relation) मा राखिन्छ र तालिकाहरू key मार्फत जोडिन्छन्। आजका MySQL, Oracle, PostgreSQL, MS Access सबै यसैमा आधारित छन्।

 STUDENT                          PROGRAM
 ┌──────┬───────┬──────────┐     ┌──────────┬─────────────┐
 │ Roll │ Name  │ProgramID │────→│ProgramID │ ProgramName │
 ├──────┼───────┼──────────┤     ├──────────┼─────────────┤
 │ 101  │ Ram   │   CS     │     │   CS     │ Computer Sc.│
 │ 102  │ Sita  │   MG     │     │   MG     │ Management  │
 └──────┴───────┴──────────┘     └──────────┴─────────────┘
          foreign key  →  primary key
फाइदाबेफाइदा
बुझ्न सजिलो — तालिका सबैले चिन्छन्धेरै ठूलो डेटामा ढिलो हुन सक्ने
SQL ले सजिलै query गर्न मिल्नेधेरै तालिका जोड्दा (join) जटिल
Data redundancy घटाउन सकिनेHardware महँगो पर्न सक्ने
संरचना बदल्न सजिलो

4. Object-oriented model (वस्तुमुखी मोडेल)

नेपालीमा: डेटा र त्यो डेटामाथि चल्ने method दुवै object भित्रै राखिन्छ। Inheritance, encapsulation जस्ता OOP का गुण यहाँ पनि लागू हुन्छन्। चित्र, भिडियो, नक्सा जस्तो जटिल डेटाका लागि उपयुक्त।

फाइदाबेफाइदा
जटिल डेटा (multimedia, CAD) राख्न सकिनेबुझ्न र चलाउन गाह्रो
OOP भाषासँग सिधै मिल्नेमानक (standard) कम
Code पुन: प्रयोग गर्न मिल्नेबजारमा कम प्रचलित

चारै मोडेलको तुलना

आधारHierarchicalNetworkRelationalObject-oriented
संरचनारूख (tree)जाल (graph)तालिकाobject
सम्बन्ध1:M मात्र1:M र M:Nkey मार्फत सबैobject reference
Parentएउटै मात्रधेरै हुन सक्नेलागू हुँदैनलागू हुँदैन
प्रयोगIBM IMSCODASYL/IDMSMySQL, OracleObjectDB, db4o
सजिलोपनसजिलोजटिलसबैभन्दा सजिलोजटिल

E-R Diagram — Entity Relationship Diagram

नेपालीमा: डेटाबेस बनाउनु अघि “कुन-कुन वस्तुको डेटा राख्ने र ती वस्तु आपसमा कसरी जोडिन्छन्” भन्ने चित्रमा देखाउने तरिका नै ER diagram हो। यो Peter Chen ले 1976 मा ल्याएका हुन्।

Exam line: An E-R diagram is a graphical representation of the entities in a system and the relationships among them, used to design the logical structure of a database.

ER diagram का चिन्हहरू — components

चिन्हआकारके जनाउँछ
Entityआयत (rectangle)वास्तविक वस्तु — STUDENT, BOOK
Attributeअण्डाकार (ellipse)वस्तुको गुण — Name, Address
Relationshipठाडो चतुर्भुज (diamond)वस्तुबीचको सम्बन्ध — STUDIES, BORROWS
Linkरेखा (line)माथिका कुरा जोड्ने
Key attributeमुनि रेखा कोरिएको अण्डाकारPrimary key — <u>Roll</u>
Multivalued attributeदोहोरो अण्डाकारधेरै मान हुने — Phone
Derived attributeथर्किएको अण्डाकारअरूबाट निकालिने — Age (DOB बाट)
        ┌─────────┐                          ┌─────────┐
        │ STUDENT │──────◇ STUDIES ◇─────────│ PROGRAM │
        └─────────┘                          └─────────┘
          /   |   \                            /     \
    (Roll) (Name) (Address)             (ProgramID) (PName)
      ___                                   ______
     (रेखा कोरिएको = primary key)

Cardinality — सम्बन्धको मात्रा

प्रकारनेपालीमाउदाहरण
One-to-One (1:1)एउटाको एउटैसँग मात्र सम्बन्धएक विद्यार्थी ↔ एक रोल नम्बर
One-to-Many (1:M)एउटाको धेरैसँग सम्बन्धएक शिक्षक → धेरै विद्यार्थी
Many-to-Many (M:N)धेरैको धेरैसँग सम्बन्धधेरै विद्यार्थी ↔ धेरै विषय
 1:1     [विद्यार्थी] ───── [रोल नम्बर]
 1:M     [शिक्षक] ────┬──── [विद्यार्थी १]
                      ├──── [विद्यार्थी २]
                      └──── [विद्यार्थी ३]
 M:N     [विद्यार्थी १] ──┐   ┌── [विषय: कम्प्युटर]
         [विद्यार्थी २] ──┼───┼── [विषय: गणित]
         [विद्यार्थी ३] ──┘   └── [विषय: अंग्रेजी]

महत्वपूर्ण बुँदा: Many-to-many सम्बन्ध सिधै तालिकामा राख्न मिल्दैन। बीचमा एउटा junction table (वा bridge/linking table) बनाउनुपर्छ:

STUDENT ──1:M──→ ENROLLMENT ←──M:1── SUBJECT
                 ┌──────┬──────────┐
                 │ Roll │ SubjectID│   ← दुवैको foreign key मिलेर
                 ├──────┼──────────┤      composite primary key
                 │ 101  │   CS101  │
                 │ 101  │   MT101  │
                 │ 102  │   CS101  │
                 └──────┴──────────┘

Normalization — सामान्यीकरण

नेपालीमा: ठूलो र दोहोरिने तालिकालाई साना-साना, सफा तालिकामा टुक्र्याउने व्यवस्थित प्रक्रिया नै normalization हो। उद्देश्य: data redundancy घटाउने र anomaly हटाउने।

Exam line: Normalization is the process of organising data in a database by decomposing large tables into smaller, well-structured tables and defining relationships among them, in order to minimise data redundancy and eliminate insertion, update and deletion anomalies.

तीन किसिमका Anomaly — किन normalize गर्ने?

यो तालिका हेरौं (normalize नगरिएको):

RollNameProgramIDProgramHead
101RamCSMr. Gurung
102SitaCSMr. Gurung
103HariMGMrs. Rai
Anomalyनेपालीमा समस्यायहाँ के हुन्छ
Insertion anomalyनयाँ डेटा थप्न नसकिनेनयाँ program EE खोल्यौं तर विद्यार्थी छैन — Roll primary key भएकाले पङ्क्ति नै थप्न मिल्दैन
Update anomalyएक ठाउँ बदल्दा अरू छुट्नेCS को head बदलियो भने दुवै पङ्क्ति बदल्नुपर्छ; एक छुट्यो भने डेटा बाझियो
Deletion anomalyचाहिने डेटा पनि सँगै मेटिनेHari मेट्यौं भने MG program र Mrs. Rai को जानकारी नै हराउँछ

Functional dependency — एउटै मूल अवधारणा

नेपालीमा: A → B भन्नुको अर्थ “A थाहा भए B अनिवार्य रूपमा थाहा हुन्छ”। जस्तै Roll → Name: रोल नम्बर थाहा भए नाम निश्चित हुन्छ। यही निर्भरता हेरेर तालिका टुक्र्याइन्छ।

1NF — First Normal Form

नियम: हरेक cell मा एउटै मात्र मान (atomic value) हुनुपर्छ; दोहोरिने समूह (repeating group) हुनु हुँदैन।

1NF मा नभएको:

RollNameSubjects
101RamComputer, Math

1NF मा ल्याएपछि:

RollNameSubject
101RamComputer
101RamMath

2NF — Second Normal Form

नियम: 1NF मा हुनुपर्यो, र कुनै non-key क्षेत्र composite primary key को एक अंशमा मात्र निर्भर हुनु हुँदैन (partial dependency हटाउनुपर्छ)।

माथिको तालिकामा primary key = (Roll, Subject)। तर Name चाहिँ Roll मा मात्रै निर्भर छ, Subject मा होइन — यो partial dependency हो।

2NF मा टुक्र्याएपछि:

STUDENT                     ENROLLMENT
┌──────┬───────┐            ┌──────┬──────────┐
│ Roll │ Name  │            │ Roll │ Subject  │
├──────┼───────┤            ├──────┼──────────┤
│ 101  │ Ram   │            │ 101  │ Computer │
└──────┴───────┘            │ 101  │ Math     │
   PK = Roll                └──────┴──────────┘
                            PK = (Roll, Subject)

3NF — Third Normal Form

नियम: 2NF मा हुनुपर्यो, र कुनै non-key क्षेत्र अर्को non-key क्षेत्रमार्फत primary key मा निर्भर हुनु हुँदैन (transitive dependency हटाउनुपर्छ)।

यो तालिका हेरौं:

RollNameProgramIDProgramHead
101RamCSMr. Gurung

यहाँ Roll → ProgramID र ProgramID → ProgramHead, त्यसैले Roll → ProgramHead घुमाउरो बाटो (transitive) बाट आयो।

3NF मा टुक्र्याएपछि:

STUDENT                           PROGRAM
┌──────┬───────┬───────────┐      ┌───────────┬─────────────┐
│ Roll │ Name  │ ProgramID │─────→│ ProgramID │ ProgramHead │
├──────┼───────┼───────────┤      ├───────────┼─────────────┤
│ 101  │ Ram   │    CS     │      │    CS     │ Mr. Gurung  │
│ 102  │ Sita  │    CS     │      │    MG     │ Mrs. Rai    │
└──────┴───────┴───────────┘      └───────────┴─────────────┘

अब CS को head बदल्नु पर्यो भने एउटै ठाउँ बदले पुग्छ — update anomaly हट्यो। नयाँ program पनि विद्यार्थी बिना थप्न मिल्छ — insertion anomaly हट्यो।

तीनै normal form एकै हेराइमा

Formहटाउने समस्यासरल नियम
1NFRepeating group / multivalued cellहरेक खानामा एउटै मान
2NFPartial dependencyपूरै primary key मा निर्भर हुनुपर्छ
3NFTransitive dependencynon-key ले non-key निर्धारण गर्नु हुँदैन

रट्ने वाक्य (अंग्रेजीमा): “The key, the whole key, and nothing but the key.” — 1NF: the key; 2NF: the whole key; 3NF: nothing but the key.

Normalization का फाइदा र सीमा

फाइदासीमा
Redundancy घट्छधेरै तालिका बन्छन्
Anomaly हट्छQuery मा धेरै join चाहिन्छ
डेटा consistent रहन्छधेरै टुक्र्याए पढ्न ढिलो हुन सक्छ
ठाउँ बचत हुन्छडिजाइन गर्न समय लाग्छ

व्यवहारमा: अधिकांश डेटाबेस 3NF सम्म मात्र लगिन्छ। त्योभन्दा माथि (BCNF, 4NF) विशेष अवस्थामा मात्र चाहिन्छ, र NEB कक्षा १२ मा 1NF, 2NF, 3NF नै पर्याप्त छ।

केन्द्रीकृत र वितरित डेटाबेस — Centralized vs Distributed

नेपालीमा: सबै डेटा एउटै ठाउँको एउटै कम्प्युटरमा राख्यो भने centralized; फरक-फरक ठाउँका धेरै कम्प्युटरमा छरेर राख्यो भने distributed।

 CENTRALIZED                      DISTRIBUTED
    [सबै प्रयोगकर्ता]             काठमाडौं    पोखरा    विराटनगर
          ↓                        [DB]      [DB]      [DB]
    ┌───────────┐                    └────────┼────────┘
    │ एउटै सर्भर │                         नेटवर्क
    │  (DB)     │                   (सबै मिलेर एउटै
    └───────────┘                     डेटाबेस जस्तो)
आधारCentralizedDistributed
स्थानएउटै ठाउँधेरै ठाउँ
व्यवस्थापनसजिलोजटिल
लागतकमबढी
गतिटाढाका प्रयोगकर्तालाई ढिलोस्थानीय प्रयोगकर्तालाई छिटो
Failureसर्भर बिग्रिए सबै रोकिन्छएउटा बिग्रिए पनि अरू चल्छन्
Data consistencyसजिलै कायम हुन्छकायम राख्न गाह्रो
Securityनियन्त्रण गर्न सजिलोधेरै ठाउँ जोगाउनुपर्ने
उदाहरणसानो विद्यालयको प्रणालीबैंकका शाखाहरू, NTC

डेटाबेस प्रशासक — Database Administrator (DBA)

नेपालीमा: डेटाबेसको पूरै जिम्मेवारी लिने व्यक्ति नै DBA हो — बनाउनेदेखि सुरक्षा, backup र कार्यसम्पादनसम्म।

Exam line: A Database Administrator (DBA) is the person responsible for the design, implementation, security, integrity, performance and maintenance of an organisation’s database.

DBA का मुख्य जिम्मेवारी

जिम्मेवारीनेपालीमा
Schema definitionतालिका र संरचनाको डिजाइन गर्ने
Storage structureडेटा कसरी र कहाँ राख्ने निर्णय गर्ने
Granting authorizationकसले के गर्न पाउने भनी अनुमति दिने
Securityअनधिकृत पहुँच रोक्ने
Backup and recoveryनियमित backup र बिग्रिएमा पुनर्स्थापना
Performance tuningIndex, query सुधारेर छिटो बनाउने
Integrity constraintsनियम लागू गर्ने
User training & supportप्रयोगकर्तालाई सिकाउने
Software upgradeDBMS को नयाँ संस्करण व्यवस्थापन

Data dictionary र Data security

Data dictionary (डेटा शब्दकोश)

नेपालीमा: डेटाबेसले आफ्नै बारेमा राख्ने जानकारी — कुन तालिका छ, कुन क्षेत्र छ, कस्तो प्रकारको छ, कुन key हो, कस्तो नियम छ। यसैलाई metadata (डेटाको डेटा) पनि भनिन्छ।

Exam line: A data dictionary is a centralised repository that stores metadata — information about the structure of the database such as table names, field names, data types, constraints and relationships.

सम्झने तरिका: पुस्तकालयमा पुस्तक = डेटा; क्याटलग (कुन पुस्तक कुन दराजमा) = data dictionary।

Data security (डेटा सुरक्षा)

उपायनेपालीमा
Authenticationप्रयोगकर्ता को हो भनी username/password ले पहिचान
Authorizationकसलाई कुन तालिकामा के गर्ने अनुमति (GRANT/REVOKE)
Encryptionडेटा सङ्केतमा बदलेर राख्ने, चोरिए पनि नबुझियोस्
Backupनियमित प्रतिलिपि राख्ने
Audit trailकसले कहिले के गर्यो भन्ने अभिलेख
Viewआवश्यक स्तम्भ मात्र देखाउने, बाँकी लुकाउने

SQL — Structured Query Language

नेपालीमा: डेटाबेससँग “कुरा गर्ने” मानक भाषा नै SQL हो। यो पूर्ण programming भाषा होइन — यो query language हो। अंग्रेजी वाक्य जस्तै पढिने भएकाले सिक्न सजिलो छ।

SQL का भागहरू

भागपूरा नामकाममुख्य आदेश
DDLData Definition Languageसंरचना बनाउने/बदल्नेCREATE, ALTER, DROP, TRUNCATE, RENAME
DMLData Manipulation Languageडेटा थप्ने/हेर्ने/बदल्ने/मेट्नेINSERT, SELECT, UPDATE, DELETE
DCLData Control Languageअनुमति दिने/खोस्नेGRANT, REVOKE
TCLTransaction Control Languageकारोबार पक्का/उल्टाउनेCOMMIT, ROLLBACK, SAVEPOINT

सम्झने तरिका: DDL = ढाँचा, DML = डेटा, DCL = अनुमति, TCL = कारोबार।

DDL — संरचना बनाउने

तालिका बनाउने:

SQL
CREATE TABLE Students (
    StudentID  INT          PRIMARY KEY,
    FName      VARCHAR(30)  NOT NULL,
    LName      VARCHAR(30),
    Address    VARCHAR(50),
    Class      INT
);

नयाँ स्तम्भ थप्ने:

SQL
ALTER TABLE Students ADD Phone VARCHAR(15);

स्तम्भको प्रकार बदल्ने:

SQL
ALTER TABLE Students MODIFY Class VARCHAR(10);

स्तम्भ हटाउने:

SQL
ALTER TABLE Students DROP COLUMN Phone;

पूरै तालिका मेट्ने:

SQL
DROP TABLE Students;

ध्यान दिनुहोस् — DROP बनाम DELETE बनाम TRUNCATE: DROP TABLE ले तालिका नै हटाउँछ (संरचना सहित)। TRUNCATE TABLE ले सबै पङ्क्ति हटाउँछ तर तालिका रहन्छ। DELETE FROM ले छानिएका पङ्क्ति हटाउँछ। यी तीन परीक्षामा साटिन्छन्।

DML — डेटासँग काम गर्ने

डेटा थप्ने:

SQL
INSERT INTO Students (StudentID, FName, LName, Address, Class)
VALUES (101, 'Ram', 'Sharma', 'Pokhara', 12);

डेटा हेर्ने:

SQL
SELECT * FROM Students;                      -- सबै स्तम्भ
SELECT FName, LName FROM Students;           -- छानिएका स्तम्भ मात्र
SELECT * FROM Students WHERE Class = 12;     -- सर्त राखेर
SELECT * FROM Students ORDER BY FName ASC;   -- क्रमबद्ध गरेर

डेटा बदल्ने:

SQL
UPDATE Students
SET Address = 'Kathmandu'
WHERE StudentID = 101;

डेटा मेट्ने:

SQL
DELETE FROM Students WHERE StudentID = 101;

सबैभन्दा खतरनाक गल्ती: UPDATE र DELETE मा WHERE छुटाउनु। DELETE FROM Students; ले पूरै तालिकाका सबै पङ्क्ति मेटिदिन्छ। परीक्षामा पनि, व्यवहारमा पनि — WHERE सधैँ जाँच्नु।

DCL — अनुमति नियन्त्रण

SQL
GRANT SELECT, INSERT ON Students TO 'teacher'@'localhost';
REVOKE INSERT ON Students FROM 'teacher'@'localhost';

प्रयोगमा सहायक SQL clause

Clauseकामउदाहरण
WHEREसर्त राख्नेWHERE Class = 12
ORDER BYक्रमबद्ध गर्नेORDER BY FName DESC
GROUP BYसमूहमा बाँड्नेGROUP BY Class
HAVINGसमूहमा सर्तHAVING COUNT(*) > 5
DISTINCTदोहोरिएको हटाउनेSELECT DISTINCT Class
LIKEखोजी ढाँचाWHERE FName LIKE 'R%'
BETWEENदायराWHERE Class BETWEEN 11 AND 12
INसूचीमध्येWHERE Class IN (11, 12)

NEB परीक्षाका सम्भावित प्रश्न र नमुना उत्तर

यी प्रश्न NEB कक्षा १२ मा बारम्बार सोधिएका हुन्। उत्तर अंग्रेजीमा दिइएको छ — किनभने उत्तरपुस्तिकामा अंग्रेजीमै लेख्नुपर्छ। माथि कोष्ठकमा नेपालीमा उत्तरको ढाँचा दिइएको छ।

प्रश्न १. What is a database and a DBMS? List the advantages and disadvantages of a DBMS.

(ढाँचा: दुई परिभाषा → उदाहरण → फाइदा ५–६ बुँदा → बेफाइदा ३–४ बुँदा)

A database is an organised collection of logically related data stored in a systematic way so that it can be easily accessed, managed and updated. A DBMS (Database Management System) is the software that enables users to create a database, and to store, retrieve, update and control access to the data in it. MySQL, Oracle, PostgreSQL and MS Access are examples of a DBMS, while school_db is an example of a database.

Advantages: reduction of data redundancy; data consistency; data sharing among many users; data independence; improved data integrity; improved security; automatic backup and recovery; controlled concurrent access; and the ability to answer unforeseen queries through SQL.

Disadvantages: a DBMS is expensive to purchase and run; it is complex and requires trained technical staff; it needs more memory and processing power; and because the data is centralised, a failure of the database server can stop the whole organisation.

प्रश्न २. Explain the different models of DBMS with their advantages and disadvantages.

(ढाँचा: चारै मोडेल → हरेकको एक वाक्य परिभाषा → चित्र → फाइदा/बेफाइदा)

Hierarchical model organises data in a tree structure in which every child record has exactly one parent. It is simple and fast for one-to-many relationships, but it cannot represent many-to-many relationships and its structure is rigid.

Network model organises data as a graph in which a child may have several parents. It supports many-to-many relationships and is more flexible, but the structure is complex and difficult to modify.

Relational model, proposed by E. F. Codd in 1970, stores data in tables (relations) that are linked through keys. It is easy to understand, can be queried with SQL and reduces redundancy, but it may become slow with very large volumes of data and complex joins.

Object-oriented model stores data and the methods that operate on that data together as objects, supporting inheritance and encapsulation. It handles complex multimedia data well but is harder to use and less standardised.

प्रश्न ३. Differentiate between centralized and distributed database systems.

(ढाँचा: परिभाषा दुवैको → तुलना तालिका कम्तीमा ५ पङ्क्ति → उदाहरण)

In a centralized database system the entire database is stored and maintained at a single location on a single computer, and all users access it from there. In a distributed database system the database is spread across several computers at different physical locations connected by a network, yet it appears to users as a single logical database.

A centralized system is cheaper and easier to manage and keeps data consistent easily, but it is slower for remote users and a server failure stops all work. A distributed system gives faster local access and continues working when one site fails, but it costs more, is complex to manage and makes consistency harder to maintain. A small school system is typically centralized, while a bank with many branches uses a distributed database.

प्रश्न ४. Who is a DBA? What are the major responsibilities of a DBA?

(ढाँचा: परिभाषा → जिम्मेवारी ६–८ बुँदा)

A Database Administrator (DBA) is the person responsible for the overall design, implementation, security, integrity, performance and maintenance of an organisation’s database.

The major responsibilities of a DBA are: defining the database schema and storage structure; granting and controlling user authorization; enforcing security and preventing unauthorised access; taking regular backups and recovering the database after a failure; enforcing integrity constraints; monitoring and tuning performance; training and supporting users; and managing upgrades of the DBMS software.

प्रश्न ५. What is normalization? Explain the normalization process with examples.

(ढाँचा: परिभाषा → तीन anomaly → 1NF, 2NF, 3NF हरेकमा नियम + उदाहरण तालिका → फाइदा)

Normalization is the process of organising data in a database by decomposing large tables into smaller, well-structured tables and defining relationships among them, in order to minimise redundancy and eliminate insertion, update and deletion anomalies.

First Normal Form (1NF) requires every cell to hold a single atomic value with no repeating groups. A table holding Subjects = "Computer, Math" in one cell is split into two rows, one per subject.

Second Normal Form (2NF) requires the table to be in 1NF and every non-key attribute to depend on the whole primary key, removing partial dependency. With the composite key (Roll, Subject), the attribute Name depends only on Roll, so the table is split into STUDENT(Roll, Name) and ENROLLMENT(Roll, Subject).

Third Normal Form (3NF) requires the table to be in 2NF and no non-key attribute to depend on another non-key attribute, removing transitive dependency. Since Roll → ProgramID and ProgramID → ProgramHead, the table is split into STUDENT(Roll, Name, ProgramID) and PROGRAM(ProgramID, ProgramHead).

Normalization reduces redundancy, removes anomalies and keeps data consistent, although it produces more tables and therefore requires joins when querying.

प्रश्न ६. Define the following terms.

Data dictionary — a centralised repository that stores metadata, that is, information about the structure of the database such as table names, field names, data types, constraints and relationships.

Primary key — the candidate key chosen to identify each record in a table uniquely; it can contain neither duplicate values nor NULL.

Foreign key — an attribute in one table that refers to the primary key of another table, creating a link between the two tables.

Relationship — an association between two or more entities, which may be one-to-one, one-to-many or many-to-many.

DDL — Data Definition Language, the part of SQL used to define and modify the structure of a database, using commands such as CREATE, ALTER and DROP.

DML — Data Manipulation Language, the part of SQL used to insert, retrieve, update and delete the data held in tables.

SQL — Structured Query Language, the standard language used to define, manipulate and control data in a relational database.

Entity — a real-world object or concept, such as a student or a book, about which data is stored in a database.

Attribute — a named property or characteristic of an entity, which becomes a column in a table.

Record — a single row of a table, holding the complete set of attribute values for one entity instance.

थप सम्भावित प्रश्न

प्रश्नकहाँ पढ्ने
Differentiate between data and information.डेटा र सूचना
What are the limitations of a file-based system?फाइल प्रणालीका सीमा
Differentiate between DDL and DML with examples.SQL
Explain the components of an E-R diagram.E-R Diagram
Explain one-to-one, one-to-many and many-to-many relationships.Cardinality
Differentiate between primary key and foreign key.Keys
What is data redundancy? How does a DBMS reduce it?फाइल प्रणाली + Normalization
Write SQL to create a table / insert / update / delete records.SQL

शब्दावली — Nepali–English glossary

Englishनेपालीमा अर्थ
Dataकच्चा तथ्य र अंक
Informationप्रशोधित, अर्थपूर्ण डेटा
Databaseसम्बन्धित डेटाको व्यवस्थित सङ्ग्रह
DBMSडेटाबेस चलाउने सफ्टवेयर
Redundancyएउटै डेटा धेरै ठाउँमा दोहोरिनु
Inconsistencyएउटै कुराको फरक-फरक मान हुनु (बाझिनु)
Data independenceभण्डारण बदले पनि program नबदल्नुपर्ने गुण
Integrityडेटाको शुद्धता र विश्वसनीयता
Table / Relationपङ्क्ति-स्तम्भको ढाँचा
Field / Attributeतालिकाको स्तम्भ
Record / Tupleतालिकाको पङ्क्ति
Domainक्षेत्रमा राख्न मिल्ने मानहरूको समूह
Degreeस्तम्भको संख्या
Cardinalityपङ्क्तिको संख्या (वा सम्बन्धको मात्रा)
Primary keyमुख्य पहिचान कुञ्जी
Candidate keyपहिचान गर्न सक्ने सबैभन्दा सानो कुञ्जी
Alternate keyprimary नछानिएको candidate key
Foreign keyअर्को तालिका देखाउने कुञ्जी
Composite keyदुई वा बढी क्षेत्र मिलेको कुञ्जी
Entityडेटा राखिने वास्तविक वस्तु
Relationshipवस्तुहरूबीचको सम्बन्ध
Schemaडेटाबेसको संरचनाको खाका
Metadataडेटाको बारेमा भएको डेटा
Normalizationतालिका टुक्र्याएर दोहोरोपन घटाउने प्रक्रिया
Anomalyथप्दा/बदल्दा/मेट्दा आउने गडबडी
Functional dependencyएउटा क्षेत्रले अर्कोलाई निर्धारण गर्ने सम्बन्ध
Queryडेटाबेससँग सोधिने प्रश्न
Transactionएकसाथ पूरा हुनुपर्ने कामको समूह
Concurrencyधेरैले एकैचोटि काम गर्नु
Backupसुरक्षित प्रतिलिपि
DBAडेटाबेस प्रशासक

Frequently asked questions

MySQL डेटाबेस हो कि DBMS?

MySQL एउटा DBMS हो — डेटाबेस होइन। MySQL भनेको सफ्टवेयर हो जसले डेटाबेस बनाउन र चलाउन दिन्छ; तपाईंले त्यसभित्र बनाउने school_db चाहिँ डेटाबेस हो। परीक्षामा “MySQL is a database” लेख्नु सामान्य तर गलत उत्तर हो। More precisely, MySQL is a Relational Database Management System (RDBMS).

Primary key र Foreign key बीच के फरक छ?

Primary key आफ्नै तालिकाका पङ्क्तिलाई अद्वितीय रूपमा चिनाउँछ, र यसमा न दोहोरिएको मान न NULL राख्न मिल्छ। Foreign key चाहिँ अर्को तालिकाको primary key लाई देखाउँछ र दुई तालिका जोड्छ; यसमा दोहोरिएको मान राख्न मिल्छ, र सम्बन्ध वैकल्पिक भए NULL पनि हुन सक्छ। एउटै तालिकामा primary key एउटा मात्र हुन्छ, तर foreign key धेरै हुन सक्छन्।

Degree र Cardinality फरक कसरी सम्झने?

Degree = स्तम्भ (column) को संख्या, Cardinality = पङ्क्ति (row) को संख्या। जस्तै 4 स्तम्भ र 40 विद्यार्थी भएको तालिकाको degree 4 र cardinality 40 हुन्छ। ER diagram को सन्दर्भमा भने cardinality ले सम्बन्धको मात्रा (1:1, 1:M, M:N) जनाउँछ — प्रश्नले कुन सन्दर्भ सोधेको हो हेर्नु।

Normalization कहाँसम्म गर्ने — 3NF पुग्छ कि पुग्दैन?

व्यवहारमा र NEB कक्षा १२ का लागि 3NF सम्म पुग्छ। 3NF ले insertion, update र deletion तीनै anomaly हटाइसक्छ। BCNF, 4NF र 5NF विशेष अवस्थामा मात्र चाहिन्छ र कक्षा १२ को पाठ्यक्रमभित्र पर्दैन। धेरै normalize गर्दा तालिका धेरै हुन्छन् र query मा join बढेर पढ्न ढिलो पनि हुन सक्छ।

SQL programming भाषा हो?

होइन — SQL एउटा query language हो, पूर्ण programming भाषा होइन। यसमा loop, condition र function जस्ता सामान्य programming संरचना हुँदैनन्; यसले “के चाहियो” भन्छ, “कसरी ल्याउने” भन्दैन (यसैलाई declarative भनिन्छ)। तर MySQL को stored procedure वा Oracle को PL/SQL जस्ता विस्तारले programming सुविधा थप्छन्।

DROP, DELETE र TRUNCATE मा के फरक छ?

DROP TABLE ले तालिका नै हटाउँछ — डेटा र संरचना दुवै जान्छ। TRUNCATE TABLE ले सबै पङ्क्ति हटाउँछ तर खाली तालिका रहन्छ। DELETE FROM ले WHERE सर्त अनुसार छानिएका पङ्क्ति मात्र हटाउँछ, र सर्त नराखे सबै पङ्क्ति हट्छ। DDL मा DROP र TRUNCATE पर्छन्, DML मा DELETE पर्छ।

Hierarchical र Network model मा मुख्य भिन्नता के हो?

Hierarchical model मा हरेक child को एउटै मात्र parent हुन्छ, त्यसैले संरचना रूख जस्तो हुन्छ र many-to-many सम्बन्ध राख्न सकिँदैन। Network model मा एउटा child का धेरै parent हुन सक्छन्, त्यसैले संरचना जाल (graph) जस्तो हुन्छ र many-to-many सम्बन्ध पनि राख्न मिल्छ — तर बनाउन र बुझ्न बढी जटिल हुन्छ।

Many-to-many सम्बन्ध तालिकामा कसरी राख्ने?

सिधै राख्न मिल्दैन। बीचमा एउटा junction table (bridge table) बनाउनुपर्छ, जसमा दुवै तालिकाका primary key foreign key बनेर आउँछन् र ती मिलेर composite primary key बन्छ। जस्तै विद्यार्थी र विषयबीचको M:N सम्बन्धका लागि ENROLLMENT(Roll, SubjectID) तालिका बनाइन्छ।

NEB कक्षा १२ मा Unit 1 बाट कति अंक आउँछ?

Unit 1 लाई पाठ्यक्रमले 80 मध्ये 12 शिक्षण घण्टा दिएको छ — करिब 15%। लिखित बोर्ड पेपर 50 अंकको हुने हुनाले Unit 1 बाट सामान्यतया 6–8 अंक आउँछ। प्रायः एउटा लामो वा छोटो उत्तर (normalization, DBMS का फाइदा-बेफाइदा, वा database model) र केही वस्तुगत प्रश्न सोधिन्छन्।

यो unit राम्रोसँग तयार गर्न के अभ्यास गर्ने?

तीन कुरा अभ्यास गर्नुहोस्: (१) Normalization — एउटै तालिका लिएर 1NF, 2NF, 3NF सम्म हातले टुक्र्याउने; (२) ER diagram — आयत, अण्डाकार र diamond सहित कोर्ने, र cardinality लेख्ने; (३) SQL — CREATE, INSERT, SELECT, UPDATE, DELETE पाँचै आदेश सम्झेर लेख्ने। यी तीनमा diagram र उदाहरण माग्ने भएकाले अंक पक्का हुन्छ।

  • DBMS Explained: Keys, ER Models and Normalization — यही विषयको गहिरो अंग्रेजी संस्करण, मापन गरिएका उदाहरण र थप diagram सहित। यो पाना बुझेपछि त्यो पढ्नुहोस्।
  • Free SQL Lab — browser मै MySQL query चलाएर तालिका बदलिएको हेर्नुहोस्; यस unit का SQL आदेश अभ्यास गर्न उत्तम।
  • Class 12 Computer Science notes — सातै unit को मुख्य पाना।
  • Query processing in a DBMS — SQL चलाउँदा डेटाबेसले भित्र के गर्छ (पाठ्यक्रमभन्दा माथि, रुचि भए)।
  • NoSQL databases — relational नभएका डेटाबेस के हुन् र किन आए।