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. 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. 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 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. 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”? 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. File Systems Continued 1. 2. 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 Each file to use its own application program to store, retrieve and modify data. Each file was owned by individual or department that commissioned its creation. A Simple File System 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. 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. 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 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 The Database System Environment Recap So Database Systems are created and Managed at different levels of complexity. Database solutions must be costeffective as well as tactically and strategically effective. 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. 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. 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. 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. 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. 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” 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” 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. 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. Basic Building Blocks of Data Models The basic building blocks are; 1. Entities It describes a particular type of object in the real world. It has to be distinguishable. 2. Attributes It is a characteristic for entities, for example a customers entity can be explained by address, location, contact no etc. 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 Relationship Explained One to Many A 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 Many A student may learn many courses and many courses are learnt by students. Relationship Continued One to One a 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. 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. 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. 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. Design Continued Name of the Brand Price Acer Aspire Laptop Advent Laptop Samsung Laptop Toshiba Laptop Sony Laptop IBM Laptop Lenovo Laptop Apple Laptop Siemens Laptop Asus Laptop PKR 40K PKR 35K PKR 75K PKR 50K PKR 80K PKR 79K PKR 70K PKR 1 Lac 50K PKR 17K PKR 65K