Wednesday, 31 March 2021

Computer Science (New) - For Class IX - UNIT. 7 - Introduction to Database System - Short and Descriptive Questions Answers

GO TO INDEX

Chapter No.7 - Introduction to Database System
Short and Descriptive Questions Answers


Q.1: Define term database system?
Ans: DATABASE:
Definition:
  • A database stores data in organized form.
  • Generally, a database is an electronic system that facilitates easy access, manipulation and updating of data.
  • A database is composed of tables which contain rows and columns.
  • These rows and columns are called records and fields respectively.
  • Most databases contain multiple tables.

For example:
A general store database may include tables for purchase, sales and stock records. Each of these tables has different fields that are relevant to the information stored in the table.

Q.2: Define terms records and fields?
Ans: A database is composed of tables which contain rows and columns.
  • Records: These rows are called records, and
  • Fields: These columns are called records.

Q.3: Describe use and advantages of database?
Ans: Use of Database:
  • Nowadays, everyone is familiar with term database, it is mathematically developed data structure which converts raw input data into meaningful information for a particular organization.
  • These days, database can be seen in every field of life, for example:
    in industries
    health
    agriculture
    schooling
    business and
    banking
  • The databases can be developed according to the size of its records for a particular organization.
  • Databases can be small in size with a few records or very large like:
    NADRA (National Database Registration Authority) databases which keep the multi millions of records.

Advantages Of Database:
  • A database is playing a leading role to enhance the efficiency and performance of any organization.
  • The goal of database is to minimize the loss and increase the productivity and efficiency of any organization in the age of information technology.

Q.4: Describe database management system and name some popular DBMS?
Ans: Database Management System (DBMS):
  • Databases are usually developed, maintained and controlled by the Database Management System (DBMS).
  • The DBMS essentially serves as an interface between databases and end users or application programs, ensuring that data is consistently organized and remains easily accessible.

Examples:
Here are some examples of popular DBMSs used these days:
  • MySql
  • Oracle
  • Microsoft SQL Server
  • MongoDB
  • Visual Foxpro
  • IBM Db2
  • PostgreSQL


Q.5: Define terms flat file system?
Ans: Flat File System
Early databases were relatively "flat", which means they were limited to simple rows and columns, like a spreadsheet. A flat file is the older version of database. It stores data in a single table structure. Flat file databases are usually in plain text format, with only one record per line. The fields included in the record are separated using delimiters such as tabs or commas.
Example: Excel spreadsheet.

Q.6: Discuss the advantages of database system over flat file system? OR Why Database Management System is preferred over Flat File System?
Ans: Advantages of Database Management System over the Flat File System

S.No.Database Management SystemFlat File System
1. Multiple users can access data simultaneously. Only one user can access at a time.
2. Capable of handling huge sets of data. Suitable only for smaller sets of data.
3. Allows non-duplication and integrity. Increases duplicate and redundant data.
4. Supports online access. Does not support remote connections.
5. Good for small, medium and large businesses. Limited only to smaller data management needs.


Q.7 : Describe the characteristics of database management system?
Ans: Characteristics of Database Management System
A DBMS is modern version of database designing, organization and manipulation. This mainly offers the solutions which a flat file system could not provide. The DBMS has many characteristics. Some of them are:
  1. Support Multiple user and Concurrent Access:
    Multiple users can access DBMS and can view, add, edit and delete records.
  2. Query Language: 
    QA DBMS offers tools like Queries, Views and Forms which help users to manipulate data easily and more efficiently.
  3. Security:
    A DBMS is more secure and reliable.
  4. Data Store In Tables:
    DBMS allows distribution of data in multiple tables by making use of features like keys and relationships between fields of those tables.
  5.  Reduced Redundancy:
    This allows lesser duplication of data and results in lesser redundancy.
  6. Transactions:
    Preparing backups and providing limited permissions to the users are features of DBMS.
  7. Data Consistency:
    DBMS can handle large and complex data more conveniently. Therefore, it is preferred by the medium and large organizations.

Q.8: Define and describe basic components of database?
Ans: BASIC COMPONENTS OF DBMS
The basic components of DBMS are:
  • Table
  • Field
  • Record
  • Data Types
  • Views

(i) Table:
  • It is a collection of data elements organized in shape of rows and columns.
  • Example:
    (i) A contact list may be one of the simplest examples of a table.
    (ii) The marks record prepared by a class teacher is also an example of a table.

(ii) Field:
  • It is the smallest component in a database.
  • It is where the actual data is stored during data entry.
  • All data fields in the same table, have unique names.
  • Fields are also called attributes or columns.
  • Multiple fields make up a data record, several data records make up a data table, and several data tables make up a database.

