0 ratings0% found this document useful (0 votes) 22 views5 pagesCSC232 Database Design and Management
DBMS 2nd year unizik csc 232
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
cscas:
: DATABASE DESIGN AND MANAGEMENT (2 UNITS)
Introduction to databa:
Concept of relational databas
relationship model.
DBMS functions
Database architecture
Data independence,
Features and concepts
ficld, tables, queries, forms, reports.
Design and development of database applications using a current DBMS
e.g. MS-Access, create, modify and query a database, :
ystems:
nd design
inciples using entity
Introduction to database systems -
Database: Database is a collection of inter-related data which helps in efficient retrieval, insertion and deletion
of data from database and organizes the data in the form of tables, views, schemas, reports etc. For Example,
university database organizes the data about students, faculty, and admin staff etc. which helps in efficient
retrieval, insertion and deletion of data from it.
Why Study Databases?
‘The main purpose of database systems is
To manage the data,
© Database systems give a set of tools for storing, searching and managing this information
DBMS stands for Database Management System. We can break it like this DBMS = Database + Management
System. Database is a collection of data and Management System is @ set of programs to store and retrieve those
data. Based on this we can define DBMS like this: DBMS is a software used to create and manage database.
Database Management System: The software which is used to manage database. Examples are: MySQL, Oracle,
Microsoft Access etc. are popular commercial DBMS used in different applications. DBMS allows users the
following tasks:
DBMS allows users the following tasks
Data Definition: It helps in creation, modific
data in database.
Data Updating: It helps in insertion, modification and deletion of'the actual data in the database.
Data Retrieval: It helps in retrieval of data from the database which can be used by applications for various
purposes.
User Administration: It helps in registering and monitoring users, enforcing data security, monitorin,
performance, maintaining data integrity, dealing with concurrency control and recovering information
corrupted by unexpected failure.
and removal of definitions that define the organization of
Some Important Terminologies
1. Database: Database is a collection of inter-related data which helps in efficient retrieval, insertion
deletion of data from database and organizes the data in the form of tables, views, Schems, Feports ete,
Example, university database organizes the data about students, faculty, and admin staif ete: Which hep? |
efficient retrieval, insertion and deletion of data from it, ° , ; a
DL is short name of Data Definition Language, whic! i o schemas and deseri
a Dncidata should reside inthe databases TS! Which deals with database sche Prone
3, CREATE: to create a database and its obj
\
ects 2 qi index, views, store procedtes function, and tg
alsa qitey ) Gams fel a) |
Scanned with CamScanner4, ALTER: alters the structure of the ex
5, DROP: delete objects from the database
6. TRUNCATE: remove all records from a table, including all spaces allocated for the records are removed
7, COMMENT: add comments to the data dictionary
$8, RENAME: rename an object
9, DML is short name of Data Manipulation Language which deals with data manipulation and includes most
common SQL statements such SELECT, INSERT, UPDATE, DELETE, etc., and it is used to store, modify,
retrieve, delete and update data in a database,
«SELECT: retrieve data from a database
«INSERT: insert data into a table
+ UPDATE: updates existing data within a table
* DELETE: Delete all records from a database table
+ MERGE: UPSERT operation (insert or update)
* CALL: call a PL/SQL or Java subprogram
EXPLAIN PLAN: interpretation of the data access path
LOCK TABLE: concurrency Control
ng database
‘What a Relational Database Is
‘A Relational database management system (RDBMS) is a database management system (DBMS) that is based
on the relational model as introduced by E. F. Codd. A relational database organizes data into tables which can
be linked—or related—based on data common to each. This capability enables you to retrieve an entirely new
table from data in one or more tables with a single query. It is a type of database that stores and provides access
to data that are related to one another. Relational databases are based on the relational model, which represents
data in tables. In a relational database, each row in the table is a record with a unique ID called the primary key.
The columns of the table hold attributes of the data, and each record usually has a value for each attribute, making
it easy to establish the relationships among data points. - :
RDBMS stands for Relational Database Management System. RDBMS is the basis for SQL, and for all modern.
database systems like MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access.
What is a table?
‘The data in an RDBMS is stored in database objects which are called as tables. This table is basically a collection
of related data entries and it consists of numerous columns and rows.
Remember, a table is the most common and simplest form of data storage in a relational database. The following
program is an example of a student table —
Sumame Other Names Reg Level Address
‘Number
Okoye Rita 2017001 | 200 Ifite-Awka
Igwe John 2017005 | 200 Agu-Awka
Scanned with CamScanner/ What is a field?
Every table is broken up into smaller entities called fields, The fields in the student table consist of Sumame,
Other names, Department, Reg No., Level and Addree,
A field is a column in a table that is designed to maintain specific information about every record in the table,
‘What is a Record?
A record is also called as a row of data is each individual entry that exists in a table. For example, there are 7
records in the above CUSTOMERS table. Following is a single row of data or record in the student table — A
record is a horizontal entity in a table.
What is a column?
A column is a vertical entity in a table that contains all information associated with a specific field in a table.
For example, a column in the student table is ADDRESS, which represents location description and would be as
shown below —
fite-Awka
Agu-Awka
What is a NULL value?
ANULL value in a table is a value in a field that appears to be blank, which means a field with a NULL value
isa field with no value. It is very important to understand that a NULL value is different than a zero value or a
field that contains spaces. A field with a NULL value is the one that has been left blank during a record creation.
SQL Constraints
Constraints are the rules enforced on data columns on a table. These are used to limit the type of data that can
g0 into a table. This ensures the accuracy and reliability of the data in the database.
Constraints can either be column level or table level. Column level constraints are applied only to one column
whereas, table level constraints are applied to the entire table.
Following are some of the most commonly used constraints available in SQL —
+ NOTNULL Constraint
insures that a column cannot have a NULL value.
DEFAULT Constraint ~ Provides a default value for a column when none is specified.
+ UNIQUE Constraint — Ensures that all the values in a column are different.
PRIMARY Key ~ Uniquely identifies each row/record in a database table.
FOREIGN Key ~ Uniquely identifies a row/tecord in any another database table.
CHECK Constraint Ensures that all values in a column satisfy certain conditions.
+ INDE:
Used to create and retrieve data from the database very quickly.
Data Integrity
The following categories of data integrity exist with each ROBMS —
Scanned with CamScanner+ Entity Integrity ~ There a
¢ no duplicate rows in a table.
Domain Integrity ~ Enforees valid entries for a given column by restricting the type, the format, or the
range of valu
+ Referential integrity — Rows cannot be deleted, which are used by other recor
+ User-Defined Integrity ~
referential integrity.
nforces some specific busine
rules that do not fall into entity, domain or
Database Normali
Database normalization is the proc
normalization process ~
s of efficiently organizing data in a database. There are two reasons of this
+ Eliminating redundant data, for example, storing the same data in more than one table.
+ Ensuring data dependencies make sense.
Both these reasons are worthy goals as they reduce the amount of space a database consumes and ensures that
data is logically stored, Normalization consists of a scries of guidelines that help guide you in creating a good
database structure.
Nommalization guidelines are divided into normal forms; think of a form as the format or the way a database
structure is laid out. The aim of normal forms is to organize the database structure, so that it complies with the
rules of first normal form, then second normal form and finally the third normal form.
It is your choice to take it further and go to the fourth normal form, fifth normal form and so on, but in general,
the third normal form is more than cnough.
+ First Normal Form (INF)
+ Second Normal Form (2NF)
+ Third Normal Form (3NF)
How Relational Database Are Structured
‘The relational database model uses tables, which were an intuitive, efficient, and flexible way to store and access
structured information. To ensure that data is always rate and accessible, relational databases follow certain
integrity rules, For example, an integrity rule can specify that duplicate rows are not allowed in a table in order
to eliminate the potential for crroncous information entering the database,
Ben
s of Relational Databases.
Data Consistency
he relational model is the best at maintaining data consistency across applications and database cop,
(called instances), For example, when a customer deposits money at un ATM and then looks at the aecoys
balance on a mobile phone, the customer expects to see that deposit reflected immediately in an updated aeogy
balance. Relational databases ex s kind of data consistency, ensuring that multiple instances of a day,
have the same data all the time, , se
Scanned with CamScanner‘Commitment and Atomicity
Relational databases handle business rules and policies at a very granular level, with strict policies
about commitment (that is, making a change to the database permanent), For example, consider an inventory
database that tracks three parts that are always used together. When one part is pulled from inventory, the other
two must also be pulled. If one of the three parts isn’t available, none of the parts should be pulled—all three parts
must be available before the database makes any commitment. A relational database won't commit for one part
‘until it knows it can commit for all three. This multifaceted commitment capability is called atomicity. Atomicity
is the key to keeping data accurate in the database and ensuring that it is compliant with the rules, regulations,
and policies of the business.
Stored Procedures and Relational Databases
Data access involves many repetitive actions. For example, a simple query to get information from a data table
may need to be repeated hundreds or thousands of times to produce the desired result. These data access functions
require some type of code to access the database. Application developers don’t want to write new code for these
functions in each new application, Luckily, relational databases allow stored procedures, which are blocks of code
that can be accessed with a simple application call, For example, a single stored procedure can provide consistent
record tagging for users of multiple applications. Stored procedures can also help developers ensure that certain
data functions in the application are implemented in a specific way.
Databast Locking and Concurrency
Conflicts can arise in a database when multiple users or applications attempt to change the same data at the same
time. Locking and concurrency techniques reduce the potential for conflicts while maintaining the integrity of the
data.
——
Locking prevents other users and applications from accessing data ‘while it is being updated. In some databases,
locking applies to the entire table, which creates a negative impact on application performance. Other databases,
such as Oracle relational databases, apply locks at the record level, leaving the other records within the table
available, helping ensure better application performance.
Concurrency manages the activity when multiple users or applications invoke queries at the same time on the
same database, This capability provides the right access to users and applications according to policies defined
for data control.
Entity Relationship Model
This is a graphical approach to database design. It is a high-level data model that defines data elemenis and their
relationship for a specific software system.
Scanned with CamScanner