Vous êtes sur la page 1sur 10

Lecture Notes on Database Management System

Data:
data is anything in a form suitable for use with a computer. Data is often distinguished from programs. A program is a set of instructions that detail a task for the computer to perform. In this sense, data is thus everything that is not program code. Data is represented/organized in a dbms in the form of Schemas, tables, rows and columns One DBMS may have multiple Schemas One Schema may have multiple tables One table may have multiple rows One row may have multiple columns If these tables are related to one another it forms a RDBMS - A Relational DBMS Field: data held on a person can be split into a number of fields; these could be: ID; first name; second name; address; town; post code; date-of-birth; etc. Record: a collection of all the fields above on one person. File: a collection of records; a payroll file will contain a record for each person on the payroll. Database: may contain many different files, structured in such a way that information can be obtained from one or all of them at once Data may be numerical data which may be integers or floating point numbers, and nonnumerical data such as characters, date and etc. 89 87 92 The above numbers may be anything: It may be distance in kms or amount in rupees or no of days or marks in each subject etc.,

Need:
The reality is that even though executives may not require this knowledge for their dayto-day tasks, understanding how data interrelate only increases their ability to link information, performance, and strategy more effectively. By identifying how business processes and operations link to data, organizations can turn that data into information that can be used for decision making purposes. For instance, many organizations use different sources of information for planning, trends analysis, and managing

performance. Consequently, the value of the information is only as good as its point of entry into the system. This means that when decision makers across the organization are analyzing different numbers in order to make decisions that will affect the company, and the information does not add up the blame for why these numbers are invalid lies at the point of entry of the information into the operational systems. Data entry errors and processing inefficiencies are but a few causes of error-prone data that end up being used to drive an organizations decisions. Although seemingly inconsequential, small discrepancies can make a significant difference to a companys bottom line. However, if data quality control initiatives exist
Use of data A database is a collection of data that is related to a particular topic or purpose. As an example, employee records in a filing cabinet, a collection of sales leads in

a notebook, are examples of collections of data or databases.particularly with respect to the data that is used to drive decision making, the picture changes as a broader and more correct view of the information becomes available. Within business intelligence applications the idea of bringing in the right data at the right time becomes critical to reporting and analysis applications. Without accurate information, the data being analyzed and reported on becomes meaningless. A general overview of how data integration works will provide an outline for decision makers who want a better understanding of how information is gathered to help with the decision making process. User Types When considering users of a Database system, there are three broad classes to consider: 1. the application programmer, responsible for writing programs in some high-level language such as COBOL, C++, etc. 2. the end-user, who accesses the database via a query language 3. the database administrator (DBA), who controls all operations on the database Database Architecture DBMSs do not all conform to the same architecture.
y y y y

The three-level architecture forms the basis of modern database architectures. this is in agreement with the ANSI/SPARC study group on Database Management Systems. ANSI/SPARC is the American National Standards Institute/Standard Planning and Requirement Committee). The architecture for DBMSs is divided into three general levels:

y y y

external conceptual internal

Three level database architecture

Figure 1: Three level architecture 1. the external level : concerned with the way individual users see the data 2. the conceptual level : can be regarded as a community user view a formal description of data of interest to the organisation, independent of any storage considerations. 3. the internal level : concerned with the way in which the data is actually stored

Figure : How the three level architecture works External View A user is anyone who needs to access some portion of the data. They may range from application programmers to casual users with adhoc queries. Each user has a language at his/her disposal. The application programmer may use a high level language ( e.g. COBOL) while the casual user will probably use a query language. Regardless of the language used, it will include a data sublanguage DSL which is that subset of the language which is concerned with storage and retrieval of information in the database and may or may not be apparent to the user. A DSL is a combination of two languages:
y y

a data definition language (DDL) - provides for the definition or description of database objects a data manipulation language (DML) - supports the manipulation or processing of database objects.

Each user sees the data in terms of an external view: Defined by an external schema, consisting basically of descriptions of each of the various types of external record in that external view, and also a definition of the mapping between the external schema and the underlying conceptual schema. Conceptual View
y y

An abstract representation of the entire information content of the database. It is in general a view of the data as it actually is, that is, it is a `model' of the `realworld'.

y y y y y

It consists of multiple occurrences of multiple types of conceptual record, defined in the conceptual schema. To achieve data independence, the definitions of conceptual records must involve information content only. storage structure is ignored access strategy is ignored In addition to definitions, the conceptual schema contains authorisation and validation procedures.

Internal View The internal view is a low-level representation of the entire database consisting of multiple occurrences of multiple types of internal (stored) records. It is however at one remove from the physical level since it does not deal in terms of physical records or blocks nor with any device specific constraints such as cylinder or track sizes. Details of mapping to physical storage is highly implementation specific and are not expressed in the three-level architecture. The internal view described by the internal schema:
y y y y

defines the various types of stored record what indices exist how stored fields are represented what physical sequence the stored records are in

In effect the internal schema is the storage structure definition. Mappings


y

y y

The conceptual/internal mapping: o defines conceptual and internal view correspondence o specifies mapping from conceptual records to their stored counterparts An external/conceptual mapping: o defines a particular external and conceptual view correspondence A change to the storage structure definition means that the conceptual/internal mapping must be changed accordingly, so that the conceptual schema may remain invariant, achieving physical data independence. A change to the conceptual definition means that the conceptual/external mapping must be changed accordingly, so that the external schema may remain invariant, achieving logical data independence.

