Class 12 Computer Important Questions and answer, chapter 1, Database

Chapter 1:

1. Explain relational data model.

The relational data model is a method of organizing data into tables, where each table represents a collection of related entities or facts. This model is based on mathematical set theory and logic, offering a structured approach to storing and managing data in database systems. In the relational model:

  1. Tables: Data is organized into tables, also known as relations, where each table consists of rows and columns. Each row represents a single record or instance of an entity, while each column represents a specific attribute or property of that entity.

  2. Attributes and Entities: Tables contain attributes, which define the properties of the entities being represented. Entities are the objects or concepts being modeled, and each entity is represented by a table in the database.

  3. Relationships: Relationships between entities are established through keys. Primary keys uniquely identify each row in a table, while foreign keys establish relationships between tables by referencing the primary keys of other tables.

In a relational database table, relationships between entities are typically represented using primary and foreign keys. Let's illustrate this with an example of two tables: STUDENT and COURSE.

STUDENT Table:

ROLL_NONAMECOURSE_ID
1Alice101
2Bob102
3Charlie103
4David102

COURSE Table:

COURSE_IDCOURSE_NAME
101Math
102Science
103History

In the STUDENT table, the COURSE_ID column serves as a foreign key that establishes a relationship with the COURSE table's primary key, COURSE_ID. Each student's COURSE_ID corresponds to a specific course they are enrolled in. For example, Alice is enrolled in the course with the COURSE_ID 101, which corresponds to the "Math" course in the COURSE table.

This relationship allows for the retrieval of information about students and their associated courses, enabling queries like finding all students enrolled in a particular course or retrieving details about the courses taken by a specific student.

2. Demonstrate any two DDL statements with examples.

DDL (Data Definition Language) statements are used to define, modify, and manage the structure of database objects such as tables, indexes, and constraints. Here are two examples of DDL statements:

  1. CREATE TABLE:

    This statement is used to create a new table in the database. Here's an example of creating a table named "Students" with columns for student ID, name, age, and grade:

    CREATE TABLE Students ( student_id INT PRIMARY KEY, name VARCHAR(50), age INT, grade VARCHAR(2) );

    In this example:

    • CREATE TABLE is the DDL command to create a new table.
    • Students is the name of the table being created.
    • (student_id INT PRIMARY KEY, name VARCHAR(50), age INT, grade VARCHAR(2)) defines the columns of the table along with their data types and constraints. Here, student_id is defined as the primary key.
  2. ALTER TABLE:

    This statement is used to modify an existing table, such as adding, modifying, or dropping columns.

    ALTER TABLE Students ADD COLUMN email VARCHAR(100);

    In this example:

    • ALTER TABLE Students specifies the table to be modified.
    • ADD COLUMN email VARCHAR(100) adds a new column named "email" with a VARCHAR data type of length 100 to the "Students" table.

These DDL statements are fundamental in defining the structure of database objects, allowing for the creation, modification, and maintenance of databases in SQL-based systems.

3. Explain role of DBA.

A Database Administrator (DBA) is a professional responsible for managing and maintaining a database system. They ensure that the database operates smoothly, securely, and efficiently to meet the needs of the organization.

Roles of a DBA:

  1. Designing Databases: DBAs create the structure and layout of databases, determining how data will be organized and stored.

  2. Setting Up Databases: They install and configure database software on servers, making sure it runs properly and is optimized for performance.

  3. Securing Data: DBAs implement security measures to protect the database from unauthorized access, ensuring that only authorized users can view or modify data.

  4. Backing Up Data: They regularly back up the database to prevent data loss in case of hardware failures, disasters, or other emergencies.

  5. Monitoring Performance: DBAs keep an eye on the database's performance, identifying and fixing any issues that could slow down operations or cause problems for users.


4. Explain normalization in DBMS.

Normalization is a process used in database management systems (DBMS) to organize data efficiently and reduce redundancy. It involves breaking down larger tables into smaller ones and establishing relationships between them. The primary goal of normalization is to minimize data redundancy and dependency, ensuring data integrity and reducing the likelihood of anomalies during database operations.

Now, let's briefly explain the concepts of 1NF, 2NF, and 3NF with simple examples:

