Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (1 vote)
208 views

DBMS Using MS Access

Microsoft Access allows users to create and manage databases. It is a relational database management system that collects and organizes data into tables. Users can enter data into these tables and then generate queries, forms, and reports to view, analyze, and print the stored data. Some key capabilities of Access include storing data and metadata, enforcing data integrity, managing user permissions, and providing tools for application development.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
208 views

DBMS Using MS Access

Microsoft Access allows users to create and manage databases. It is a relational database management system that collects and organizes data into tables. Users can enter data into these tables and then generate queries, forms, and reports to view, analyze, and print the stored data. Some key capabilities of Access include storing data and metadata, enforcing data integrity, managing user permissions, and providing tools for application development.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

Computer Applications

in Business
DBMS using MS Access
Introduction
• Database is the collection of information that is related to each other.
• MS access allows you to manage the information in one database file.
• It collects data that is sorted in a computer system.
• It allows the user to enter, access, and analyze the stored data quickly and
easily.
• Stronger in handling non-numerical data like names and description that play
a big role .
• Access is able to implement connectivity between the objects
• Access is a Relational Database Management System that is able to
understand how lists and the objects within the database are linked and to
relate them with one another.
• Can handle information by allowing the users to enter, search, and analyze
data in more than one table at a time.
• Complicated tasks can be simplified and can be made user friendly.
Dr. Kapil Harit
What is Microsoft Access?
Microsoft Access is a relational database management system
(DBMS or RDBMS). At the very core, it is a software “engine”
that provides an interface between physical data and user
application queries.

Other examples of DBMS applications include:

•Oracle
•mySQL
•SQL Server (Microsoft)
•DB2 (IBM)
•Informix Dr. Kapil Harit
Why choose MS-Access over SPSS / Excel?
Although there is always overlap, the following rules might help
when deciding when / when not to use MS Access:
•MS Access is best used for long-term data storage and/or data
sharing.
•MS Excel is best used for minor data collection, manipulation,
and especially visualization.
•SPSS is best used for minor data collection and especially data
analysis.
It is easy to export data from MS Access to Excel  SPSS
Dr. Kapil Harit
Why choose MS-Access over other DBMS systems?
• Cheap, readily available (packaged with MS-Office Premium).

• Easy to use (relative to other systems –Oracle may require one


FTE to maintain the server as a database administrator and another
FTE to serve as an application developer).

• Includes front-end tools for rapid application development


(RAD). This also makes MS-Access a good prototype
environment.
Dr. Kapil Harit
Why choose other DBMS systems over MS-Access?
• MS-Access can handle a large number of records, but is
somewhat slow compared to some of the high-end platforms.

• Multiple users may use the database simultaneously, but MS-


Access is known to become unstable with greater than 3-5
users.

• There is a “snob factor”. recommend the use of other systems


(Oracle, SQL Server, mySQL, etc) when writing grant proposals
- especially phase II type grants).
Dr. Kapil Harit
MS Access: Certain Capabilities as an ideal DBMS
• Storing the data in a an organized manner.
• Storing the data integrity constraints.
• Representing complex relationship among data.
• Providing for persistent of database objects.
• Restricting unauthorized access to database.
• Allowing fast retrieval of data with or without processing by using
SQL.
• Flexibility to create multiple user interface.
• Providing for data sharing and multiuser transaction processing.
• Supporting multiple views of data and information.
Dr. Kapil Harit
Objects in MS Access
Four Main objects:
1. Tables:
• Allows a database designer to create the data table with their
respective field names, data types and data properties to store the
data.
• In access Rows are referred to as Records and Columns are
referred to as Fields (attributes).
• A Record represents a unit of information. Every cell in a given row
is part of that row’s record.
• Every piece of information stored within a field is of same type.
• E.g. Every entry in field called “Phone_Number” would be phone
number, whereas every entry in a field called “First_Name” would
be a name.
Dr. Kapil Harit
Objects in MS Access
Four Main objects:
2. Queries:
• Create the compatible query with or without the help of GUI to
define tables, store data, and retrieve both data and
information
• Used to make ad-hoc queries about the information stored in
your tables.
• Query is able to pull information from multiple Tables and
allows the user to limit the records (rows) display by using
certain criteria and showing only the fields (columns) that
meet the specified criteria by the user.
Dr. Kapil Harit
Objects in MS Access
Four Main objects:
3. Forms:
• Allows the designer to create an appropriate user interface to formally
interact with the tables and the queries.
• It allows the users entering, modifying, and viewing records view i.e. the
data stored in the tables.
4. Reports:
• Used to create various reports, the source of information content of which is
based on tables, queries or both.
• Such reports are designed in access according to the requirements of the
end user.
• It offers the users the ability to present the data stored in the tables in print.
• The Fee Slip, or the train ticket that you receive are the examples of reports.
• Reports can be customized to make its appearance visually appealing.
• Access offers the ability to create a report from any table or query.
Together, these objects allow the users to enter, store, analyze and
compile the data. Dr. Kapil Harit
Creating Database
To create a database
1. Go to start
2. Click on All Programs
3. Go to Microsoft Office 2010
4. Click on Microsoft Access 2010
5. Select Blank Database option, with
Database followed with some number as
database name and My Documents as
default storage location.
6. Change the name by typing in the box and
then provide the storage location, by
clicking on the yellow folder sign available
against the naming box, as per the
situation.
7. Click on Create.
Dr. Kapil Harit
Blank Database

