CSC 240 (Blum)1 Introduction to Database. CSC 240 (Blum)2 Data versus Information When people...

Preview:

Citation preview

CSC 240 (Blum) 1

Introduction to Database

CSC 240 (Blum) 2

Data versus Information

• When people distinguish between data and information, – Data is simply a set of individual numbers or

facts. – Information arises from integration – putting

the individual facts together to see the larger picture or by asking a question not answerable by just one piece of data.

CSC 240 (Blum) 3

Data vs. Information Example

• Example of Data:– John Smith got a 87 on Test 2 in CSC 240.

• Examples of Information:– John Smith scored more than 10 points over the

class average on all of the tests in CSC 240. – Jane Jones got the highest score on Test 2 is

CSC 240.

CSC 240 (Blum) 4

Database

• The purpose of a database is to bring together a set of data so that it is centralized, organized, easy to extract information from, and so forth.

• The way the facts are organized and how they relate to each other is known as the database design.

• The software application that facilitates the storing of the data and the accessing of the information is known as a database management system.

CSC 240 (Blum) 5

Database Modeling

• In database design, one tries to organize the data in a way that reflects the situation from which the data comes.

• One approach is known as entity-relationship modeling or ER modeling.

• The design is often represented pictorially in an ER Diagram.

CSC 240 (Blum) 6

Entities• Entities separate the data into distinct units.

– E.g. a Person entity collects together individual pieces of data (known as attributes) about a person – Name, Address, PhoneNumber, etc.

• Database entities often reflect real objects/entities (persons, buildings, courses, etc.)

• An entity is somewhat similar to an object in programming, it collects data that belongs together in some immediate way.

CSC 240 (Blum) 7

Relationship

• The various entities may be distinct, but they are not completely disconnected. An association between two entities is known as a relationship. – In a database modeling a university, one would

have relationships, such as• Student takes class• Professor teaches class • Etc.

CSC 240 (Blum) 8

ER Diagram

• One can visualize the entities and their relationship using an Entity-Relationship (ER) diagram. – The entities are represented by rectangles. – The relationships are represented by arrows

between the rectangles. • The arrow may include a verb to capture the nature

of the relationship (as well as other notations).

CSC 240 (Blum) 9

CSC 240 (Blum) 10

Design Implementation

• After a database is designed, one uses a database management system to implement (actually make) the database.

• In database implementation, one encounters terms like table, record, field, keys, and so forth.

CSC 240 (Blum) 11

Webopedia definition of record

• “In database management systems, a complete set of information. Records are composed of fields, each of which contains one item of information. A set of records constitutes a file. For example, a personnel file might contain records that have three fields: a name field, an address field, and a phone number field. In relational database management systems, records are called tuples.”

CSC 240 (Blum) 12

Whatis definition of table• “In a relational database, a table (sometimes called a file)

organizes the information about a single topic into rows and columns. For example, a database for a business would typically contain a table for customer information, which would store customers' account numbers, addresses, phone numbers, and so on as a series of columns.

• Each single piece of data (such as the account number) is a field in the table. A column consists of all the entries in a single field, such as the telephone numbers of all the customers.

• Fields, in turn, are organized as records, which are complete sets of information (such as the set of information about a particular customer), each of which comprises a row. The process of normalization determines how data will be most effectively organized into tables.”

CSC 240 (Blum) 13

CSC 240 (Blum) 14

Fields• The lower-level pieces of data gathered together to

form an entity are known as fields or attributes or properties. – Thus in our example the Person entity consists of fields

like FirstName, LastName, Address and PhoneNumber, etc.

• Fields are analogous to properties of an object.• Like properties, they have a type (Text, Number,

Yes/No, Memo, Date/Time, etc.) which indicate how the information is to be stored and interpreted.

CSC 240 (Blum) 15

Webopedia definition of the key

• “In database management systems, a key is a field that you use to sort data. It can also be called a key field, sort key, index, or key word. For example, if you sort records by age, then the age field is a key.

• Most database management systems allow you to have more than one key so that you can sort records in different ways.

• One of the keys is designated the primary key, and must hold a unique value for each record.

• A key field that identifies records in a different table is called a foreign key.”

CSC 240 (Blum) 16

References

• Database Systems: Design, Implementation, & Management, Peter Rob and Carlos Coronel

• http://www.whatis.com

• http://www.webopedia.com

Recommended