Chapter 1 Databases and Database Users Prepared By Dr. Alaa Hosni 1 ⚫Activities that involve some interaction with a database (traditional database applications). – deposit or withdraw funds, – hotel or airline reservation, – computerized library to search for a bibliographic item 2 ⚫ In the past few years, advances in technology have led to new applications of database systems. ⚫ New media technology has made it possible to store – images, – audio clips, and – video streams digitally. ⚫ These types of files are becoming an important component of multimedia databases. 3 Examples ⚫ Geographic information systems (GIS) can store and analyze maps, weather data, and satellite images. ⚫ Real-time and active database technology is used to control industrial and manufacturing processes. 4 1. Introduction ⚫ Database: A collection of related data. ⚫ Data: Known facts that can be recorded. ⚫ For example, consider the names, telephone numbers, and addresses of the people you know. ⚫ Mini-world: Some part of the real world about which data is stored in a database. For example, student grades and transcripts at a university. 5 • Database Management System (DBMS): A general-purpose software system to facilitate the creation and maintenance of a computerized database. • Database System: DBMS + data • Sometimes, the applications are also included. 6 Example Large commercial database is Amazon.com. It contains data for over 20 million books, CDs, videos, DVDs, games, … and other items. • The database is stored on 200 different computers (called servers). • 1 TB = 1000 gigabytes terabytes (a terabyte is 1012 bytes worth of storage). • More than 160 million visitors access Amazon.com monthly. • About 100 people are responsible for keeping the Amazon database up-to-date. 7 • Defining a database involves specifying 1. the data types, 2. structures, and 3. constraints of the data to be stored in the database. • The database definition or descriptive information is also stored by the DBMS in the form of a database catalog or dictionary; it is called meta-data. • Constructing the database is the process of storing the data on some storage medium that is controlled by the DBMS. 8 9 • Manipulating a database includes : 1. querying the database to retrieve specific data, 2. updating the database to reflect changes in the miniworld, and 3. generating reports (is the formatted result of database queries and contains useful data for decision-making and analysis. ) from the data. • Sharing a database allows multiple users and programs to access the database simultaneously. • A transaction may cause some data to be read and some data to be written into the database. 10 Other features: – Protection or Security measures to prevent unauthorized access – Presentation and Visualization of data 11 2. An Example • The UNIVERSITY database for maintaining information concerning students, courses, and grades in a university environment. • The database is organized as five files, each of which stores data records of the same type. – The STUDENT file stores data on each student, – The COURSE file stores data on each course, – The SECTION file stores data on each section of a course, – The GRADE_REPORT file stores the grades that students receive in the various sections, and – The PREREQUISITE file 12 13 14 • Examples of queries are as follows: – Retrieve the transcript—a list of all courses and grades—of ‘Smith’ – List the names of students who took the section of the ‘Database’ course offered in fall 2008 and their grades in that section – List the prerequisites of the ‘Database’ course 15 • Examples of updates include the following: ▪ Change the class of ‘Smith’ ▪ Create a new section for the ‘Database’ course for this semester • Enter a grade of ‘A’ for ‘Smith’ in the ‘Database’ section of last semester 16 • Design of a new application for an existing database or design of a brand new database starts off with a phase called requirements specification and analysis. • These requirements are transformed into a conceptual design. • Conceptual Design is an early phase of the design process, in which the broad outlines of function and form of something are articulated. • The conceptual design can be represented using some computerized tools so that it can be transformed into a database implementation. 17 • The design is then translated to a logical design that can be expressed in a data model implemented in a commercial DBMS. • Data model : Relational Data Model • The final stage is physical design:further specifications are provided for storing and accessing the database. 18 Conceptual design (ER) Logical design (data model) Physical design (implementation) 19 3. Characteristics of the Database Approach ⚫ Differences between the database approach and the approach of programming with files. – In file processing, each user defines and implements the files needed for a specific software application. – For example, one user, may keep files on students and their grades. A second user, the, may keep track of students’ fees and their payments. ⚫ This redundancy in defining and storing data results in wasted storage space and in redundant efforts to maintain common up-to-date data. 20 ⚫ The main characteristics of the database approach versus the file-processing approach are the following: 1. Self-describing nature of a database system. 2. The database system contains in the DBMS catalog : definition of the database structure and constraints. 3. Insulation between programs and data. The structure of data files is stored in the DBMS catalog separately from the access programs ( program-data independence). 4. Support of multiple views of the data 5. Sharing of data and multiuser transaction processing 21 22 ⚫ Support of multiple views of the data: Each user may see a different view of the database, which describes only the data of interest to that user. ⚫ For example, one user of the university database may be interested only in accessing and printing the transcript of each student; the view for this user is shown in Figure 1.5(a). ⚫ A second user: checking that students have taken all the prerequisites of each course for which they register, may require the view shown in Figure 1.5(b). 23 24 Actors on the scene – Database administrators: responsible for authorizing access to the database, for co-ordinating and monitoring its use, acquiring software, and hardware resources, controlling its use. – Database Designers: responsible to define the content, the structure, the constraints, and functions or transactions against the database. – End-users: they use the data for queries, reports and some of them actually update the database content. 25 4. Advantages of Using the Database Approach ⚫ Controlling redundancy in data storage and in development and maintenance efforts. ⚫ Sharing of data among multiple users. ⚫ Restricting unauthorized access to data. ⚫ Providing persistent storage for program Objects – Object-oriented database systems are compatible with programming languages such as C++ and Java, and the DBMS software automatically performs any necessary conversions. ⚫ Providing Storage Structures for efficient Query Processing 26 ⚫ Providing backup and recovery services. ⚫ Providing multiple interfaces to different classes of users. ⚫ Representing complex relationships among data. ⚫ Integrity constraints on the database: every section record must be related to a course record. 27