Sei sulla pagina 1di 9

CHAPTER 3

SYSTEM DESIGN

The term database refers to the collection of related records, and the software should be
referred to as the database management system or DBMS. Typically, for a given database, there is
a structural description of the type of facts held in that database. This description is known as a
database schema. The schema describes the objects that are represented in the database, and the
relationships among them. There are a number of different ways of organizing a schema, that is, of
modeling the database structure. These are known as database models (or data models). The model
that is in most common use today is the relational model.
A database is a collection of related data. A database has the following implicit properties.

 A database represents some aspects of the real world, sometimes called the mini-world.
Changes to the mini-world are reflected in the database.
 A database is a logical coherent collection of data with some inherent meaning. A random
assortment of data cannot be called database.
 A database is designed, built and populated with data for a specific purpose.
A database can be understood as a collection of related files. How those files are related
depends on the model used. Early models included the hierarchical model (where files are related
in a parent/child manner, with each child file having at most one parent file), and the network model
(where files are related as owners and members, similar to the network model except that each
member file can have more than one owner).

Three key terms are used extensively in relational database models: relations, attributes, and
domains. A relation is a table with columns and rows. The named columns of the relation are
called attributes, and the domain is the set of values the attributes are allowed to take. The basic
data structure of the relational model is the table, where information about a particular entity
represented in columns and rows (also called tuples). Thus, the "relation" in "relational database"
refers to the various tables in the database; a relation is a set of tuples. The columns enumerate the
various attributes of the entity and a row is an actual instance of the entity that is represented by
the relation.

Dept. of CSE, UVCE Dec 2019 Page 8


Online Voting System

An understanding of relational databases requires an understanding of some of the terms.

 A database is a collection of tables.


 Each table contains records, which are the horizontal rows in the table. These are also called
tuples.
 Each record contains fields, which are the vertical columns of the table. These are also
called attributes. An example would be a product record.
 Fields can be of many different types. There are many standard types, and each DBMS
(database management system, such as Oracle or MySQL) can also have their own specific types,
but generally they fall into at least three kinds - character, numeric and date. For example, a product
description would be a character field, a product release date would be a date field, and a product
quantity in stock would be a numeric field.
 The domain refers to the possible values each field can contain (it's sometimes called a field
specification). For example, a field entitled "marital status" may be limited to the values "Married"
and "Unmarried".
 A field is said to contain a null value when it contains nothing at all. Fields can create
complexities in calculations and have consequences for data accuracy. For this reason, many fields
are specifically set not to contain NULL values.
 A key is a logical way to access a record in a table. For example, in the product table, the
product id field could allow us to uniquely identify a record. A key that uniquely identifies a record
is called a primary key.
 An index is a physical mechanism that improves the performance of a database. Indexes
are often confused with keys. However, strictly speaking they are part of the physical structure,
while keys are part of the logical structure.
 A view is a virtual table made up of a subset of the actual tables.
 A one-to-one (1:1) relationship occurs where, for each instance of table A, only one instance
of table B exists, and vice-versa. For example, each vehicle registration is associated with only one
engine number, and vice-versa A one-to-many (1:m) relationship is where, for each instance of
table A, many instances of the table B exist, but for each instance of table B, only once instance of
table A exists.

Dept. of CSE, UVCE Dec 2019 Page 9


910111111
0
Online Voting System

 A one-to-many (1: m) relationship is where, for each instance of table A, many instances
of the table B exist, but for each instance of table B, only once instance of table A exists.
 A many to many (m: n) relationship occurs where, for each instance of table A, there are
many instances of table B, and for each instance of table B, there are many instances of the table
A.
 A mandatory relationship exists where, for each instance of table A, one or more instances
of table B must exist.
 An optional relationship is where, for each instance of table A, there may exist instances of
table B.
 Data integrity describes the accuracy, validity and consistency of data.

How is database approach different from file system?

