Download MS_Access

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Relational algebra wikipedia , lookup

Open Database Connectivity wikipedia , lookup

SQL wikipedia , lookup

Concurrency control wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Microsoft Access wikipedia , lookup

Database wikipedia , lookup

Ingres (database) wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Clusterpoint wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Join (SQL) wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

Transcript
Microsoft Access 2003
Define some key Access terminology:
• Field – A single characteristic or attribute of a
person, place, object, event, or idea.
• Record – A set of related field values.
• Table – A collection of records that can be
identified as a category of data, such as
Customers, Orders, or Inventory.
Illustration of fields, records and a table
Relational database and keys
• A relational database is a collection of tables that are
related to one another based on common fields.
• A field, or a collection of fields, is designated as the
primary key of each table.
• The primary key uniquely identifies a record in the table.
• When the primary key of one table is represented in a
second table to form a relationship, it is called a foreign
key.
Relating tables using a common field
An Access table in datasheet view
Learn how Access saves a database
• The Save button in Access differs from the Save button in other
Windows programs.
• When you press the Save button in Access, you are saving the
design of the Access objects and NOT the data itself.
• Access saves data as it is entered
• For this reason, the location at which you are storing your
database must always be accessible while working with a
particular database.
• Save all changes and quit the Access program before copying or
renaming your database (.accdb) file.
What is an Access query?
• If you want to see just a portion of the data in a table
(or tables) you can create a query.
• A query is a question you ask about the data stored in
a database table.
• Access responds by displaying the data according to
your question.
– For example, if you ask to see all the customers
from New York, the response would be to display
only the records whose state field matches with NY
Query window in Design view
• Allows you to specify the results you want for a query.
• Can specify which fields you want to be included.
• Can control what records are displayed in the query by specifying
select query criteria.
• Each column in the design grid represents a field that will be used
in the query.
• You can run the query at anytime to view the results according to
the current specifications.
The Query Design view window
Selecting, displaying and sorting fields
Drag or double-click fields to include. (Query result differs from a table's datasheet
view in that only selected fields are displayed)
The results of the query will be displayed in order by the primary key of the table
unless you specify another sort order.
Update data using a query
• You can use the query datasheet to update data in a table.
• The query datasheet is a temporary view of the data. However,
when you update data by means of the query datasheet, the
updates are placed directly into the underlying table.
• NOTE: You can only update fields that are in the query!
– Primary Key?
• To observe the actual changes made to the table, close the query
and open the table in datasheet view.
Access is a relational database
• A database is almost always a collection of tables. Access is a
relational database management system that allows you to form
relationships between the tables.
• When you form a relationship between tables, you are joining the
tables.
• Tables are joined on common field(s) between the tables.
• When tables are joined, you can view data from both tables as if
the tables were one combined table.
Relationships
• Tables can be joined in three ways;
– one-to-one
– one-to-many
– many-to-many
• A one-to-many relationship exists when a table has one record
associated with a given value but the related table has many
records for that value.
– Table with one record is called the primary (parent) table
– Table with many records is called the related (child) table
• Queries can be defined to use the relationship to extract data from
both tables in a single query.
Using referential integrity
• When dealing with related tables, you need to decide if you want
to enforce referential integrity.
• Referential integrity allows you to maintain the integrity between
related tables.
• The rules associated with referential integrity specify that when
you add a record to a related table, there must be a matching
record in the primary table.
• If you choose to enforce referential integrity, you can insure that
you will not have orphaned records (records that have no matching
record in the primary table).
Selecting the tables for a relationship
Setting relationship options
The Relationships window
Reports
• You can create a report, which is a printable version of your
data, formatted according to your specifications.
• The data in the report can consist of data from a single table or
multiple tables.
• Access has a Reports Wizard that allows you to easily create a
report.
• The report can be based on a table or it can be based on a query.
Compacting a database
• It is a good idea to periodically compact and repair a
database to recover wasted space created by adding,
deleting, and modifying records.
• Access has a Compact and Repair feature:
– Open a database
– Click on the Office Button and then Manage
– Select Compact and Repair Database.
Compacting reduces database storage size