First Normal Form (1NF):
    1. In 1NF, each column in a table contains atomic (indivisible) values, and there are no repeating groups of columns. It eliminates duplicate rows and ensures each row uniquely identifies an entity. For example, consider a table named STUDENT with columns for Student ID (Primary Key), Student Name, and Courses:

      Student IDStudent NameCourses
      1AliceMath, Physics
      2BobChemistry

      To convert this to 1NF, we break down the repeating group "Courses" into separate rows:

      Student IDStudent NameCourse
      1AliceMath
      1AlicePhysics
      2BobChemistry
    2. Second Normal Form (2NF): In 2NF, the table is in 1NF, and all attributes (columns) are fully functionally dependent on the primary key. If any column depends on only part of the primary key, it's moved to a separate table. For example, consider the following table with Student ID and Course ID as the composite primary key:

      Student IDStudent NameCourse IDCourse Name
      1Alice101Math
      1Alice102Physics
      2Bob103Chemistry

      To achieve 2NF, we split this table into two: STUDENT and COURSE, with Student ID as the primary key in the STUDENT table:

      STUDENT Table:

      Student IDStudent Name
      1Alice
      2Bob

      COURSE Table:

      Course IDCourse Name
      101Math
      102Physics
      103Chemistry
    3. Third Normal Form (3NF): In 3NF, the table is in 2NF, and there are no transitive dependencies. That is, non-key attributes should depend only on the primary key, not on other non-key attributes. For example, consider a table with Student ID, Course ID, and Instructor:

      Student IDCourse IDInstructor
      1101Smith
      1102Johnson
      2103Smith

      To achieve 3NF, we remove the transitive dependency by moving the Instructor to a separate table:

      STUDENT_COURSE Table:

      Student IDCourse ID
      1101
      1102
      2103

      INSTRUCTOR Table:

      Course IDInstructor
      101Smith
      102Johnson
      103Smith

    By following the normalization process, we ensure efficient data storage, minimize redundancy, and maintain data integrity within the database.

  1. 5. What is SQL? Describe DML with an example.

  2. SQL (Structured Query Language) is a standard programming language used to manage and manipulate relational databases. It allows users to perform various operations such as querying data, inserting new records, updating existing records, and deleting records from databases.

DML (Data Manipulation Language) is a subset of SQL that focuses on manipulating data within the database. It consists of commands like INSERT, UPDATE, DELETE, and SELECT. These commands enable users to add, modify, and delete data in database tables.

Here's an example of each DML command:

  1. INSERT: The INSERT statement is used to add new records into a database table. For instance, suppose we have a table named STUDENTS with columns for Student ID, Name, and Age. We can insert a new record into this table as follows:

    This statement inserts a new record with a StudentID of 1, Name of 'Alice', and Age of 20 into the STUDENTS table.

UPDATE: The UPDATE statement is used to modify existing records in a database table. For example, if we want to update the age of a student named 'Alice', we can use the following statement:

UPDATE STUDENTSSET Age = 21WHERE Name = 'Alice';

This statement updates the age of the student whose name is 'Alice' to 21 in the STUDENTS table.

  1. DELETE: The DELETE statement is used to remove records from a database table. If we want to delete a student record with a StudentID of 1 from the STUDENTS table, we can use the following statement:

    DELETE FROM STUDENTS WHERE StudentID = 1;

    This statement deletes the record with a StudentID of 1 from the STUDENTS table.


  2. SELECT: The SELECT statement is used to retrieve data from one or more tables in a database. For instance, if we want to retrieve the names of all students from the STUDENTS table, we can use the following statement:

    SELECT Name FROM STUDENTS;

    This statement selects the Name column from the STUDENTS table, returning a list of all student names.


Netra Koirala

Netra Koirala

Computer Science Educator

Passionate computer science educator and author. Provides free study notes, practical guides, and tutorials for Class 9, 10, 11, 12, and B.Sc CSIT students in Nepal. Years of teaching experience in computer science fundamentals.

Computer Science notes, tutorials, MCQs, and educational resources for Nepal students. Covering Class 9, SEE preparation, Class 11, Class 12, SLC, programming, DBMS, networking, HTML, JavaScript, PHP, OOP and more.

Featured Post

Grade 10 Computer Science: Specification Grid & Model Questions

Specification Grid & Model Questions of Computer Science | Grade 10 📚 Examination Resource Specification Grid & M...

Followers