In traditional file processing, each user defines and implements the files needed for specific
software application. For example, one user keeps the details of the supplier and customers. A
second user keeps the details of the goods and the third user keeps track of the bills and their
payments. This redundancy in defining and storing the data, results in wasted storage space and in
redundant efforts to maintain common update data. In database approach, a single repository of
data is maintained that is defined once and then accessed by various users. In file system, each
application is free to name data elements independently. In contrast, the names or labels is defined
once, and used repeatedly by quires, transaction, and application.

The main characteristics of database approach versus file system are:

 Self describing nature of a database system


 Insulation between programs and data, and data abstraction
 Sharing of data and multiuser transaction processing

Dept. of CSE, UVCE Dec 2019 Page 9


910111111
0
Online Voting System

DBMS Languages

 Data Definition Language (DDL) is the language used to specify the conceptual schema
of a database. In many DBMSs, the DDL is also used to define internal and external schemas
(views). Ex :
CREATE TABLE users (
id INTEGER PRIMARY KEY,
first name CHAR(50) NULL,

last name CHAR(75) NOT NULL,


dateofbirth DATE NULL
);
 In some DBMSs, separate storage definition language (SDL) and View Definition
Language (VDL) are used to define internal and external schemas.
 DBMS provide set of operations or a language called Data Manipulation language
(DML). These includes operations such as retrieval, insertion, deletion, and modification of data.

SELECT * FROM users WHERE age>21;

 SQL is the relational database language. It contains DDL, VDL, and DML.

Different Types Of databases

 Hierarchical database
 Network database
 Relational database
 Object Relational database

In this project we have used relational database which simplifies certain characteristics that make
a relation different from a file or a table. Relational databases have become a predominant choice
for the storage of information in new databases used for financial records, manufacturing and
logistical information, personnel data and much more. Relational databases have often replaced

Dept. of CSE, UVCE Dec 2019 Page 10


Online Voting System

legacy hierarchical databases and network databases because they are easier to understand and use,
even though they are much less efficient.

As computer power has increased, the inefficiencies of relational databases, which made them
impractical in earlier times, have been outweighed by their ease of use. However, relational
databases have been challenged by Object Databases, which were introduced in an attempt to
address the object-relational impedance mismatch in relational database, and XML databases.

The three leading commercial relational database vendors are Oracle, Microsoft, and IBM. The
three leading open source implementations are MySQL, PostgreSQL, and SQLite.

Relational Database Management system

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. Most popular
commercial and open source databases currently in use are based on the relational model.

A short definition of an RDBMS may be a DBMS in which data is stored in the form of tables and
the relationship among the data is also stored in the form of tables. E. F. Codd introduced the term
in his seminal paper "A Relational Model of Data for Large Shared Data Banks", published in
1970. In this paper and later papers he defined what he meant by relational. One well-known
definition of what constitutes a relational database system is Codd's 12 rules. However, many of
the early implementations of the relational model did not conform to all of Codd's rules, so the term
gradually came to describe a broader class of database systems. At a minimum, these systems:
presented the data to the user as relations (a presentation in tabular form, i.e. as a collection of
tables with each table consisting of a set of rows and columns, can satisfy this property) provided
relational operators to manipulate the data in tabular form.

The most popular definition of an RDBMS is a product that presents a view of data as a collection
of rows and columns, even if it is not based strictly upon relational theory. By this definition,
RDBMS products typically implement some but not all of Codd's 12 rules.

A relational database aims to achieve normalization of data. Normalization helps to reduce


redundancy and update anomalies. For normalization of data there are some normal forms like First

Dept. of CSE, UVCE Dec 2019 Page 11


Online Voting System

normal form, Second normal form, Third normal form, Boyce-Codd normal form, Fourth normal
form, and Fifth normal form.

Terms in Relational Database

