Uploaded by nate.sibbs11

Datbase Management

advertisement
Learning Objectives
1. Become familiar with various terms associated with Database
2. Identify the uses of a database
3. Develop an understanding of the various database packages
4. Gain an appreciation for the different categories of database
5. Identify and explain the data types used in database
6. Develop an understanding of relationships in database and it types
Data: this is a single piece of information that is in one field. It can be used in a variety of forms
like text, numbers, media, bytes, etc. it can be stored in pieces of paper or electronic memory,
etc.
Database:
A database is a collection of data stored in a set of related tables.
A database is an organized collection of structured information, or data, typically stored
electronically in a computer system.
A database is usually controlled by a
database management system (DBMS).
The data can then be easily accessed,
managed, modified, updated, controlled,
and organized.
Database package –
Software package that allows you to use a
computer to create a database; add, change, and
delete data in the database; sort the data in the
database; retrieve data in the database; and create
forms and reports using the data in the database.
Database package: this is a software package that
is used to create and manage a computerized
database.
Types of database software
Oracle. No surprise here.
Microsoft SQL Server. Love it or hate it,
Teradata.
Microsoft's DBMS is one of the most popular in
IBM DB2.
the world.
Informix.
MySQL.
File Maker Pro (Apple software)
PostgreSQL.
Microsoft Visual FoxPro
Microsoft Access.
IBM Lotus Approach
A database is used in each of the following situations:
1. dialing a number from the contact list stored in a phone;
2. searching through a phone’s call log; and
3. searching a physical telephone directory for the number of the nearest
Domino’s location when you feel for a pizza.
Advantages of databases
1. Speed: easy to update, access, store and retrieve information.
2. Standardization: Easy to use.
3. Ad hoc queries: Link tables together reduce duplication of data and enable users to quickly
search through a huge number of records.
4. Multiple views of the same data: Facilitates multiple users having access to the same piece of
data. – For example, a customer’s address – and still use it in different ways. When one user
changes a customer’s address, the new address immediately becomes available to all users.
Disadvantages of databases
1. Larger file size: In order to support a wide range of components such as tables,
relationships, indexes, queries and report templates, a database file has to be large and
occupies a great amount of disk space.
2. Greater impact of failure: A computer failure can cause inaccessibility to data or irreversible
data loss.
3. Easy to copy or steal files if it is not properly protected.
Microsoft Access –
Database management system (DBMS) that functions in the Windows environment and allows
you to create and process data in a database
Data: this is a single piece of information that is in one field.
Field –
A specific piece of information within a
record. This is the smallest unit of data
that can be stored. A field can only hold
one piece of data e.g. first name.
Record Information about a single person, product, or event. This is a group of related fields
pertaining to one person or thing (a number of related fields).
A tuple is simply a row contained in a table in the tablespace. A table usually
contains columns and rows in which rows stand for records while columns stand for attributes.
A single row of a table that has a single record for such a relation is known as a tuple.
Table: this is a
collection of records
about a specific topic
eg school record.
Creating Access Tables
You can create a table using any one of the following methods:
1. Design view: This method enables you to create a table from scratch. From here you can
enter fields, data-types and descriptions into your database table.
2. Datasheet view: You can enter data into the datasheet grid which consists of rows and
columns labelled 'Field 1', 'Field 2', 'Field 3' etc. Access will determine the data type based
on the data you enter.
3. Form View – A single record of all its fields is displayed
Table Structure
1. Field Name – An unique name for the data
a) Up to 255 characters in length
b) May contain letters, digits, spaces, and most punctuation symbols
c) Cannot contain periods, exclamation points, or square brackets
2. Data Type – The type of information the field will contain
a) Text – Any characters; numbers which will not be used for arithmetic operations
b) Number – Only numbers; numbers which will be used in arithmetic operations
c) Currency – Only dollar amounts; displayed with dollar signs, commas, and decimal points to two
significant places; may be used in arithmetic operations; automatically assigned a size
d) Field Width – The maximum number of characters that can be stored in the field; width of 50 is default
3. Description – A detailed description of the field
File –
A collection of records. A file
also referred to as an entire
database or a collection of
tables, queries, reports, forms
etc. in a database file.
Query: a method used for answering in a database (question that can be answered by using
the data stored in the database). A query selects records from one or more tables based on
specific criteria.
Query by Example (QBE) grid – the portion of the Query Design window used for selecting fields,
setting criteria, and setting sort order in a select query. QBE grid rows ROW
ROW
Field
Table
Sort
Show
Criteria
Or
DESCRIPTION
Displays the name of the field used in the query.
Displays the name of the table from which a field is selected.
Determines the order in which to display the records in the record set.
Determines whether the field used appears in the record set.
Displays selective criteria used to filter the query.
Displays additional criteria for the query.
Record set – the set of records and fields that result from running a query.
Unique Identifier – Data will
appear only in a single record in
the table; no two fields will be
assigned the same data (Primary
Key)
Form:
A form is a document with a prearranged structure where information can be entered in the
specified blank fields
Report:
Its an easy and elegant way to present the contents of a table or the result of a query as a
document
Relational database: this is a database that links together logically related data stored on
several files
Related table – a table with a common field that uses values stored in a primary table.
What is Relationship in DBMS
Entities may have several relationships among themselves. Whenever an attribute of one entity
refers to another entity, there exists a relationship between the two entities.
A relationship, in the context of databases, is a situation that exists between two relational
database tables when one table has a foreign key that references the primary key of the other
table. Relationships allow relational databases to split and store data in different tables, while
linking disparate data items.
Linking tables
First you must know that every table must have a field which takes a unique identifier for each entity which is
added to the table. e.g. ID’s are unique to a specific person or thing. This ID appears in all related tables which
hold data on that set of entities. In one table, a Key is added to that field and is called a Primary Key.
Setting a primary key
A primary key is field or fields in a table that uniquely identifies a record. Primary keys are used in relational
database to link two tables.
Defining a primary key
1. Open the table in design view
2. Select the field you want to define as primary key
3. Select the primary key icon on the toolbar
Foreign Key: In a relational database, the foreign key is a potential primary key.
Types of Relationship
Three types of relationship exist among entities. These are:
● One-to-one
● One-to-many
● Many-to-many
One-to-one(1:1) Relationship
● A one-to-one (1:1) relationship is when at most one instance of a entity A is associated with
one instance of entity B.
● For example, in a university each department has only one head of the department.
Moreover, one faculty member cannot head more than one department. This shows
one-to-one (1:1) relationship between department and the person as head.
One-to-many (1:M) Relationship
A one-to-many (1:M) relationship is when
one record or entity in a table/file, is
linked to many records or entities in
another table/file. An example of a 1:M
relationships is A department has many
employees, each employee is assigned to
one department
Many-to-many (M:M) Relationship
A
many-to-many
(M:M)
relationship,
sometimes called non-specific, is when
many records or entities in a primary
table/file, are linked to many records or
entities in another table/file. For example,
one customer may buy many items and one
item may be bought by many customers.
Data type Description
Text
Use for text or combinations of text and numbers. 255 characters
maximum
Memo
Memo is used for larger amounts of text. Stores up to 65,536
characters. Note: You cannot sort a memo field. However, they
are searchable
Byte
Allows whole numbers from 0 to 255
Integer
Allows whole numbers between -32,768 and 32,767
Long
Allows whole numbers between -2,147,483,648 and
2,147,483,647
Single
Single precision floating-point. Will handle most decimals
Storage
1 byte
2 bytes
4 bytes
4 bytes
Double
Double precision floating-point. Will handle most decimals
Currency
Use for currency. Holds up to 15 digits of whole dollars, plus 4 decimal 8 bytes
places. Tip: You can choose which country's currency to use
AutoNumber
Date/Time
Yes/No
AutoNumber fields automatically give each record its own number, usually starting at 1 4 bytes
Use for dates and times
8 bytes
A logical field can be displayed as Yes/No, True/False, or On/Off. In code, use the 1 bit
constants True and False (equivalent to -1 and 0). Note: Null values are not allowed in
Yes/No fields
Ole Object
Can store pictures, audio, video, or other BLOBs (Binary Large OBjects)
Hyperlink
Contain links to other files, including web pages
Lookup Wizard Let you type a list of options, which can then be chosen from a drop-down list
8 bytes
up to 1GB
4 bytes
Download