CBDB3403 - DATABASE Cluster of Applied Sciences CBDB3403 DATABASE NOR AISYAH BINTI FADIL CBDB3403 Database E-Tutor: Nor Aisyah Binti Fadil 1 Cluster of Applied Sciences Introduction In this subject, we shall learn the fundamental of a database including its concept, technology, modeling the data, application of database language (SQL) and many more. By the end of this course, you should be able to: CLO1. To describe various aspects of database technology, technique and methodology which can be applied to design and manipulate relational database CLO2. To apply the technique and methodology which can be applied to design and manipulate relational database CLO3. To construct a logical data model using a systematic approach and methodology for manipulation data using selected DBMS E-Tutor: Nor Aisyah Binti Fadil miesya@oum.edu.my 2 1 CBDB3403 - DATABASE TOPIC 1 Cluster of Applied Sciences TOPIC 1 Introduction to Database E-Tutor: Nor Aisyah Binti Fadil 3 Cluster of Applied Sciences Objective By the end of this topic, you should be able to: 1. Identify the characteristics of file-based systems 2. Describe four limitations of file-based systems 3. Define the database and database management systems (DBMS) 4. Describe four advantages and two disadvantages of DBMS 5. Identify four features of DBMS 6. Classify types of people involved in the DBMS environment E-Tutor: Nor Aisyah Binti Fadil miesya@oum.edu.my 4 2 CBDB3403 - DATABASE Cluster of Applied Sciences Let’s Think E-Tutor: Nor Aisyah Binti Fadil 5 Cluster of Applied Sciences 1.1 Introduction to Database DATABASE SYSTEM ▪ Collection of application programs that interact with the database along with the DBMS and the database itself DATABASE ▪ Shared collection of logically related data and a description of this data, designed to meet the information needs of an organisation. ▪ Define once, but used repeatedly by various users from different location. ▪ Data stored are updated, consistent, reliable and no duplication of data. E-Tutor: Nor Aisyah Binti Fadil miesya@oum.edu.my 6 3 CBDB3403 - DATABASE Cluster of Applied Sciences 1.1 Introduction to Database DATABASE APPLICATION ▪ Programs that manages and controls access to the database DBMS ▪ Database Management System ▪ Software system which enables users to define, create, maintain and control access to the database. E-Tutor: Nor Aisyah Binti Fadil 7 Cluster of Applied Sciences Examples of Database Application Data Involve Supermarket • Product • Quantity • Price • Consumer • Receipt • Supplier System Involve Sales System – to record each sales transaction Inventory system– to store supermarket inventory record System Usage • To record all transaction – purchase, payment • To control inventory – to manage the stock level • Sales Analysis – to record sales and analyze the sales performance E-Tutor: Nor Aisyah Binti Fadil miesya@oum.edu.my 8 4 CBDB3403 - DATABASE Cluster of Applied Sciences Examples of Database Application Data Involve University • Student • Lecturer • Staff • Course • Fees • Salary • Result System Usage System Involve Student Info. System: - Records of student info Student Reg. System: – Records of registration. Staff Info System: - Records of staff / admin Result Sys– - Records of result • Record, store, update of student, lecturer and staff information • Record and analyze student result and performance • Record, monitor student fees payment. E-Tutor: Nor Aisyah Binti Fadil 9 Cluster of Applied Sciences Examples of Database Application Data Involve Hospital System Involve • Patient • Doctor • Medicine • Illness • Medication • Appointment Patient Info. System - store patient info Inventory Sys– - medicine record. Doctor Schedule Sys – - Schedule of duty / on call Treatment Sys – - record of previous treatment. System Usage Appointment Sys. • record, store, review patient record. - Alert the appointment • record, store and control pharmacy stock • Diagnose patient illness • Review / Alerts the appointment E-Tutor: Nor Aisyah Binti Fadil miesya@oum.edu.my 10 5 CBDB3403 - DATABASE Cluster of Applied Sciences 1.2 Basic Database Terminology Terminology Description Example Data ▪ Basic facts, raw data, gives no meaning ▪ Collection of unprocessed items that may consist of text, numbers, images and video. • • • Proton wira Red CBDB3403 Information ▪ Data that have been processed in such a way that the knowledge of the person who uses the data is increased • • • National car Apple colour Code for database subject Data Basic facts, raw data, gives no meaning Faizal, Red, New, Drive Information Process Collection or combination of Raw data that has been processed E-Tutor: Nor Aisyah Binti Fadil Faizal drives a new car Copyright © ODL Sept 2008 Open University Malaysia 11 Cluster of Applied Sciences 1.2 Basic Database Terminology Terminology Description Example Environment ▪ Organization of place where the database is designed and developed ▪ World of reality • • • • Entity ▪ An object that is unique and which can be identified in a specific environment For Environment: University • Entity: Student, Lecturer, Subject Attributes/ Characteristics which describe an field data item entity E-Tutor: Nor Aisyah Binti Fadil miesya@oum.edu.my Car factory University School Hospital For Entity: Student • Attribute Name: MatrixNo, Name, ICNo, Address • Attribute Value: “AC970708”, “Adam”,”880907-01-7891”, “No 11 Jalan Skudai Johor“ 12 6 CBDB3403 - DATABASE Cluster of Applied Sciences 1.2 Basic Database Terminology Environment: Organization / place where the database is designed and developed. Entity: An object that is unique and which can be identified in a specific environment Attributes: Characteristics which describe an entity e.g: Doctor e.g: Patient e.g: Name Department Post e.g: Name Address Age e.g: Hospital 13 E-Tutor: Nor Aisyah Binti Fadil Copyright © ODL Sept 2008 Open University Malaysia Cluster of Applied Sciences 1.2 Basic Database Terminology Terminology Description Example Record A group of attributes/ fields/ data items needed by a particular entity Student Record Collections: • AC970708, Muhamad, 901011-04-5567, 34-02 Blok 1 Apt Desa Aman • AC971234, Radhi, 781021-03-7896, 45 Jalan 34/SS2 Petaling Jaya File A group of records required by a particular entity • Student File • Subject File • Lecturer File Database A group of files required by an organization. • • • E-Tutor: Nor Aisyah Binti Fadil miesya@oum.edu.my Database: Student Information Environment: University File: Student, Subject, Lecturer, Fees 14 7 CBDB3403 - DATABASE Cluster of Applied Sciences 1.2 Basic Database Terminology Database Database: A group of files required by an organization. File: A group of records required by a particular entity Record: A group of attributes/fields/ data items needed by a particular entity E-Tutor: Nor Aisyah Binti Fadil Copyright © ODL Sept 2008 Open University Malaysia 15 Cluster of Applied Sciences 1.2 Traditional File-Based System A file-based system is a collection of application programs that perform services for the end-users. Each program defines and manages its own data Traditional Approach: Manual File • store all internal and external data within an organisation • files are stored in cabinets and locked or located in a secure area • Manually searching the information needed • Indexing system - to speed up the searching process • Cross-reference cannot be done Improved: file-based systems • Decentralized approach • each department would have their own file based system • monitor and control separately • Each department has its own application programme that handles similar operations like data entry, file maintenance and generating reports • duplication occurs when using decentralized file-based system E-Tutor: Nor Aisyah Binti Fadil miesya@oum.edu.my 16 8 CBDB3403 - DATABASE Cluster of Applied Sciences Let’s Observe E-Tutor: Nor Aisyah Binti Fadil 17 Cluster of Applied Sciences 1.2 Traditional File-Based System FILE SYSTEM WEAKNESS 1) Duplication of Data Excess Data • Same data or record being repeated in two or more files • Eg: Student Name, ICNo, and Address are stored in both Student and Fees File Unorganized Data • The input of data in one file only without updating other related files can cause mistakes. • Eg: Student Address in Student File was modify without updating the Address in the Fees File – different reference resulted to different information. Weak Data Control • Inadequate co-ordination between units and departments causes difficulty in standardizing data, data formatting and data arrangement. E-Tutor: Nor Aisyah Binti Fadil miesya@oum.edu.my • Same data stored repeatedly • Eg: Student Name, ICNo, and Address are stored each new semester registration. 18 9 CBDB3403 - DATABASE Cluster of Applied Sciences 1.2 Traditional File-Based System FILE SYSTEM WEAKNESS 2) Data Separation • Data stored separately • Difficulty in the process of acquiring information when a combination of two or more files are needed. • Eg: Registration record are stored in Registration File while fees record are stored in the Finance File. Difficult to identify which fees for which registration record. 3) Data Format Dependency • Occurs in electronic file concept system such as Ms Excel • Problems often occur when there is change in the file format or output requirements. • If the file format is changed, the application program too must be changed or rewritten. • Eg: Old IC format is change to new IC format E-Tutor: Nor Aisyah Binti Fadil 19 Cluster of Applied Sciences 1.2 Traditional File-Based System FILE SYSTEM WEAKNESS 4) File Incompatibility • Occurs in file electronic system. • A file format processed by a particular program language will be different from a file format processed by another program language. • Eg: Record stored in Ms Word vs Ms Excel 5) Limited Data Sharing • Difficulty in making connections between records stored in each department in an organization. • Difficult to portray the operations of an organization in a complete and accurate manner. • Eg: Difficult to get overall student record from different faculty E-Tutor: Nor Aisyah Binti Fadil 20 miesya@oum.edu.my 10 CBDB3403 - DATABASE Cluster of Applied Sciences 1.3 Database Approach • Database approach improve the limitations of file-based system • Emphasises the integration and sharing of data through the organisation which means that all departments should be able to integrate and share the same data Program Data Independence Planned Data Redundancy and Improved Data Consistency Advantages Increased Productivity of Application Development • Data descriptions are stored in a central location called repository; • Separately from the application program - Integrate redundant data files into a single logical structure - easy and fast to update data - data would also be consistent - reduces the cost and time for developing new database applications - with the same database, different applications can be developed Difficulty in the development process will affect the performance of the system Complexity Disadvantages Costly High cost of establishing DBMS, preparation of other hardware and converting and operating E-Tutor: Nor Aisyah Binti Fadil Cluster of Applied Sciences 1.3.2 The Database Management System Database Definition Nonprocedural Access Database Tuning DBMS Features Transaction Processing E-Tutor: Nor Aisyah Binti Fadil miesya@oum.edu.my Application Development 22 11 CBDB3403 - DATABASE Cluster of Applied Sciences 1.3.2 The Database Management System 1 Database Definition • In defining a database, the entities stored in tables and relationships that indicate the connections among tables must be specified. • Most DBMSs provide several tools to define databases. • The Structured Query Language (SQL) can be used to define tables and relationships among tables. 2 Non-procedural Access • The most important feature of DBMS is the ability to answer queries. • A query is a request to extract useful data. For instance, a learner DBMS is where a few tables may have been defined, like personal information table and result table, and a query might be a request to list the names of the learners who will be graduating next semester. • Non-procedural access allows users to submit queries by specifying what parts ofE-Tutor: a database to retrieve. Nor Aisyah Binti Fadil 23 Cluster of Applied Sciences 1.3.2 The Database Management System 3 Application Development • Most DBMSs provide graphical tools for building complete applications using forms and reports. For instance, data entry forms provide an easy way to enter and edit data. • Report forms provide easy-to-view results of a query. 4 Transaction Processing • Transaction processing allows a DBMS to process large volumes of repetitive work. • A transaction is a unit of work that should be processed continuously without any interruptions from other users and without loss of data due to failures. • An example of a transaction is making an airline reservation. The user does not know the details of the transaction processing other than the assurance that the process is reliable and safe. E-Tutor: Nor Aisyah Binti Fadil miesya@oum.edu.my 24 12 CBDB3403 - DATABASE Cluster of Applied Sciences 1.3.2 The Database Management System 5 Database Tuning • Database tuning include a few monitoring processes that could improve performance. • Utility programmes can be used to reorganise a database, select physical structures for better performance and repair damaged parts of a database. • This feature is important for DBMSs that support large databases with many simultaneous users, usually known as Enterprise DBMSs. • Desktop DBMSs run on personal computers and small servers that support limited transaction processing features, usually used by small businesses. E-Tutor: Nor Aisyah Binti Fadil 25 Cluster of Applied Sciences People in DBMS 1.4 Roles in the Database Environment E-Tutor: Nor Aisyah Binti Fadil miesya@oum.edu.my Data and Database Administrators Database Designers Application Developers Logical Database Designer Physical Database Designer Naive User End Users Sophisticated Users 26 13 CBDB3403 - DATABASE Cluster of Applied Sciences Thank you E-Tutor: Nor Aisyah Binti Fadil miesya@oum.edu.my 27 14