0% found this document useful (0 votes)
24 views8 pages

CSK W Database Concepts Notes

Chapter 7 discusses database concepts, defining a database as an organized collection of interrelated data that supports multiple applications. It highlights the importance of Database Management Systems (DBMS) for managing data, ensuring accuracy, security, and integrity, while also detailing various data models and key concepts such as primary and foreign keys. The chapter emphasizes the advantages of using databases, including reduced redundancy, controlled inconsistency, and data sharing capabilities.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views8 pages

CSK W Database Concepts Notes

Chapter 7 discusses database concepts, defining a database as an organized collection of interrelated data that supports multiple applications. It highlights the importance of Database Management Systems (DBMS) for managing data, ensuring accuracy, security, and integrity, while also detailing various data models and key concepts such as primary and foreign keys. The chapter emphasizes the advantages of using databases, including reduced redundancy, controlled inconsistency, and data sharing capabilities.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Chapter 7

DATABASE CONCEPTS
A database system is basically a computer-based record keeping system.
The collection of data referred to as the database, contains the information about one
enterprise. It maintains the information that may be necessary to the decision-making
processes involved in the management of that organization.
A database is an organized collection of interrelated DATA/ INFORMATION that is
organized and stored together to serve multiple applications.

A database is a collection of data stored together to serve multiple applications; the data is
such stored so that it is independent of programs which use the data; a common controlled
approach is used in adding new data and in modifying and retrieving existing data within a
database. The intention of a is that the same collection of data should serve as many
applications as possible.
In Database, Data is organized into rows, columns and tables, and it is indexed to make it
easier to (accessed, managed, updated) find relevant information.
It works like a container which contains the various object like Tables, Queries, Reports etc.
in organized way.
WHY DO WE NEED DATABASE

 To manage large chunks of data: If the size of data increases into thousands of records, it
will simply create a problem to manage. Database can manage large amounts of data.
 Accuracy: Through validation rules in databases, data accuracy can be maintained.
 Easy of updating data: With the database, we can flexibly update the data according to
our convenience. Moreover, multiple people can also edit data at the same time.
 Security of data: With databases we have security groups and privileges to restrict access.
 Data integrity: In databases, we can be assured of accuracy and consistency of data due to
the built-in integrity checks and access controls
A DBMS gives us tools to:
➢ store data in a structured way.
➢ query the database (that is, ask questions about the data)
➢ sort and manipulate the data in the database
➢ validate the data entered and check for inconsistencies
➢ produce flexible reports, both on screen and on paper, that make it easy to comprehend the
information stored in the database.
Database Management System (DBMS)
To create and maintain a database on a computer, we need a database program, called a
Database management system, or DBMS. Database Management System is a software that
enables users to create a database, store, manage, update/modify and retrieve data from that
database by users or application programs. A DBMS refers to a software that is responsible
for storing, maintaining and utilizing database in an efficient way. A Database along with
DBMS software is called Database System.
Examples of popular DBMSs are MySQL, Paradox, Microsoft Access, Oracle, Microsoft SQL
Server, DB2 and Sybase.
The DBMS serves as an interface between the database and end users or application
programs. Retrieving data from a database through special type of commands is called
querying the database. In addition, users can modify the structure of the database itself
through a DBMS.
Some database management systems include a graphical user interface for users to create and
manage databases. Other database systems use a command line interface that requires users to
use programming commands to create and manage databases.
Databases are widely used in various fields.
Advantages of Database System(DBMS)
Databases reduce Redundancy
It removes duplication of data because data is kept at one place and all the application
refers to the centrally maintained database.
Database controls Inconsistency
When two copies of the same data do not agree with each other, then it is called Inconsistency.
By controlling redundancy, the inconsistency is also controlled.
Databases facilitate Sharing of Data
Data stored in the database can be shared among several users.
Database ensures Security
Data are protected against accidental or intentional disclosure to unauthorized person or
unauthorized modification.
Database maintains Integrity
It enforces certain integrity rules to ensure the validity or correctness of data.
For ex. A date cannot be like 31/31/2000.

Data Models in DBMS


Way of data representation Data model is a model or presentation which shows How data is
organized? or stored in the database.
A data is modeled by one of the following given-
 Relational Data Model: In this model data is organized into Relations or Tables (i.e.
Rows and Columns). A row in a table represents a relationship of data to each other and is
called a Tuple or Record. A column is called Attribute or Field.
 Network Data Model: In this model, data is represented by collection of records and
relationship among data is shown by Links.
 Hierarchical Data Model: In this model, Records are organized as Trees. Records at top
level are called Root record and this may contain multiple directly linked child records.
 Object Oriented Data Model: In this model, records are represented as an object. The
collection of similar types of objects is called class.

RELATIONAL DATABASE SYSTEM (RDBMS)

A relational database is a collective set of multiple data sets organized by tables, records/rows
and columns.
Relational database (RDBMS) establishes a well-defined relationship between database
tables. Tables communicate and share information, which facilitates data searchability,
organization and reporting. A Relational database use Structured Query Language (SQL),
which is a standard user application that provides an easy programming interface for database
interaction. In relational model, tables are called relations that store data for different rows
and columns. Each table can have multiple columns where each column name should be
unique. Each row in the table represents a related set of values.
The relational database Student Attendance along with the three relations (tables) STUDENT,
ATTENDANCE and GUARDIAN.