DBMS A database management system (DBMS) is a system that stores and retrieves information in a database. It is used to help you organize your data according to a subject, so that it is easy to track and verify your data, and you can store information about how different subjects are related, so that it makes it easy to bring related data together. The database management system (DBMS) is the software that:
y y

handles all access to the database is responsible for applying the authorisation checks and validation procedures

Conceptually what happens is: 1. A user issues an access request, using some particular DML. 2. The DBMS intercepts the request and interprets it. 3. The DBMS inspects in turn the external schema, the external/conceptual mapping, the conceptual schema, the conceptual internal mapping, and the storage structure definition. 4. The DBMS performs the necessary operations on the stored database

Important Functions on a Database y Structure definition: declare 5 les or relations + data types, e.g. Student(StudName, StudentNo, Class, Dept) Population: input data about specic students, courses, prerequisite y Querying Which are the prerequisites of the Database course ? List students who got grade 14 or 16 for the Database course in 1993 Reporting: prepare diplomas, with standard text, interspersed with name of student, courses taken, name of degree, grades, etc. Modification, update of population Create a new session for the Database course Enter a grade 16 for Smith in the Database Session Modification of structure, of schema Create a new relation for instructors

y y y y y

Add Address attribute to relation Stud

Advantages of the database management systems


Warehouse of Information The database management systems are warehouses of information, where large amount of data can be stored. The common examples in commercial applications are inventory data, personnel data, etc. It often happens that a common man uses a database management system, without even realizing, that it is being used. The best examples for the same, would be the address book of a cell phone, digital diaries, etc. Both these equipment store data in their internal database. Defining Attributes The unique data field in a table is assigned a primary key. The primary key helps in the identification of data. It also checks for duplicates within the same table, thereby reducing data redundancy. There are tables, which have a secondary key in addition to the primary key. The secondary key is also called 'foreign key'. The secondary key refers to the primary key of another table, thus establishing a relationship between the two tables. Systematic Storage The data is stored in the form of tables. The tables consist of rows and columns. The primary and secondary key help to eliminate data redundancy, enabling systematic storage of data. Changes to Schema The table schema can be changed and it is not platform dependent. Therefore, the tables in the system can be edited to add new columns and rows without hampering the applications, that depend on that particular database. No Language Dependence The database management systems are not language dependent. Therefore, they can be used with various languages and on various platforms. Table Joins The data in two or more tables can be integrated into a single table. This enables to reduce the size of the database and helps in easy retrieval of data. Multiple Simultaneous Usage The database can be used simultaneously by a number of users. Various users can retrieve the same data simultaneously. The data in the database can also be modified, based on the privileges assigned to users. Data Security

Data is the most important asset. Therefore, there is a need for data security. Database management systems help to keep the data secured. Privileges Different privileges can be given to different users. For example, some users can edit the database, but are not allowed to delete the contents of the database. Abstract View of Data and Easy Retrieval DBMS enables easy and convenient retrieval of data. A database user can view only the abstract form of data; the complexities of the internal structure of the database are hidden from him. The data fetched is in user-friendly format. Data Consistency Data consistency ensures a consistent view of data to every user. It includes the accuracy, validity and integrity of related data. The data in the database must satisfy certain consistency constraints, for example, the age of a candidate appearing for an exam should be of number datatype and in the range of 20-25. When the database is updated, these constraints are checked by the database systems. Disadvantages Database systems are complex, difficult, and time-consuming to design Substantial hardware and software start-up costs Damage to database affects virtually all applications programs Extensive conversion costs in moving form a file-based system to a database system y Initial training required for all programmers and users y Data Redundancy The same piece of information may be stored in two or more files. Forexample, the particulars of an individual who may be a customer or client may be stored intwo or more files. Some of this information may be changing, such as the address, thepayment maid, etc. It is therefore quite possible that while the address in the master file forone application has been updated the address in the master file for another application mayhave not been. It may be not easy to even find out as to in how many files the repeating itemssuch as the name occur. y Program/Data Dependency: In the traditional approach if a data field is to be added to amaster file, all such programs that access the master file would have to be changed to allowfor this new field which would have been added to the master record.
y y y y

Lack of Flexibility: In view of the strong coupling between the program and the data, mostinformation retrieval possibilities would be limited to well-anticipated and predetermined
y

Entities and their Attributes

Entity: Some identifiable object relevant to the system being built. Examples of Entities are: EMPLOYEE CUSTOMER ORGANIZATION PART INGREDIENT PURCHASE ORDER CUSTOMER ORDER PRODUCT An instance of an entity is like a specific example: Bill Gates is an Employee of Microsoft SPAM is a Product Greenpeace is an Organization Flour is an ingredient

y y

Attribute: A characteristic of an Entity. Properties used to distinguish one entity instance from another. Attributes of entity EMPLOYEE might include: EmployeeID Social Security Number First Name Last Name Street Address City State ZipCode Date Hired Health Benefits Plan

Attributes of entity PRODUCT might include: ProductID Product_Description Weight Size Cost

Vous aimerez peut-être aussi