(iii) Record:
  • A single entry in a table is called a record.
  • Records are also referred as tuples or rows.
  • A record is made up of two or several data items which are also called tuples in a table representing a set of related data.
  • For example, the illustrated Student table has 4 tuples /records/rows.

Components Of Tables

(iv) Data Types:
  • All fields in a table must have some data type.
  • Data type is a data storage format that can contain a specific type or range of values.
  • The data type of a field is a property that tells what kind of data that eld can hold.
  • Different DBMSs offer different range of data types to be stored.
  • Here are some basic data types:

Data TypeDescriptionExamples
Integer Holds only whole numbers.145, -35, 74586
Floating Point Holds numbers with decimal points.5.6, 3.14, 554.9
Character Stores only one character.A, B, c, d
String Can store a combination of numbers, letters and special characters.Pakistan, Computer, @admin
Boolean Can hold only Boolean values i.e. true or false.1,0
Date And Time Stores date and time in specified format.01-01-2020 11:30


For example:
  • MS Access allows a range of whole numbers from -32768 to 32767 for an “Integer”.
  • In modern DBMS, choosing proper data type is important to make sure that database runs faster.

(v) Views:
  • In a database the data is stored in tables. However, we can see that data through views.
  • Views do not store data and just show the information virtually.
  • They have the ability to fetch data from different tables.
  • Views maintain the security of data and ensure that no changes occur in the original data.

Q.9: Describe the steps for creating tables and views in MS Access?
Ans: Create Tables and Views in MS Access.
(i) Steps for creating a table using Design View:
1. To create tables in Access using “Design View,” click on the Create tab and click on the Table icon. Then pull down the View menu and choose Design View.


2. A new table then appears in the Table Design View. Note that the default name assigned to the table is Table 1.
3. Type the name of a field into the “Field Name” column.
4. Then use the drop-down menu in the “Data Type” column to assign the field a data type.
5. If desired, type a description of the data stored in this field.


6. Repeat steps 4 and 5 until you have created all of the necessary table fields.
An example of a Table may be customer Table that has following entries.

Field NameData TypeDescription
Customer IDNumber The Unique Identier for a customer
First NameText The First Name of the customer
Last NameText The Last Name of the customer
AddressText The Address of the customer


7. Click the “Save” button in the Quick Access toolbar.
8. Then type a name for the newly created table and click “OK”.


(ii) Steps for creating a query or view using Design View:
1. To make a query in design view, click on the “Create” tab in the Ribbon and pull down the “Queries” group and click on “Query Design” button.
2. In the “Show Table” dialog box, add the table or tables that you want to add to query design view.
3. Next, add the fields from these tables that you want to view in your query results or view. If you want to add all of the fields of a table into your result set, you can click and drag the first field in the table, shown as an asterisk.
4. Once you have added all the necessary tables and fields to the query or view, click the “Close” button in the “Show Table” dialog box to close it and display the query design view.
5. To run a query and view the result set, you can click the “Run” button in the “Results” group of the “Design” tab in the “Query Tools” contextual tab on the office Ribbon.
6. The result set looks like a table. This result set is a reflection of data from the selected fields of the tables. It is also known as a view.
7. Click the “Save” button in the Quick Access toolbar. Type a name for your view and click “OK” to save the query.


Q.10: What is Data modelling? Name its important components?
Ans: Data Modeling:
Data modeling is a process of developing conceptual representation of data objects and their relations.

Uses Of Data Modeling:
  • Data models are used to express how the information will be stored in database. This helps to identify the most important fields and remove the irrelevant data.
  • Data models can be used by database developers to create a physical database. This saves a lot of time and efforts of developers.

Components Of Data Models:
There are three most important components of data models.
  1. Entity
  2. Relationship
  3. Referential Keys

(1) Entity:
  • In literal sense, an entity is any individual object which has its own qualities and properties.
  • In database terms, an entity is an independent table and its fields are known as attributes.
  • Example:
    As an example, a Payroll database will contain an entity named Employees. The Employees entity will contain various attributes like EmployeeID, Name, Designation, Salary, etc.

(2) Relationship:
  • When the database structures grew and became more complex, a lot of data started to become redundant which means that data was being unnecessarily duplicated. This created a need to connect data entities instead of repeating same data in multiple tables. This resulted in the creation of relationships and Relational Database Management Systems (RDBMS).
  • Definition:
    "A relationship denes the connection between two tables. It creates a connection from an attribute of one entity with an attribute of another entity."

Types Of Relationship:
Three types of relationships can be dened between entities.
  1. One to One Relationship
  2. One to Many Relationship
  3. Many to Many Relationship

