Sei sulla pagina 1di 19

ASSIGNMENT 1:

SUBMITTED FROM:
AFIFA MARYUM

REGISTRATION NO.:
FA17-BCE-038

SUBMITTED TO:
Sir Bicktash Ali Jahangir

SUBJECT:
Data Structures

DATE:
5th October, 2019.
QUESTION # 1:
List types of Database Management Systems and briefly
explain each:

 Database Management Systems:


A database is a collection of data or records. Database management systems are designed
to work with data. A database management system (DBMS) is a software system that uses a
standard method to store and organize data.
o Operations :
The data can be added, updated, deleted, or traversed using various standard algorithms
and queries.
o Types of Database Management Systems:
There are several types of database management systems. Here is a list of seven common
database management systems:
1. Hierarchical databases
2. Network databases
3. Relational databases
4. Object-oriented databases
5. Graph databases
6. ER model databases
7. Document databases
8. NoSQL databases

1. Hierarchical Databases:
In a hierarchical database management systems (hierarchical DBMSs) model, data is stored
in a parent-children relationship nodes. In a hierarchical database, besides actual data, records
also contain information about their groups of parent/child relationships.
In a hierarchical database model, data is organized into a tree like structure. The data is
stored in form of collection of fields where each field contains only one value. The records are
linked to each other via links into a parent-children relationship. In a hierarchical database
model, each child record has only one parent. A parent can have multiple children.
To retrieve a field’s data, we need to traverse through each tree until the record is found.

2. Network Databases:
Network database management systems (Network DBMSs) use a network structure to create
relationship between entities. Network databases are mainly used on a large digital computers.
Network databases are hierarchical databases but unlike hierarchical databases where one
node can have one parent only, a network node can have relationship with multiple entities. A
network database looks more like a cobweb or interconnected network of records.
In network databases, children are called “members” and parents are called “occupier”. The
difference between each child and member can have more than one parent.

The approval of the network data model is similar to a hierarchical data model. Data in a
network database is “organized in many-to-many relationships”.
3. Relational Databases:
In relational database management systems (RDBMS), the relationship between data is
relational and data is stored in tabular form of columns and rows. Each column if a table
represents an attribute and each row in a table represents a record. Each field in a table represents
a data value.
o Used to:
Structured Query Language (SQL) is a language used to query a RDBMS including
inserting, updating, deleting, and searching records.
o Works on:
Relational databases work on each table has a key field that uniquely indicates each row,
and that these key fields can be used to connect one table of data to another.

o Two reasons of relational database:


 Relational databases can be used with little or no training.
 Database entries can be modified without specify the entire body.
o Properties:
In the relational database we have to follow some properties which are
 It's values are atomic
 In each row is alone.
 Column values are of the same thing.
 Columns is undistinguished.
 Sequence of rows is insignificant.
 Each column has a common name.
4. Object-Oriented Model:
The object-oriented database derivation is the integrity of object-oriented programming
language systems and consistent systems. The power of the object-oriented databases comes
from the cyclical treatment of both consistent data, as found in databases, and transient data, as
found in executing programs.

Object-oriented databases use small, recyclable separated of software called “objects”.


The objects themselves are stored in the object-oriented database. Each object contains of two
elements:
 Piece of data (e.g., sound, video, text, or graphics).
 Instructions, or software programs called methods, for what to do with the data.
o Advantages of Object-oriented databases:
The advantage of object-oriented databases are compelling. The ability to mix and match
reusable objects provides incredible multimedia capability.
o Disadvantage of Object-oriented databases:
 Object-oriented databases have these disadvantages.
 Object-oriented database are more expensive to develop.
 In the Most organizations are unwilling to abandon and convert from those databases.

5. Graph Databases:
Graph Databases are “NoSQL databases”.
o Used to:
Use a graph structure for “sematic queries’.
o Stored in:
The data is stored in form of nodes, edges, and properties.
In a graph database:
 A Node represent an “entity or instance” such as customer, person, or a car. A node
is equivalent to a record in a relational database system.
 An Edge in a graph database represents a “relationship” that connects nodes.
Properties are additional information added to the nodes.