File Name

Create
File Location

Dr. Kapil Harit


Understanding MS Access Window

Database Name
Blank Database

Tabs
Work Area
Open and close button for Object
window

Navigation Pane

Objects window

Dr. Kapil Harit


Understanding MS Access Window
• Ribbon in Access contains Home, Create, External
Data, and Database Tools, which are further
segregated into groups.
• When some table object is selected, out of the tools,
the Tools Field and Table appear.
• When you double click the << button it minimizes
(closes) the Navigation pane and if the navigation
pane is closed then double click the >> to maximize
(open) it.

Dr. Kapil Harit


Creating Tables
• Access by default provides with a table in the object list.
• To customize/design the default table as per your schema:
• Right Click on the Table and select Design View
Or
• Click on View and select Design view.

Dr. Kapil Harit


Creating Tables
•Enter the Table name and click OK or press Enter.
• To create more tables in the database click on Create tab and select Table Design
under the Table Group.
•This result in providing a Table Design window, the upper part of which has three
columns: Field Name, Data Type and Description, which is meant to define the
schema of a table being created.
•Each of its rows corresponds to a column of the table to be created. Two Primary
properties of the column of a table are its Field name and the Data Type.

Dr. Kapil Harit


Creating Tables
1. Field Name: Refers to the column name of the table being created.
• The name of the column should be a string of contiguous characters.
• The field name is meant to define the name of the column to be created,
followed by the data type of such column.
• Once the data type is defined, the designer can further specify the
properties of each column in the lower part of the table window.
2. Data Type: Access supports different data types:
• Text: Short, alphanumeric values, such as a last name or a street address.
Used for a string of characters: Words or numbers that are not to be used in
any arithmetic calculations. The maximum length for a text field is 255
character. It is the default data type because of being used most frequently.
in Access 2013, Text data types have been renamed to Short Text.
• Memo: Used for storing comments and capable of accommodating 65,536
characters. Field with this type is not amenable(tractable) to sorting or
filtering of data records. Long blocks of text. A typical use of a Memo field
would be a detailed product description. In Access 2013, Memo data types
have been renamed to Long Text. Dr. Kapil Harit
Creating Tables
Data Types Cont…..
• Number, Large Number: Numeric values, such as distances. It could be
integers (-32768 to 32767), long integers (-2147483648 to 2147483647),
bytes(0-255), single (Values with decimal points up to a certain limit), double
(values with decimal points with greater magnitude and more precision) , or
decimal types. There is a separate data type for currency.
• Date/Time: Used to store dates, times or combination of both.
• Currency: Used for storing numbers in terms of various currencies viz. Dollars,
Rupees or Other Currencies.
• Auto Number: Numeric data automatically entered by Access. In a situation
where none of the fields individually or set of fields as a combination in a table
is unique.
• Yes/No: Declare a logical field which may have only one of the two opposite
values alternatively given as: Yes or No, On or Off, True or False.
• OLE Object: Stands for Object Linking and Embedding. Refers to an object that
could be a photograph, bar code image or another document created in
Dr. Kapil Harit
another software application.
Creating Tables
Data Types Cont…..
• Hyperlink: Meant to store a Universal Resource Locator (URL) and e-mail
addresses in the database
• Attachment: Can attach images, spreadsheet files, documents, charts, and
other types of supported files to the records in the database just like one
can attach files to e-mail messages. It allows viewing and editing the
attached files, depending on how you have setup the attachment field.
Attachment fields provide greater flexibility than OLE Object fields.
• Lookup Wizard: Creates a field that allows the user to choose a value from
another table or from a list of values by using a list box or Combo box.
• Clicking this option starts the Lookup wizard, which creates a lookup field
(Lookup Field: A field used on a form or report in an Access Database, that
either displays a list of values retrieved from a table or query, or stores a
static set of values)
• After you complete the wizard, Microsoft Access sets the data type based
on the values selected in the wizard. Dr. Kapil Harit
Creating Tables
Description:
• Provides a brief description of the field name entered. The designer can optionally provide
description of the column