(i) One to One Relationship:
  • This type of relationship defines that a record in one entity can be connected to only one record in another entity.
  • This is not a very common type of relationship because the data from related entities can directly be placed in a single entity.
  • However, this type of relationship is used to divide larger entities into smaller ones.

(ii) One to Many Relationship:
  • This type of relationship defines that a record in one entity can be connected to many records in another entity.
  • This is the most common type of relationship used in relational databases.
  • This relationship can also be seen as Many to One Relationship.

(iii) Many to Many Relationship:
  • In this type of relationship, one or more records of one entity are connected to one or more records of another entity.
  • Usually, a third entity known as “junction table” is used to create the many-to-many relationship between two related entities.

(3) Referential Keys:
  • The relationships are configured by using referential keys on entities.
  • The keys determine a certain set of rules that must be followed by the data stored in a field of an entity. In larger databases, keys are very important to uniquely identify a specific record.

Types Of Keys:
Two types of keys are most commonly used in RDBMSs:
(i) Primary Key
  • A primary key is used to uniquely identify a record in an entity.
  • When a primary key is applied to any attribute in an entity, it forces the rules of Primary Key onto that attribute.
  • Rules of Primary Key:
    These rules are:
    The attribute (field) must contain a unique value to identify a record. A unique value means that two records in the same entity cannot have the same value stored in this attribute where Primary Key is applied.
    The value of the attribute where Primary Key is applied, cannot be null.

(ii) Foreign Key:
  • A foreign key is used to define the connection or relation between two entities.
  • The foreign key of one entity is configured to be connected to the primary key of another entity.
  • When a foreign key is applied on an attribute, it enforces that the value for that attribute should match any record in the related entity having a primary key.

Q.11: Explain with example to better understand relationship and referential keys?
Ans: Understanding relationship and referential keys:
Students Table:
  • Students table is used to store personal information of individual student.
  • It has an Id field set as a Primary Key.
  • It also has a ClassId field to setup a One-to-One foreign key relationship with the Class table.

Class Table:
  • Class table is used to store information about classrooms in a school.
  • It has an Id field set as a Primary Key.
  • A student can be enrolled in only one class; hence, Students table has a One-to-One relationship with Class table.
  • However, many teachers can be associated with many classes. This requires a Many-to-Many relationship between Class and Teachers tables.

Teachers Table:
  • Teachers table is used to store personal information about a teacher.
  • It has an Id field set as a Primary Key.
  • Many classes can be taught by many teachers. This requires a Many-to-Many relationship between Teachers and Class tables.

Teachers Class table:
  • Teachers class table is used as a junction table to facilitate the Many-to-Many relationship between Teacher and Class tables.
  • It also contains an Id field set as Primary Key.
  • The other two fields are used to define which teachers are associated with which classes.
  • It creates a One-to-Many relationship with each of the two connected tables.
  • Teachers and Class tables use their Teachers Class Id field's foreign key relationship to fetch the related information from this table.
Entity Relationship

Q.12: Define term ER model or Entity Relationship Diagram (ERD). Describe the components of ER diagram and Design ER model for a database in M.S Access?
Ans: Entity Relationship or ER Model:
Entity Relationship Model (ERM) or Entity Relationship Diagram (ERD) describes the entities, attributes and relationships with their types in a simplified diagram.

Uses OF ER model:
  • This model or diagram can itself be used as the reference for designing an actual database.
  • It can even be used as a backup for the structure of a database.
  • ERD Used in Two Ways:
    The ERD can be used in two ways:
    (i) When the database has not been created yet. The ERD helps in creating a clear representation of the entire database based on user requirements.
    (ii) When an existing database needs to be documented. The Database development tool features automatic creation of ERD based on existing database which facilitates documentation.

Components of ER Diagram:
  • ER Design is made up of different components like Attributes, Relationships, etc.
  • There are defined symbols and shapes to represent each one of them.
  • Some of the shapes used to define these components are:
    (a) Rectangle
    (b) Ellipse
    (c) Diamond
    (d) Connecting lines


Steps to design ER Model:
  1. Identify and design the entities based on the requirements of its users.
  2. Identify and design the attributes within the required entities.
  3. Identify the relationships required between entities.
  4. Define Primary Keys in interrelated entities.
  5. Design Foreign Key relationships based on requirements and bind them to previously created Primary Keys.
  6. Generate an automated Entity Relationship Diagram.
For example:
A sample ERD for the statement “A writer creates a novel and consumer buys novel” is discussed below.
Here in this example, diagram shows that:

Entities are in rectangular Box:
  1. Writer
  2. Consumer
  3. Novel

Relationships are in Diamond Shape:
  1. Create
  2. Buys


No comments:

Post a Comment