modern data base management systems lecture no 2 by engineer bilal ahmad

34
MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

Upload: ada-shields

Post on 23-Dec-2015

214 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

MODERN DATA BASE MANAGEMENT

SYSTEMS

LECTURE NO 2

By Engineer Bilal Ahmad

Page 2: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

Significance of Database Design Database Design focuses on the

Design of the Database Structure used for End Users Data.

As a Designer you have to specify the expected use of a Database.

If you have a Well Designed Database it will facilitate Data to be Managed Easily and it will Generate valuable and accurate information.

Page 3: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

Increase in the Productivity of an Organization

And you all are aware that how much important is to have an accurate, precise and well managed information for the Decision makers if the organization wants to be in the Leading Role.

Just think about NADRA, they have an amazing structure and management system that is used for not only personal information but also confidential stuff.

Page 4: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

Effect of Poorly Designed Database

Angry Management. Miss handling of information. Wastage of time and Money. Un Happy and Angry

Customers. Negative feedbacks from

Employees, Administration and Management.

End Product, Your Manager Says You are no Longer in the Business and You loose your job

Page 5: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad
Page 6: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

Evolution of File System Data Processing

If you understand the complete complexity of Design you are in a good command to tackle unease situations.

If you understand the file system it will help to avoid problems with the DBMS.

If you have a good command on File System you will find it very useful to convert file system to database system.

Page 7: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

Evolution of File System Data Processing continued

File system is usually composed of collection of File Folders, each tagged and kept in the cabinet that are organized by expected use.

Remember Modern Database Management system are on the basis of use and the frequency of usage.

Contents of Each file folders are logically related.

Lets say if I ask you to search Apples AND Bananas on www.google.co.uk what information will you achieve. And than if I ask you to have “OR”?

Page 8: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

File Systems

Manual Systems:Served as a data repository for small data collections.Will be a miracle if you can manually feed data for a large collection. Computerized File System:Data Processing Specialist DP converted computer file structure from manual system.Wrote software that manage the data. Design the Application programs. Just remember when National ID Cards were not Computerized because NADRA data base system was not Computerized.

Page 9: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

File Systems Continued

In the beginning computer file systems resembled the manual system. All you were doing was using computers for manual tackling and storing. information. A simple example can be you can use excel for manual storing and tracking information.

As a number of files increased. File system evolved

1. Each file to use its own application program to store, retrieve and modify data.

2. Each file was owned by individual or department that commissioned its creation.

Page 10: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad
Page 11: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

A Simple File System

Page 12: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

Problems with File System Data Processing

File systems were an improvement over manual systems.

They have been used for more than 2 decades.

Understanding the short comings of file systems aids in the development of Modern Databases.

The issues are;Ad hoc queries are impossible. Changing the existing structure is again a difficult thing.

Page 13: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

Data Redundancy

File system structure makes it difficult to combine data from multiple sources.

Organizational structure promotes storage of same data in different locations.

Data that has been stored in different locations in unlikely to be updated consistently.

If same data is stored unnecessarily in different places.

Page 14: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

Data Redundancy Continued Data inconsistency occurs when

different and conflicting versions of same data occur at different places.

When all changes in redundant data are not made correctly that abnormalities take place. The abnormalities occurs at the time of;

Updating Inserting Deleting

Page 15: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

The Database System Environment

The Database System defines and regulates the collection, storage and management of the end user data.

Five major parts/ components in a Database system are; Hardware, software, people, Procedures and Data.

Hardware is the Physical Device. Software are of three types; OS, DBMS,

Application Programs and Software Utility

Page 16: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

The Database System Environment

Page 17: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

Recap

So Database Systems are created and Managed at different levels of complexity.

Database solutions must be cost-effective as well as tactically and strategically effective.

Page 18: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

Chapter 2: Data Models

Now in this Chapter you will learn; About data modeling and why data

models are important. About the basic data modeling

building blocks. What are business rules and how

they influence database design. How data models can be classified

by the level of Abstraction.

Page 19: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

Data Modeling and Data Models Database Design focuses on how the

Database structure will be used to store and manage the end user data.

The first step in designing a database should be “understanding the problem and make a model”

What will happen if you don’t understand the problem environment your system will collapse.

A problem domain is a clearly defined area within the real world environment, with well defined boundaries and scope, that is to be addressed systematically.

Page 20: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

What is a Data Model