6. ER Model Databases :
An ER model is typically implemented as a database. In a simple relational database
implementation
 Each row of a table represents one instance of an entity type
 Each field in a table represents an attribute type.
In a relational database a relationship between entities is implemented by storing the primary
key of one entity as a “pointer or foreign key" in the table of another entity.

7. Document Databases:
Document databases (Document DB) are also “NoSQL database” that store data in form of
documents.
Each document represents the data, its relationship between other data elements, and
attributes of data. Document database store data in a key value form.
Document DB has become popular recently due to their document storage and NoSQL
properties. NoSQL data storage provide faster mechanism to store and search documents.

8. NoSQL Databases:
NoSQL databases are the databases that do not use SQL as their primary data access
language.
NoSQL database do not have predefined schemas, which makes NoSQL databases a perfect
candidate of rapid changing development environments. NoSQL allows developers to make
changes on the fly without affecting applications.
o Characterized in :
NoSQL databases can be categorized in the following five major categories:
 Column, Document, Graph, Key-value and Object databases.
o Ten NoSQL Databases:
Here is a list of 10 popular NoSQL databases:
 Cosmos DB
 ArangoDB
 Couchbase Server
 CouchDB
 Amazon DocumentDB
 MongoDB, CouchBase
 Elasticsearch
 Informix
 SAP HANA
 Neo4j

Question # 2:
List types of databases and briefly explain each:

 Database :
“A database is an electronic system that allows data to be easily accessed, manipulated
and updated.”
There are following types of databases available in the market:

1. Centralized database.
2. Distributed database.
3. Personal database.
4. End-user database.
5. Commercial database.
6. NoSQL database.
7. Operational database.
8. Relational database.
9. Cloud database.
10. Object-oriented database.
11. Graph database.
1. Centralized Database:
The information (data) is stored at a centralized location and the users from different
locations can access this data. This type of database contains application procedures that help the
users to access the data even from a remote location.
Various kinds of authentication procedures are applied for the verification and validation of
end users, likewise, a registration number is provided by the application procedures which keeps
a track and record of data usage. The local area office handles this thing.
2. Distributed Database:
The distributed database has contributions from the common database as well as the
information captured by local computers also. The data is not at one place and is distributed at
various sites of an organization. These sites are connected to each other with the help of
communication links which helps them to access the distributed data easily.
a distributed database as a one in which various portions of a database are stored in multiple
different locations(physical) along with the application procedures which are replicated and
distributed among various points in a network.
o Types of Distributed database:
There are two kinds of distributed database:
 Homogenous distributed database
 Heterogeneous distributed database
The databases which have same underlying hardware and run over same operating systems
and application procedures are known as “Homogeneous DDB”.
The operating systems, underlying hardware as well as application procedures can be
different at various sites of a DDB which is known as “Heterogeneous DDB”.

3. Personal Database:
Data is collected and stored on personal computers which is small and easily manageable.
The data is generally used by the same department of an organization and is accessed by a small
group of people
4. End User Database:
The end user is usually not concerned about the transaction or operations done at various
levels and is only aware of the product which may be a software or an application. Therefore,
this is a shared database which is specifically designed for the end user, just like different levels’
managers. Summary of whole information is collected in this database.
5. Commercial Database:
These are the paid versions of the huge databases designed uniquely for the users who want
to access the information for help. These databases are “subject specific”, and one cannot afford
to maintain such a huge information. Access to such databases is provided through commercial
links.

6. NoSQL Database:
These are used for large sets of distributed data. There are some big data performance issues
which are effectively handled by relational databases, such kind of issues are easily managed by
NoSQL databases. There are very efficient in analyzing large size unstructured data that may be
stored at multiple virtual servers of the cloud.

7. Operational Database:
Information related to operations of an enterprise is stored inside this database. Functional
lines like marketing, employee relations, customer service etc. require such kind of databases.

8. Relational Databases:
These databases are categorized by a set of tables where data gets fit into a pre-defined
category. The table consists of rows and columns.
 Column has an entry for data for a specific category
 Rows contains instance for that data defined according to the category.
The Structured Query Language (SQL) is the standard user and application program interface
for a relational database.

9. Cloud Databases:
A cloud database is a database that has been optimized or built for such a virtualized
environment.
o Advantages:
There are various advantages of a cloud database:
 The ability to pay for storage capacity and bandwidth on a per-user basis, and
