Chapter 7 - Introduction to Database System
Chapter 7 - Introduction to Database System
CHAPTER 7
Introduction to
Database System
Computer Science - For Grade IX Written and Composed by SYED ATIF FEROZ 2
DATABASE
A database stores data in organized form. 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. Generally, a database is an electronic system that
facilitates easy access, manipulation and updating of data.
USES OF DATABASE
Database can be seen in every field of life, for example industries, school, and banking.
Databases can be large like NADRA databases which keep the multi millions of records.
Databases help businesses to organize and track customers, inventory and employees.
Database tells a retail business how much stock is in warehouse and on store shelves.
MySQL Visual FoxPro Oracle IBM Db2 Microsoft SQL Server PostgreSQL
CHARACTERISTICS OF DBMS
The DBMS has many characteristics. Some of them are…
Multiple users can access DBMS and can view, add, edit and delete records.
DBMS has tools like Queries, Views, Forms which help users to manipulate data easily.
A DBMS is more secure and reliable.
DBMS allow distribution of data in multiple tables. It ensures lesser duplication of data.
Preparing backups and providing limited permissions to users are features of DBMS.
DBMS can handle large and complex data more conveniently.
Computer Science - For Grade IX Written and Composed by SYED ATIF FEROZ 3
ATTRIBUTE
Attributes describe the characteristics or properties of an entity in a database table.
For example, if we have to define a student entity then we can define it with the set of
attributes like roll number, name, course etc. The attribute values, of each student entity,
will define its characteristics in the table.
Capable of handling huge sets of data. Only one user can access at a time
Good for small, medium and large Limited only to smaller data
businesses. management needs.
Computer Science - For Grade IX Written and Composed by SYED ATIF FEROZ 4
Table
It is a collection of data elements organized in shape of rows and columns. A contact list
may be one of the simplest examples of a table.
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.
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.
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 field can hold. Here are some basic data types…
Floating Point Holds number with decimal points 4.8, 5.23, 778.56
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. Views maintain the
security of data and ensure that no changes occur in the original data.
Computer Science - For Grade IX Written and Composed by SYED ATIF FEROZ 5
DESIGN VIEW
It displays the view which allows entering field names, data types and description in table.
We cannot change database data in design view.
DATASHEET VIEW
It displays view in a column/row format which allow to view, enter or manipulate data.
In this view, we can change data but it will not allow changing format of the database.
TABLE VIEW
A database object that allows generating a
A database object or entity that stores logical subset of data from one or more
the data of a database.
tables.
ii. A new table appears in Table Design View. The name assigned to table is Table1.
iii. Type the name of a field into the Field Name column.
iv. Use the drop-down menu in the Data Type column to assign the field a data type.
v. Repeat steps 4 until you have created all of the necessary table fields.
vii. Then type a name for the newly created table and click OK.
i. Click on Create tab in Ribbon and pull down the Queries group and click on Query
Design button.
ii. In the Show Table dialog box, add the table or tables that you want to add to query
design view.
iii. 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.
iv. 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.
v. 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.
vi. 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.
vii. Click the Save button in Quick Access toolbar. Type a name for your view and click
OK to save query.
Computer Science - For Grade IX Written and Composed by SYED ATIF FEROZ 7
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
resulted in the creation of relationships and Relational Database Management Systems
(RDBMS).
Three types of relationships can be defined between entities.
One to One Relationship One to Many Relationship Many to Many Relationship
Simple Model
A Relational Database system is the simplest model, as it does not require any complex
structuring or querying processes.
Data Accuracy
In the relational database system, there can be multiple tables related to one another. This
makes the data to be non-repetitive. Hence the accuracy of data is more.
Data Integrity
Data integrity is a crucial characteristic of the Relational Database system. It aids in other
significant characteristics like Ease of use, precision, and stability of the data.
Computer Science - For Grade IX Written and Composed by SYED ATIF FEROZ 8
Flexibility
A Relational Database system facilitates the increasing incoming amount of data, as well as
the update and deletes wherever required.
High Security
As the data is divided amongst the tables, it is possible to make a few tables to be tagged as
confidential and others not. This is easily implemented with a relational database, unlike
other databases.
DATA MODELING
Data modeling is a process of developing conceptual representation of data objects and
their relations. Data models are used to express how the information will be stored in
database. Data models can be used by database developers to create a physical database.
This saves a lot of time and efforts of developers.
ENTITY
In database terms, an entity is an independent table and its fields are known as attributes.
As an example, a Payroll database will contain an entity named Employees. The
Employees entity will contain various attributes like Employee ID, Name, Designation,
Salary, etc.
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
resulted in the creation of relationships and Relational Database Management Systems
(RDBMS).
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. Two types of keys
are most commonly used in RDBMSs…
Computer Science - For Grade IX Written and Composed by SYED ATIF FEROZ 9
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.
These rules are…
The attribute (field) must contain a unique value to identify a record.
The value of the attribute where Primary Key is applied cannot be null.
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.
ER MODEL
Entity Relationship Model (ERM) or Entity Relationship Diagram (ERD) describes the
entities, attributes and relationships with their types in a simplified diagram. 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. The ERD can be used in two ways…
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…
Important ER Symbols
Symbol Description
1 1
Connecting lines show the type of relationship between two entities.
1 M
Computer Science - For Grade IX Written and Composed by SYED ATIF FEROZ 11
ii. Identify and design the attributes within the required entities.
IMPORTANCE OF ERD
ERD stands for Entity Relationship Diagram and it is basically a snapshot or brief of
various data structures. Following are some benefits/importance of the entity relationship
diagram.
Simple to Understand
ERD is simple to understand and simple to create.
Highly Flexible
The ERD acts like the plan for the database and it make it possible for the creation of an
accurate design that demonstrates the needs of the project.
Computer Science - For Grade IX Written and Composed by SYED ATIF FEROZ 12
EXERCISE
1 What is a database? What are the uses of database?
2 What is a database management system? What are its characteristics?
3 What are the advantages of DBMS over flat file system?
4 What is a flat file system?
5 What are the basic components of a DBMS? Explain in detail.
6 Write the steps to create a table using design view.
7 What is an attribute?
8 Write the steps to create a query/view using design view.
9 Define relationship and its types.
10 What is data modeling? Name its components.
11 Define entity with example.
12 What is a referential key? What are its types?
13 Define ER model. What are the components of an ER diagram?
14 Write the steps to design ER model.
15 What is the difference between design view and datasheet view?
16 Differentiate between table and view.
17 List the properties of primary key and foreign key.
18 List some benefits of using relationships in database.
19 Discuss the importance of ERD in business.
20 Why it is important to decide the data type for each field?