Dr. Kapil Harit


Creating Tables
Field Properties: Once a data type of a column is specified, Access allows the designer to
define the properties of each column. These properties are of two types:
1. General Properties
2. Lookup Properties
1. General Properties:
I. Field Size: In case of text field: Maximum number of characters allowed in the column. In case of
Numbers: Type of numbers being sorted as per the requirements. Determines the range of field values.
For example, a one-bit Number field can store only integers ranging from 0 to 255.
II. Format: How the field’s contents are to be displayed. There are standard types of formats to choose
from.
III. Decimal Places: Applies to single, double, or decimal types of numbers.
IV. Input Mask: Formats for data entry that includes the place holders and punctuations. Works only for text
and numeric data types of fields, when the data to be used in the system are formatted with the
hyphens.
V. Caption: Label used in the field in the datasheet view and on the forms and reports. If left blank, the field
name entered at the time of designing database becomes the default caption, and is used to label the
field.
VI. Default Value: Used for specifying a value for new entries of data records . While entering the data item,
the operator can always overwrite the default value. The default value should be the most frequently
Dr. Kapil Harit
entered value in the field.
1. General Properties cont…
Creating Tables
VII. Validation Rule and Text: Checking of data to eliminate incorrect entries. Validation criteria can be
specified for this property. If the data so entered does not satisfy the validation criteria, the data
entry in the tables are not allowed, and the validation text gets displayed.
• E.G. Students Max Marks=100, if enter more than 100 validation rule “<=100” in the field property
• If you design a validation text “ Marks Not Permitted” than instead of the default message MS access will flash “
Marks Not Permitted”
VIII.Required: Must be provided a logical value Yes or No. When a field’s required property is set to Yes, a
user must enter data in the field before saving the record. A value of No implies that the data entry in
the field is optional. In other words, a null value is also acceptable to the database.
IX. Indexed: Indexing a field results in speeding up the sorting, searching and filtering of records on that
field. Primary key field is always indexed. For a single field primary key, Access sets the required
property to Yes and the indexed property to Yes (No duplicates), as a primary key by definition must
have unique values without null entries.
• If you set Yes (No duplicates) in the Indexed property then this field value becomes unique without assigning a
primary key.
X. Allow –Zero Length: Available only for text fields. Setting it to Yes/No determines whether a text
string with zero length is a valid entry or not.
XI. Text Align: Aligns the text that is entered in the columns to the left, right, centered, or distributed
that spreads the text evenly across the width of the column. Center alignment is the default
alignment. Dr. Kapil Harit
2. Lookup Properties Creating Tables
• Used by a field to find its values in another table, queries or from a fixed list of values.
• A list of valid values can be displayed using a list box or combo box.
• Text box is the default display control of lookup.
• Lookup is created in case of a field, which is foreign key (many side) into primary (one side) between
the tables that have one-to-many relationship.
• Its another display controls are list control and combo control. When list box or combo box is used as
display control in lookup, it is important to specify the row source( i.e. table, query, or list of values or
field list).
• The list of values must be separated by commas.
• Some additional properties in case of list box or Combo box are meant to specify the bound column
whose values are copied to the field as references.
• Number of columns to appear in the list box or combo box is determined by column count property.
• The steps for defining a column need to be repeated for every column to be created for a particular table.
• After defining the columns of the table, primary key column of the table can be specified, by right clicking the
field to be specified as primary key followed by primary key item of the right clicked window.
• If more than one field constitutes a primary key, select First field+Press and hold ctrl+click other field+ right click
at the selected fields to mark the selected fields as primary key.
• Save the Table design (Click File Tab+Save Option). Dr. Kapil Harit
Example-1
ABC limited maintains a database to store pay details of its employees using the following
two tables:
Employee
Field Description
Empcode Identification of Employees (Primary Key)
Emp_Name Name of the Employee
Department Finance, Marketing, Human Resource, Production
Experience Years of Experience
Pay_Details

Field Description
Empcode Identification of Employees (Foreign Key)
Bpay Basic pay for the month
Required:
• Create a database named as “ABC limited” that contains above tables on the desktop.
• While entering the data in pay details table, it must be ensured that the basic pay does not exceed Rs.
50,000.
• Enter Records of ten Employees.
Dr. Kapil Harit
Solution: Example-1
Step 1.
Go to start>> All Programs>>Microsoft Office Access 2010
Step 2.
Name the database and click on the folder to browse and locate the desktop press
ok and then click on Create.
Step 3.
Click on View and then Design View and name the table as “Employee” and Press
“Ok”

Dr. Kapil Harit