Schema: A Relational Schema Definition (RSD) language that uses metadata of the relational
database to generate an implementation-neutral or implementation-specific format that represents
the precise database structure and data. The RSD language is a declarative description language
such that an RSD file can then be used offline in a disconnected environment to reconstruct and
use the database.

Tuples: A tuple in the relational model is formally defined as a finite function that maps field
names to values, rather than a sequence, so its components may appear in any order. Its purpose is
the same as in mathematics, that is, to indicate that an object consists of certain components, but
the components are identified by name instead of position, which often leads to a more user-
friendly and practical notation.

Entity: An entity may be an object with physical existence or it may be an object with conceptual
existences.

Attribute: Each entity has an attributes-the particular property describes it. Several type of
attribute occurs namely:
a. Composite versus Simple Attributes: Composite attributes can be divided into smaller
subparts, which represent more basic attributes with independent meaning. Attributes that are not
divisible are called simple or atomic attributes.

b. Single-Valued versus Multivalued Attribute: Most attribute have single value for a
particular entity, such attributes are called single-valued. In some cases an attribute can have a set
of values for the same entity such attributes called multivalued.

Dept. of CSE, UVCE Dec 2019 Page 12


Online Voting System

ER DIAGRAM NOTATIONS

Symbol Meaning

Entity

Weak Entity

Relationship

Identifying Relationship

Attribute

Key Attribute

Multivalued Attribute

Dept. of CSE, UVCE Dec 2019 Page 13


Online Voting System

... Composite Attribute

Derived Attribute

Cardinality Ratio 1:N for E1:E2 in R


EE E2
1 N

E1 E2 Total Participation of E2 in R

Components of RDBMS

Interface drivers - A user or application program initiates either schema modification or content
modification. These drivers are built on top of SQL. They provide methods to prepare statements
execute statements, fetch results, etc. Examples include DDL,

 DCL, DML, ODBC, and JDBC. Some vendors provide language-specific proprietary
interfaces. For example MySQL provides drivers for PHP, Python, etc.
 SQL engine - This component interprets and executes the SQL query. It comprises three
major components (compiler, optimizer, and execution engine).
 Transaction engine - Transactions are sequences of operations that read or write database
elements, which are grouped together.
 Relational engine - Relational objects such as Table, Index, and Referential integrity
constraints are implemented in this component.
 Storage engine - This component stores and retrieves data records. It also provides a
mechanism to store metadata and control information such as undo logs, redo logs, lock tables, etc.

Dept. of CSE, UVCE Dec 2019 Page 14


Online Voting System

Primary Task of RDBMS Package

 Database Development: used to define and organize the content, relationships, and structure
of the data needed to build a database.
 Database Interrogation: can access the data in a database for information retrieval and report
generation. End users can selectively retrieve and display information and produce printed reports
and documents.
 Database Maintenance: used to add, delete, update, correct, and protect the data in a
database.
 Application Development: used to develop prototypes of data entry screens, queries, forms,
reports, tables, and labels for a prototyped application. Or use 4GL or 4th Generation Language or
application generator to develop program codes.

Advantages of RDBMS

 Flexibility: Because programs and data are independent, programs do not have to be modified
when types of unrelated data are added to or deleted from the database, or when physical storage
changes. Fast response to information requests: Because data are integrated into a single database,
complex requests can be handled much more rapidly then if the data were located in separate, non-
integrated files. In many businesses, faster response means better customer service. Multiple
access: Database software allows data to be accessed in a variety of ways (such as through various
key fields) and often, by using several programming languages (both 3GL and nonprocedural 4GL
programs).

 Lower user training costs: Users often find it easier to learn such systems and training costs
may be reduced. Also, the total time taken to process requests may be shorter, which would increase
user productivity. Theoretically, all occurrences of data items need be stored only once, thereby
eliminating the storage of redundant data. System developers and database designers often use data
normalization to minimize data redundancy.

Dept. of CSE, UVCE Dec 2019 Page 15

Potrebbero piacerti anche