Industrial Training




Data Updating Facilities

Introduction
We have seen that a Data Model comprises the Data Description facilities (through the DDL) and the Data Manipulation facilities (through the DML). As explained in Chapter 2, a DDL is used to specify the schema for the database - its entities can be created, and its attributes, domains, and keys can be defined through language statements of the DDL. The structure of the entities is defined, but not the data within them. DDL thus supports only the declaration of the database structure.


data-updating-facilities-1

Data definition and manipulation facilities of a data model

In this chapter, we shall see how the second component, the DML, can be used to support the manipulation or processing of the data within the database structures defined by the DDL. Manipulation begins with the placement of data values into the structures. When the data values have been stored, the end user should be able to get at the data. The user would have a specific purpose for the piece of data he/she wants to get - perhaps to display the data on the screen in order to know the value, to write the data to an output report file to be printed, to use the data as part of a computation, or to make changes to it.

3.2 Data Manipulation Facilities
The manipulative part of the relational model comprises the DML which contains commands to put new data, delete and modify the existing data. These facilities of a Database Management System are known as Updating Facilities or Data Update Functions, because unlike the DDL which executes operations on the structure of the database’s entities, the DML performs operations on the data within those structures. Given a relation declared in a database schema, the main update functions of a DML are:

1. To insert or add new tuples into a particular relation

2. To delete or erase existing tuples from a relation

3. To modify or change data in an existing relation



Examples:
1. To insert a new tuple

The company receives a new customer. To ensure that its database is up-to-date, a new tuple containing the data that is normally kept about customers must be created and inserted. This is thus a way to load data into the database.


data-updating-facilities-2

A user (through an application program) chooses a relation, say the Customer relation. It has 4 attributes, and 3 existing tuples.

Step 2. The user prepares a new tuple of the relation (database) on the screen or in the computer's memory

Step 3. Through a DML command specified by the user, the DBMS puts a new tuple into the relation of the database according to the definition of the DDL to place data in that row. The Customer relation now has 4 tuples.



To delete an existing tuple An existing customer no longer does any business with the company, in which case, the corresponding tuple must be erased from the customer database.

Step1. The user chooses the relation, Customer.

Step 2. The user issues a DML command to retrieve the tuple to be deleted.

Step 3. The DBMS deletes the tuple from the relation.

The updated relation now has one less tuple.


data-updating-facilities-3

3. To modify an existing tuple An existing customer has moved to a new location (or that the current value in the data field is incorrect). He has new values for the city and telephone number. These new values must replace the previous value

Step1. The user chooses the relation, Customer.

Step 2.The user issues a DML retrieval command to get the tuple to be changed.

Step 3. The user modifies one or more data items

Step 4. The DBMS inserts the modified tuple into the relation.


data-updating-facilities-4

wo types of modifications are normally done:

1. Assigned - an assigned modification entails the simple assignment of a new value into the data field (as in the example above)

2. Computed - in computed modification, the existing value is retrieved, then some computation is done on it before restoring the updated value into the field (e.g. all Cphone numbers beginning with the digit 5 are to be changed to begin with the digits 58).

Additionally, it is possible to insert new tuples into a relation with one or more unknown values. Such unknown values, called NULL-VALUEs, are denoted by ?

To insert a tuple with unknown values
A new customer, Deen, is created. But Deen has yet to notify the company of his living place and telephone number. At a later point in time, when Deen has confirmed his living place and telephone, the tuple with his details can be modified by replacing the ?s with the appropriate values.


data-updating-facilities-5

At this stage, we only mention these update functions via logical definitions such as above. In the implementation of DMLs, there exist many RDBMS systems with wide variations in the actual language notations . We shall not discuss these update functions of concrete data manipulation languages yet.

User Interface
Users
Now that data values are stored in the database, we shall look at how users can communicate with the database system in order to access the data for further manipulation. First let us take a look at the characteristics of users and the processing and inquiries they tend to make.

There are essentially two types of users:

End Users: End users are those who directly use the information obtained from the database. They are likely to be computer novices or neophytes, using the computer system as an extended tool to assist them with their main job function (which may be to do financial analysis or to register students). End users may feel uncomfortable with computers or may simply be not interested in the technical details, but their

lack of knowledge should not be a handicap to the main job which they have to do. End users should be able to retrieve the data in the database in any manner they wish, which are likely to be in the form of:

casual, unanticipated or ad hoc queries which often must be satisfied within a short space of time, if not immediately (e.g. "How many students over the age of 30 are taught by professors below the age of 30?")

standard or predictable queries that need to be executed on a routine basis (e.g. "Produce the monthly cash flow analysis report")



. Database specialists:

Specialist users are knowledgeable about the technicalities of the database management system. They are likely to hold positions such as the database administrator, database programmer, database support person, systems analyst or the like. They are likely to be responsible for tasks like:

defining the database schema

handling complex queries, reports or tailored software applications

defining data security and ensuring data integrity

performing database backups and recoveries

monitoring database performance




Hi I am Pluto.