Step 4. Solution: Example-1
Set the Filed Properties
• Employee Code: Text; Size: 10
• Employee Name: Text; Size: 25
• Years: Number, Size: Byte( an employee usually cannot
have an experience of more than 50 years while using
byte we can enter a value up to 255)
• For the field Department select lookup wizard as field
type and follow the steps:
• Select I want the lookup field to get the values
from another table or query. If you want to list to
assume fields of some other table. Since you have
to type the list, select I will Type the values that I
want.
• Click Next>
• Type the values in the column. Click Next>
• Click Limit to list and Allow Multiple Values(If
needed)
• Click Finish
Dr. Kapil Harit
Step 5.
Solution: Example-1
Assign the Primary by either right click on the field
and click on Primary key option or select the field
and click on primary key in the Design of Table Tools
Tab.
A Primary key can assume neither a null nor a
duplicate value in the table.
Step 6
After the designing is complete click the X sign of
the work area to save the table design.

Dr. Kapil Harit


Solution: Example-1
Step 7.
Click on Create Tab and click on Table Design tab for creating the second table
named as Pay_Details
Against the Validation Rule enter <=50000 and enter the error message in
validation Text “Salary more than allowed”.
Step 8.
Save the table by pressing CTRL+S and enter the name in the box that appears and
Press Ok
Ignore the message that appears to define a primary key and Press NO as this
table doesn’t contain a primary key.
A foreign key cannot be implemented at the table design level rather it is an
outcome of the relationship between the tables.
Step 9.
Enter the records of the employees. To enter the records double click the table in
which the data has to be entered. Dr. Kapil Harit
Solution: Example 1

Field Name or
Column

Cell

Record or Row

Dr. Kapil Harit


Adding a new Record
• Can add a new record by following three ways:
1. Clicking on New in the Records in the Home Tab or by pressing Ctrl++
together.

2. Click new record on the navigation pane of the Table.


3. Start typing in the row below the row in which you last added a record.
Dr. Kapil Harit
Deleting a record
1. Select the row and right click then select delete record or Press CTRL + -.
2. Alternatively you can select Delete in records group.
Saving a Record:
1. Click the save commands in the records group on the home tab or press Shift +
Enter.
Editing a Record:
Click on the cell containing the data and edit the changes.
You can also use find and replace option (Ctrl+F and Ctrl+H)

Dr. Kapil Harit


Resizing Rows and Columns
1. Place your cursor over right gridline in the field title, you can resize
them so that all the text can be easily viewed.
Hide a column:
1. Right click on the column and then click on the Hide fields.
Unhide a column:
1. Right click on the column and then click on the unhide fields.
Sorting Records:
1. Select the field name by which you want to sort the records e.g.
Employees
2. Right click on the field name and select the order in which you want
to sort ascending or descending
Or
Click on Ascending or Descending in Sort & Filter group on Home Tab.
Dr. Kapil Harit
Filtering the Records
1. Select the field to which a filter rule is to be set.
2. Either right click or click on the Filter in sort and filter group on home
tab
3. Uncheck the rrelevant text items and the relevant checked items
should be remained checked.
4. Press Ok

Dr. Kapil Harit


Implementing Relationship Between the Tables
1. Go to Database Tools
2. Click on Relationship refer the highlighted part
3. A list of all the tables in the database will appear to you.
4. Add the table that you want to relate. In case the list doesn’t
appear click on Show Table. After adding tables click close.

Dr. Kapil Harit


Implementing Relationship Between the Tables
5. Drag the Primary Key of Employee table E_code and leave it on
the E_code of the Pay Details table.
6. An edit relationship dialogue box will appear, mark Enforce
Relationship Integrity check box. When we enforce data or
referential integrity it ensures that two tables are related
through the one field on each table in which one is the Primary
Key (Representing Parent Table) and the one that is there in
other table is the foreign key( Representing Child Table). The
data to be entered inn the foreign key table must exist in the
parent table, otherwise it would be rejected.
7. Cascades: Mark Cascade Update Related Fields if you want to
reflect the changes made to the field of parent tables in the field
of the child table.
8. Mark Cascade Delete Related Fields if you want that if a record is
deleted from the parent table, then all the related records of
that filed be deleted from the child table.
9. Click Create. Dr. Kapil Harit
Implementing Relationship Between the Tables
10. Save and close the relationship.
11. The relationship enforced above is One-To-Many as one of the table contains primary key
but the other table doesn’t. The attribute E_code that is used to link the tables in the Pay
Details Table is known as foreign key.
If both the tables contains primary keys then the relationship established will be One-To-One.
In MS Access Many-To-Many Relationship can’t be implemented directly, for having many-To-
many relationship you need to break it into two or more One-To-Many relationships.

Dr. Kapil Harit


Thank You
Dr. Kapil Harit

You might also like