It is a relatively simple representation, usually graphically of more complex real world structures.

A model is an abstraction of complex real world problem.

It helps you to understand the complexities of an environment.

Within a database environment a data model represents data structures and their characteristics, relations, constraints, transformation.

Page 21: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

Data Model: A constructive way Data modeling is a very

constructive way to tackle a complex real time environment.

You start will basics and after getting into the problem you come up with more and more idea and your concepts get clears.

A stage will come that you will understand each and every aspect.

Once your model is being created you make a “Blue Print”, it is graphical in nature most of the time.

Page 22: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

What is “Blue Print”

It contains all the information to build a database that will meet the end user requirements. And as explained before that it is normally in graphical form that explains the abstraction level.

Be prepared as an exercise will come shortly, you will be asked to bake a cake and total time will be 15 minutes.

Page 23: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

What will be the accurate Model Well the answer to that very statement is

complex. Lets assume if you are asked to create a

model for a video store, you all will come up with different ideas, the Blueprint will be different. Now which one will be correct, it might be all of you will be wrong, might be all of you will produce the appropriate solution.

The answer will be however “the one that will fulfill all the end user requirements”

Page 24: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

The Importance of Data Models It facilitates the interaction between the

designer, application programmer and the end users.

(there is an error in the above statement can you think about it, it is not technically keep in mind) We can sum up the importance with a

random statement made by a client “I created the business, I have worked with this business for 5 years but this is the first time I have really understood how all pieces of information work together”

Page 25: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

Importance of Data Models Continued

It cannot be overstated. Each and every member looks a

Database in a different fashion. What information type will a Clerk

Seek and What information type will a Manager seek

Applications programmers have also another way of viewing a data, they are concern about the technicalities. What they do is they translate the company policies.

Page 26: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

Problems if you don’t have a Good Blueprint

It will not matter the point of view from different personalities if you have a good blue print.

Can you think of some problems that will arise if you don’t have a best blueprint.

You also have to keep in mind that a good blueprint is an abstraction, it is not every thing. Similar if you have to construct a house you need to have a good blueprint.

Page 27: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

Basic Building Blocks of Data Models

The basic building blocks are; 1. EntitiesIt describes a particular type of object in the real world. It has to be distinguishable. 2. AttributesIt is a characteristic for entities, for example a customers entity can be explained by address, location, contact no etc.

Page 28: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

DMBBB Continued

3. Relationships A relationship describes an association among entities. For example a relationship can be explained by some statements.An Agent can serve many customers and many customers can be served by one Agent. Three types of commonly relationships are used;1. One to One 2. One to Many 3. Many to Many

Page 29: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

Relationship Explained

One to ManyA painter paints many painting but all paintings are painted by one painter. A customer may generate may invoices but all invoices are generated by one customer. Many to ManyA student may learn many courses and many courses are learnt by students.

Page 30: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

Relationship Continued

One to Onea retail store manager manages one store and one store is being managed by one retail store manager.

All the above statements are business rules and they are the exact information that has to be used for Database Design.

Page 31: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

DMBBB Continued

4. Constraint

A constraint is a restriction that is very important and they are also called as set of rules. “For example you cannot have a degree if your overall CGPA is less than 2.5”

NB: In order to properly define entities, attributes, relationships and constraints, you have to clearly identify the business rules for the problem domains.

Page 32: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

Remember you have to bake a Cake

Ok, now you have to design a simple blueprint. Should be explained in block diagram. What we need is we need to Design a Database for a Company named as Computer World.

Total no of employees are 2 Employees do have login

information and than they can access the system. The login will ask there employee no and passwords.

Page 33: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

Design Continued

Total no of products that are offered to customers are 10.

All products are displayed on shelves having their product codes and price.

Tickets can be printed from the Database as the record is already there.

If a sale person wants to search the stock he/ she must have the facility to search the item using product codes, as each and every product do have different product codes.

Page 34: MODERN DATA BASE MANAGEMENT SYSTEMS LECTURE NO 2 By Engineer Bilal Ahmad

Design Continued

Name of the Brand

Acer Aspire Laptop Advent Laptop Samsung LaptopToshiba Laptop Sony Laptop IBM Laptop Lenovo Laptop Apple Laptop Siemens Laptop Asus Laptop

Price

PKR 40KPKR 35KPKR 75KPKR 50KPKR 80KPKR 79KPKR 70KPKR 1 Lac 50KPKR 17KPKR 65K