they provide scalability on demand, along with high availability.
 A cloud database also gives enterprises the opportunity to support business
applications in a software-as-a-service deployment.
10. Object-Oriented Databases:
An object-oriented database is a collection of object-oriented programming and relational
database. There are various items which are created using object-oriented programming
languages like C++, Java which can be stored in relational databases, but object-oriented
databases are well-suited for those items.
An object-oriented database is organized around objects rather than actions, and data rather
than logic.

11. Graph Databases:


The graph is a collection of nodes and edges.
 Each node is used to represent an entity.
 Each edge describes the relationship between entities.
A graph-oriented database, or graph database, is a type of NoSQL database that uses graph
theory to store, map and query relationships.
Graph databases are basically used for analyzing interconnections.
Question # 3:
List the types of database models and explain each briefly:

 Database Models:
A database model shows the logical structure of a database, including the relationships and
constraints that determine how data can be stored and accessed.
o Types of database models:
There are many kinds of data models. Some of the most common ones include:

1. Hierarchical database model


2. Relational model
3. Network model
4. Object-oriented database model
5. Object relational model
6. Entity-relationship model
7. Document model
Different models apply to different stages of the database design process:
 “High-level conceptual data models” are best for mapping out relationships
between data in ways that people perceive that data.
 “Record-based logical models” more closely reflect ways that the data is stored
on the server.
1. Relational model:
The relational model sorts data into tables, also known as “relations”, each of which
consists of columns and rows.
Each column lists an “attribute of the entity” the attributes in a relation are called a
“domain”. A particular attribute or combination of attributes is chosen as a primary key that can
be referred to in other tables, when it’s called a “foreign key”.
Each row, also called a “tuple”, includes data about a specific instance of the entity in
question.
o Relationship between tables:
The model also accounts for the types of relationships between those tables, including “one-
to-one, one-to-many, and many-to-many relationships”.

2. Hierarchical model:
The hierarchical model organizes data into a tree-like structure.
Where each record has a single parent or root. Sibling records are sorted in a particular
order. That order is used as the physical order for storing the database. This model is good for
describing many real-world relationships.

3. Network model:
The network model builds on the hierarchical model by allowing “many-to-many
relationships” between linked records, implying multiple parent records. Based on mathematical
set theory, the model is constructed with sets of related records.
Each set consists of one owner or parent record and one or more member or child
records. A record can be a member or child in multiple sets, allowing this model to “convey
complex relationships”.

4. Object-oriented database model:


This model defines a database as a collection of objects, or reusable software elements,
with associated features and methods. There are several kinds of object-oriented databases:
 A “multimedia database” incorporates media, such as images, that could not be stored
in a relational database.
 A “hypertext database” allows any object to link to any other object. It’s useful for
organizing lots of disparate data, but it’s not ideal for numerical analysis.
The object-oriented database model is the best known “post-relational database
model”, since it incorporates tables, but isn’t limited to tables. Such models are also known as
“hybrid database models”.

5. Object-relational model:
This hybrid database model combines the simplicity of the relational model with some of
the advanced functionality of the object-oriented database model. In essence, it allows designers
to incorporate objects into the familiar table structure.

6. Entity-relationship model:
This model captures the relationships between real-world entities much like the network
model, but it isn’t as directly tied to the physical structure of the database. Instead, it’s often used
for designing a database conceptually.
A common form of the ER diagram is the “star schema”, in which a central fact table
connects to multiple dimensional tables.

7. Document model:
The document model, which is designed for storing and managing documents or semi
structured data, rather than atomic data.

Question # 4:
SQL statements are divided into how many categories? Explain
each briefly:

 Types of SQL Commands:


The basic categories of commands used in SQL to perform various functions. These
functions include building database objects, manipulating objects, populating database tables
with data, “updating” existing data in tables, “deleting” data, “performing” database queries,
“controlling” database access, and overall database “administration”.
The main categories are:
1. DDL (Data Definition Language)
2. DML (Data Manipulation Language)
3. DQL (Data Query Language)
4. DCL (Data Control Language)
5. Data administration commands
6. Transactional control commands

1. Data defining language:


Data Definition Language, DDL, is the part of SQL that allows a database user to create and
restructure database objects, such as the creation or the deletion of a table.
Some of the most fundamental “DDL commands” discussed during following hours include
the following:
 Create table
 Alter table
 Drop table
 Create index
 Alter index
 Drop index
 Create view
 Drop view

2. Data Manipulation Language:


Data Manipulation Language, DML, is the part of SQL used to manipulate data within
objects of a relational database.
There are three basic DML commands:
 Insert
 Update
 Delete

3. Data query language:


Data Query Language (DQL) is the most concentrated focus of SQL for modern relational
database users. The base command is as follows:
 Select:
This command, accompanied by many options and clauses, is used to compose queries
against a relational database. Queries, from simple to complex, from vague to specific, can be
easily created.
A query is an inquiry to the database for information. A query is usually issued to the
database through an application interface or via a command line prompt.

4. Data Control Language:


Data control commands in SQL allow you to control access to data within the database.
These DCL commands are normally used to “create objects” related to user access and also
control the distribution of privileges among users.
Some data control commands are as follows:
 Alter password
 Grant
 Revoke
 Create synonym

5. Data Administration Commands:


Data administration commands allow the user to “perform audits and perform analyses on
operations” within the database. They can also be used to help analyze system performance.
Two general data administration commands are as follows:
 Start audit
 Stop audit
Do not get data administration confused with database administration. Database
administration is the overall “administration of a database”, which envelops the use of all
levels of commands. Database administration is much more specific to each SQL
implementation than are those core commands of the SQL language.

6. Transactional Control Commands:


There are commands that allow the user to “manage database transactions”.
 Commit (saves database transections)
 Rollback (undoes database transections)
 Save point (create points within the group o transections in which to rollback)
 Set transection (places a name on a transection)
Question # 5:
Write E.F Cod’s 12 rules for relational databases in your own
words:

E.F rules can be applied on any database system that manages stored data using only its
relational capabilities. This is a foundation rule, which acts as a base for all the other rules.

 Rule 1: Information Rule:


The data stored in a database, may it be user data or metadata, must be a value of some table
cell. Everything in a database must be stored in a table format.

 Rule 2: Guaranteed Access Rule:


Every single value is guaranteed to be accessible logically with a combination of table-name,
primary-key (row value), and attribute-name (column value). Pointers, cannot be used to access
data.

 Rule 3: Systematic Treatment of NULL Values:


The NULL values in a database must be given a systematic and uniform treatment. This is a
very important rule because a NULL can be interpreted as one the following:
“Data is missing, data is not known, or data is not applicable”.

 Rule 4: Active Online Catalog:


The structure description of the entire database must be stored in an online catalog, known as
“data dictionary”, which can be accessed by authorized users. Users can use the same query
language to access the catalog which they use to access the database itself.

 Rule 5: Comprehensive Data Sub-Language Rule:


A database can only be accessed using a language having linear syntax that supports data
“definition, data manipulation, and transaction management operations”. If the database allows
access to data without any help of this language, then it is considered as a “violation”.
 Rule 6: View Updating Rule:
All the views of a database, which can theoretically be updated, must also be “updatable by
the system”.

 Rule 7: High-Level Insert, Update, and Delete Rule:


A database must support high-level “insertion, updation, and deletion”. This must not be
limited to a single row, that is, it must also support “union, intersection and minus operations”
to yield sets of data records.

 Rule 8: Physical Data Independence:


The data stored in a database must be independent of the applications that access the
database. Any change in the physical structure of a database must not have any impact on how
the data is being accessed by external applications.

 Rule 9: Logical Data Independence:


The logical data in a database must be independent of its application. Any change in logical
data must not affect the applications using it.

 Rule 10: Integrity Independence:


A database must be independent of the application that uses it. All its integrity constraints
can be independently modified without the need of any change in the application.

 Rule 11: Distribution Independence:


The end-user must not be able to see that the data is distributed over various locations. Users
should always get the impression that the data is located at one site only.

 Rule 12: Non-Subversion Rule:


If a system has an interface that provides access to low-level records, then the interface must
not be able to subvert the system and bypass security and integrity constraints.

Potrebbero piacerti anche