Database Management System (DBMS)
Data, Keys, DDL/DML, Database Models & Normalization
Complete NEB Class 12 Computer Science notes covering database fundamentals, keys, database models, normalization (1NF, 2NF, 3NF), centralized vs distributed databases, and database security — with fully solved questions.
Chapter 1: Database Management System (DBMS) – Syllabus
- Introduction to data, database, Database system, DBMS
- Field, Record, Objects, Primary Key, Alternate key, Candidate key
- Advantages of using DBMS
- DDL (Data Definition Language) and DML (Data Manipulation Language)
- Database Model: Network Model, Hierarchical Model, Relational database model
- Concept of Normalization: 1NF, 2NF, 3NF
- Centralized Vs. Distributed Database
- Database Security
Solved Questions & Answers
A DBMS (Database Management System) is the software that allows a computer to perform database functions of storing, retrieving, adding, deleting, and modifying data.
The advantages and disadvantages of DBMS are as follows:
Advantages
Disadvantages
A key is an attribute or a set of attributes which is used to uniquely identify a record of a table. The three types of keys are as follows:
1) Primary Key
A primary key is an attribute which uniquely identifies each record within a table. It cannot accept null values. We can have only one primary key in a table.
| SID | Reg-No | Name | Course | |
|---|---|---|---|---|
| 1 | 2078001 | Sagar KC | BIT | Sagar@gmail.com |
| 2 | 2078002 | Binod Karki | CE | binod@gmail.com |
| 3 | 2078003 | Darshan DC | BIT | darshan@gmail.com |
| 4 | 2078004 | Sagar KC | BSCCSIT | Sagar12@gmail.com |
2) Alternate Key
It is a column or a group of columns in a table that uniquely identifies every row in that table. All the remaining candidate keys which are not selected as a primary key are called alternate keys.
| SID | |
|---|---|
| 1 | Sagar@gmail.com |
| 2 | binod@gmail.com |
| 3 | darshan@gmail.com |
| 4 | Sagar12@gmail.com |
3) Candidate Key
A candidate key is a minimal super key which contains no extra attributes. It is also called a subset of a super key. It is a set of attributes that uniquely identify records in a table.
| SID | Reg-No | Name | |
|---|---|---|---|
| 1 | 2078001 | Sagar KC | Sagar@gmail.com |
| 2 | 2078002 | Binod Karki | binod@gmail.com |
| 3 | 2078003 | Darshan DC | darshan@gmail.com |
| 4 | 2078004 | Sagar KC | Sagar12@gmail.com |
SQL stands for Structured Query Language. SQL is used to communicate with a database. It is the standard language for relational database management systems. SQL statements are used to perform tasks such as updating data in a database, or retrieving data from a database.
The main languages provided by DBMS are:
Data Definition Language (DDL)
Database designers use Data Definition Language (DDL) to define the structure of a database. DDL refers to the set of SQL commands that can create and manipulate the structure of a database. Common DDL statements are:
Data Manipulation Language (DML)
Once a database completes defining the structure of a database (database schema), the database is ready for the entry and manipulation of data. Data Manipulation Language statements are used for managing data in a database.
Data Control Language (DCL)
The DCL component of the SQL language is used to create privileges to allow users access to, and manipulation of, the database. There are two main commands:
A set of rules and standards that define how the database organizes data is called a database model. Types of Database Models:
a) Hierarchical Model
As its name implies, the hierarchical database model defines hierarchically-arranged data. A hierarchical database consists of a collection of records which are connected to one another through links. A link is an association between precisely two records.
Advantages:
Disadvantages:
b) Network Model
A network database is a type of database model where multiple member records or files can be linked to multiple owner files and vice-versa.
Advantages:
Disadvantages:
c) Relational Database Model
A relational database is a collective set of multiple data sets organized by tables, records, and columns. RDBMS establish a well-defined relationship between database tables.
Advantages:
Disadvantages:
The process of arranging data in several simplified database tables in order to reduce data redundancy (i.e., duplication or repetition of data) and to maintain data consistency and integrity.
Advantages:
Let us consider the un-normalized data attributes:
| Teacher Name | Subject | Age | Address |
|---|---|---|---|
| Ram | account, English | 27 | Kathmandu |
| Shyam | maths | 25 | Palpa |
| Hari | CS | 28 | Nuwakot |
1) 1NF (First Normal Form)
Once we have un-normalized data sets, we arrange them in First Normal Form by making each attribute atomic, which means in 1NF there should not be repeating data groups.
| Teacher Name | Subject | Age | Address |
|---|---|---|---|
| Ram | account | 27 | Kathmandu |
| Ram | English | 27 | Kathmandu |
| Shyam | maths | 25 | Palpa |
| Hari | CS | 28 | Nuwakot |
2) 2NF (Second Normal Form)
After arranging the given data set in 1NF, we eliminate functional dependency attributes. In this case, subject depends upon the teacher, not age and address. Similarly, age and address also depend on the teacher, not the subject. So, in 2NF, we remove such functional dependencies by introducing a primary key and foreign key.
Teacher Table:
| Teacher-ID | Teacher Name | Age | Address |
|---|---|---|---|
| 101 | Ram | 27 | Kathmandu |
| 102 | Shyam | 25 | Palpa |
| 103 | Hari | 28 | Nuwakot |
Subject Table:
| Teacher-ID | Subject |
|---|---|
| 101 | account |
| 101 | maths |
| 102 | CS |
| 103 | Nepali |
3) 3NF (Third Normal Form)
As we normalize till 2NF, now to achieve 3NF we have to overcome some more issues associated with 2NF. Let’s say in the table below, if one teacher left the job, data in this table and functional dependencies are eliminated, it will not affect.
| Teacher-ID | Teacher Name | Age | Address |
|---|---|---|---|
| 101 | Ram | 27 | Kathmandu |
| 102 | Shyam | 25 | Palpa |
| 103 | Hari | 28 | Nuwakot |
But in the table below, if a teacher is changed, it will affect. A change in one affecting another is known as transitive functional dependency.
| Teacher-ID | Subject |
|---|---|
| 101 | account |
| 101 | math |
| 102 | CS |
| 103 | Nepali |
So, to prevent loss of information due to transitive functional dependencies, we assign a separate subject code for each subject, so that even a change in the teacher does not affect the subject.
| Subject Code | Subject |
|---|---|
| A01 | account |
| M01 | maths |
| C01 | CS |
| N01 | Nepali |
Centralized computing is similar to a client/server architecture where one or more client PCs are directly connected to a central server.
Advantages
Disadvantages
A distributed database is a collection of multiple interconnected databases, which are spread physically across various locations that communicate via a computer network.
Advantages
Disadvantages
| S.N. | Centralized Database System | Distributed Database System |
|---|---|---|
| 1 | Stores data in a single location. | It stores data in several locations. |
| 2 | It consists of only one server. | It consists of servers in several locations. |
| 3 | It is cheaper. | It is expensive. |
| 4 | There is less chance of data loss. | There is more chance of data hacking and data loss. |
| 5 | Its maintenance process is easy. | Its maintenance process is very difficult. |
| 6 | Data traffic rate is high. | Data traffic rate is low. |
| 7 | It is suitable for small organizations. | It is suitable for large organizations. |
Data security refers to protective digital privacy measures that are applied to prevent unauthorized access to computers, databases, and websites.
The preventive measures used for security of data are:
A Database Administrator (DBA) is a computer specialist who manages, maintains, and secures data in one or more database systems so that users can perform analysis for business operations.
The characteristics / roles of a Database Administrator:
| S.N. | DBMS | RDBMS |
|---|---|---|
| 1 | Data is stored in file format. | Data is stored in table format. |
| 2 | Individual access of data elements. | Multiple data elements are accessible together. |
| 3 | No connection between data. | Data in the form of a table are linked together. |
| 4 | There is no normalization. | Normalization is achievable. |
| 5 | No support for distributed databases. | Supports distributed databases. |
| 6 | Data stored is in a small quantity. | Data is stored in large amounts. |
📄 View / Download Full PDF Notes
If the PDF doesn’t load, click here to open it in Google Drive.