RELATIONAL DATABASE TERMS

Relation (Table) - A Relation or Table is Matrix-like structure arranged in Rows and


Columns.
It has the following properties:
• Atomicity: Each column assigned a unique name and must have atomic(indivisible)
value i.e. a value that cannot be further subdivided.
• No duplicity: No two rows of relation will be identical i.e. in any two rows value in
at least one column must be different.
• All items in a column are homogeneous i.e. same data type.
• Ordering of rows and columns is immaterial.

Attribute/ Field - Characteristic or parameters for which data are to be stored in a relation.
Simply stated, the columns of a relation are the attributes which are also referred to as
fields.
For example, EmpNo, Ename, Salary, Bonus and DeptId are attributes of relation EMPLOYEE.
Tuple / Entity / Record - Rows of a table are called Tuple or Record. Each In a table with
n columns, a tuple is a relationship between the n related values.
Domain - It is a collection of values from which the value is derived for a column. Usually,
a data type is used to specify domain for an attribute. For example, in EMPLOYEE
relation, the attribute EmpNo takes integer values and hence its domain is a set of integer
values. Similarly, the set of characters (strings/ Text) constitutes the domain of the attribute
Ename. For example,1001, Joseph, 60000, 467 and D05 are domains of EMPLOYEE
Degree of the relation - The number of attributes in a relation is called the Degree of the
relation. For example, the relation EMPLOYEE with four attributes is a relation of degree
Cardinality - The number of tuples in a relation is called the Cardinality of the relation.
For example, the cardinality of relation EMPLOYEE is 10 as there are 10 rows/ tuples in
the table.

Database Schema- Database Schema is the design of a database. It is the skeleton of the
database that represents the structure (table names and their fields/columns), the type of data
each column can hold, constraints on the data to be stored (if any), and the relationships among
the tables. Database schema is also called visual or logical architecture as it tells us how the
data are organized in a database.
Data Constraint- Sometimes we put certain restrictions or limitations on the type of data that
can be inserted in one or more columns of a table. This is done by specifying one or more
constraints on that column(s) while creating the tables. For example, one can define the
constraint that the column mobile number can only have non-negative integer values of exactly
10 digits.

Meta-data or Data Dictionary- The database schema along with various constraints on the data
are stored by DBMS in a database catalog or dictionary, called meta-data. A meta-data is data
about the data.
Query- A query is a request to a database for obtaining information in a desired way. Query
can be made to get data from one table or from a combination of tables. To retrieve or
manipulate data, the user needs to write queries using a query language(SQL).
Database Engine - Database engine is the underlying component or set of programs used by
DBMS to create databases and handle various queries for data retrieval and manipulation.

KEYS IN A DATABASE
The tuples within a relation must be distinct. It means no two tuples in a table should have
same value for all attributes. That is, there should be at least one attribute in which data are
distinct (unique) and not NULL (empty/blank). That way, we can uniquely distinguish each
tuple of a relation. So, relational data model imposes some restrictions or constraints on the
values of the attributes and how the contents of one relation be referred through another
relation. Key plays an important role in relational database; it is used for identifying unique
rows from table & establishes relationship among tables on need.

Types of keys in DBMS


Candidate Key – A relation can have one or more attributes that takes distinct values. Any
of these attributes can be used to uniquely identify the tuples in the relation. Such attributes
are called candidate keys as each of them are candidates for the primary key. (Admno,
CivilidNo, PassportNo)
Primary Key – Out of one or more candidate keys, the attribute chosen by the database
designer to uniquely identify the tuples in a relation is called the primary key of that
relation. A primary is a column or set of columns in a table that uniquely identifies tuples
(rows) in that table. (AdmNo). Primary key cannot take NULL (empty/blank) values.
Composite Primary Key - If no single attribute in a relation can uniquely distinguish the
tuples, then more than one attribute is taken together as primary key. Such primary key
consisting of more than one attribute is called Composite Primary key. (Class, Section and
RollNo)
Alternate Key – Out of all candidate keys, only one gets selected as primary key, remaining
keys are known as alternate or secondary keys. (CivilidNo, PassportNo)
Foreign Key – A foreign key is used to represent the relationship between two relations. A
foreign key is an attribute whose value is derived from the primary key of another relation.
This means that any attribute of a relation (referencing), which is used to refer contents
from another (referenced) relation, becomes foreign key if it refers to the primary key of
referenced relation. The referencing relation is called Foreign Relation. Foreign keys are
the columns of a table that points to the primary key of another table. They act as a cross-
reference between tables. (Admno of table RESULT). Foreign key can take NULL value
if it is not the primary key of the foreign table. The relation in which the referenced
primary key is defined is called primary relation or master relation.
Two foreign keys in the Student Attendance database are shown using schema diagram were
the foreign key is displayed as a directed arc (arrow) originating from it and ending at the
corresponding attribute of the primary key of the referenced table. The underlined attributes
make the primary key of that table.

You might also like