database concepts and relations
database concepts and relations
• Concepts of Database
• Database users
• Database administrators
A database A very large, well-structured and integrated collection of data that serves
the needs of multiple users within one or more organizations
Data are known facts that can be recorded and that have implicit meaning.
Data abstraction generally refers to the suppression of details of data organization and storage,
and the highlighting of the essential features for an improved understanding of data
A data model: a collection of concepts that can be used to describe the structure of a
database—provides the necessary means to achieve this abstraction. By structure of a database
we mean the data types, relationships, and constraints that apply to the data
An attribute represents some property of interest that further describes an entity, such as the
employee’s name or salary
Database schema
The description of a database is called the database schema, which is specified during database
design and is not expected to change frequently
Queries
Query – primary mechanism for retrieving information from a database,
consists of questions presented to the database in a predefined format – an
expression stored in a database having a unique name
Types of queries:
– Select query
– Action queries (Make-Table, Append, Update, Delete)
– Crosstab query
Example of query
select customer.customer-name
from customer
where customer.customer-id = 192-83-7465
• Sophisticated users interact with the system without writing programs. Instead, they form
their requests in a database query language. They submit each such query to a query
processor, whose function is to break down DML statements into instructions that the storage
manager understands. Analysts who submit queries to explore data in the database fall in this
category.
• Online analytical processing (OLAP) tools simplify analysts’ tasks by letting them view
summaries of data in different ways
• Specialized users – write specialized database applications that do not fit into the traditional
data processing framework
• Schema and physical-organization modification. The DBA carries out changes to the
schema and physical organization to reflect the changing needs of the organization, or to alter
the physical organization to improve performance.
• Granting of authorization for data access. By granting different types of authorization, the
database administrator can regulate which parts of the database various users can access. The
authorization information is kept in a special system structure that the database system
consults whenever someone attempts to access the data in the system.
•
• Routine maintenance. Examples of the database administrator’s routine maintenance
activities are: Periodically backing up the database, either onto tapes or onto remote servers,
to prevent loss of data in case of disasters such as flooding. Ensuring that enough free disk
space is available for normal operations, and upgrading disk space as required.
• Complexity: A database system creates additional complexity and requirements. The supply
and operation of a database management system with several users and databases is quite
costly and demanding.
• Costs: Through the use of a database system new costs are generated for the system itself but
also for additional hardware and the more complex handling of the system.
• Lower Efficiency: A database system is a multi-use software which is often less efficient
than specialised software which is produced and optimised exactly for one problem.
RELATIONAL DATABASE
RELATIONAL DATABASE
Each row in the table represents a collection of related data values. A row
represents a fact that typically corresponds to a real-world entity or relationship.
The table name and column names are used to help to interpret the meaning of
the values in each row
PRIMARY KEY constraint is a column or set of columns that uniquely identifies each row
in a table.
No primary-key value can appear in more than one row in the table.
To satisfy a PRIMARY KEY constraint, both of the following conditions must be true:
No column that is part of the primary key can contain a null.
A table can have only one primary key
Note that the column-level simply refers to the area in the CREATE TABLE statement where
the columns are defined. The table level refers to the last lines in the statement below where
the individual columns are defined
FOREIGN KEY Constraint Syntax: The syntax for defining a FOREIGN KEY
constraint requires a reference to the table and column in the parent table
FOREIGN KEY
Example SELECT title, year, genre FROM Film WHERE director = 'Steven
Spielberg' AND year > 1990