* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download imch13 - bcf.usc.edu
Oracle Database wikipedia , lookup
Open Database Connectivity wikipedia , lookup
Entity–attribute–value model wikipedia , lookup
Ingres (database) wikipedia , lookup
Extensible Storage Engine wikipedia , lookup
Concurrency control wikipedia , lookup
Microsoft Jet Database Engine wikipedia , lookup
ContactPoint wikipedia , lookup
Clusterpoint wikipedia , lookup
CHAPTER 13 Database Management Systems Getting Data Together LEARNING OBJECTIVES Appreciate the advantages of databases Understand how databases are organized Become familiar with database terminology Understand, in general, how to build and change a database CHAPTER OVERVIEW Students will get the most out of this chapter if it is accompanied by hands-on experience, using database software on a personal computer. However, if hands-on is not available, a student should still be able to understanding the power and usefulness of databases, and also have some notion of what it takes to put one together. 132 LECTURE OUTLINE Getting It Together: Database Systems A database is an organized collection of related data. A database management system (DBMS) is software that helps organize data in a way that allows fast and easy access to the data. With a database program a user can create, modify, store, and retrieve data in a variety of ways. Databases Are Different Database systems are different from word processing or spreadsheet software, in which users enter and use the data in the same form as it resides on disk. Data in databases could reside on the disk in ways unknown to a user. In particular, sophisticated database systems, particularly those designed for a mainframe computer environment, are complex, and must be planned and managed by computer professionals. Users of such systems are trained to input data to and retrieve data from the database system, using appropriate software; they can do this successfully without ever having to understanding the underlying technology. On the other hand, database software is available for personal computers that a trained user can apply to simple or moderately complex problems. Advantages of Databases Several advantages are generally associated with databases. Reduced redundancy. Data carried in separate files, as opposed to a database, tends to repeat some of the same data over and over. In a database, information generally appears just once. Integrated data. Rather than being in separate and independent files, data in a database is considered integrated because any item of data can be used to satisfy an inquiry or a report. Integrity. Integrity concerns increase as the sophistication of the data increases. Reduced redundancy increases the likelihood of data integrity. 133 Database Concepts In this chapter we will look at database management in a generic way, without reference to any specific package. Database Models The way the database organizes data depends on the type, or model, of the database. There are three database models—hierarchical, network, and relational. Databases on personal computers are usually relational. A relational database organizes data in a table format consisting of related rows and columns. In a relational system, data in one file can be related to data in another, allowing you to tie together data from several files. Fields, Records, and Files In a relational database a table is called a relation. A relation is also called a file. Each box in the table contains a piece of data, known as a data item. Each column of the table represents a field. The specific data items in a field may vary, but each field contains the same type of data. All the data in any given row is called a record. Each record has a fixed number of fields, but there can be a variable number of records in a given relation. Database Power The power of a database is in the connection: a relational system can relate data in one file to data in another file, allowing a user to tie together data from several files. (At this point, the easiest approach is to follow the example in the text; the figures should help.) A Problem Fit For a Database (Again, at this point, the problem is best followed from the text.) 134 Creating and Using a Database There are two steps to creating a database file: designing the structure of the file and entering the data into the file. Determining the File Structure The file structure is a description of what data is wanted in each column. To create the file structure, a user must choose meaningful fields, based on the data to be retrieved from the database. Field Name Names of the types of data to be used are called field names. A field name must be unique. Field Type There are four commonly used types of fields: Character fields contain descriptive data such as names, addresses, and telephone numbers. Numeric fields contain numbers used for calculations. You must specify the number of decimal places you wish to use. Date fields are automatically limited to eight characters, including the slashes used to separate the month, day, and year. Logical fields keep track of true and false conditions. Field Widths The field width determines the maximum number of characters or digits to be contained in the field, including decimal points. Key Fields One or more key fields can be designated as a field on which an inquiry to the database can be made. A key field is sometimes called an index field. 135 Setting Up the File Structure Although different database packages may take different approaches, in Microsoft Access, used to demonstrate the example in the text, the design view is set up like a table, with one line per database field. Entering the Data Once a database structure is established, the data can be entered. (If you wish to follow the example, details are in the text.) Other Options The following are descriptions of operations that would be available with any database software package. List the records A user could ask for a list of all existing records, either displayed on the screen or printed out on paper. The software displays as many records as will fit on the screen. Scrolling up or down displays additional records. If there were a large number of fields in a record, a user could pan—move horizontally across the screen—to the left or right. List specific fields In addition to printing all records, a user has the option of printing just certain fields of each record. Query A user can make a query—ask a question—about the records in the file, using a relational operator when entering instructions that involve making comparisons. (See Table 11-1 in the text for details of relational operators.) Add new records A user can add records at any time. Modify existing records 136 A user may change data in an existing record. Delete records A user may remove—delete—a record from a database file. 137 KEY WORDS character field data item database database management system (DBMS) date field field field name field type field width file file structure integrated data integrity key field logical field model numeric field pan record reduced redundancy relation relational database relational operator transparent 138