INTRODUCTION TO DATABASE_M3
INTRODUCTION TO DATABASE_M3
DATABASE:
A System to maintain, secure, manage and process the data stored in databases is
known as Database Management System. Database Management System
(DBMS) refers to the technology solution used to optimize and manage the storage
and retrieval of data from databases.
OBJECTS OF MS-ACCESS
MS Access uses “objects" to help the user list and organize information, as well as
prepare specially designed reports. When you create a database, Access offers
you Tables, Queries, Forms, Reports, Macros, and Modules. Databases in Access
are composed of many objects but the following are the major objects −
• Tables
• Queries
• Forms
• Reports
• Macros
These objects allow you to enter, store, analyze, and compile your data.
Tables
A database table is composed of records and fields that hold data. Tables are also
called datasheets. Each table in a database holds data about a different, but
related, subject.
Eg:
Database Table
Records
Data is stored in records. A record is composed of fields and contains all the data
about one particular person, company, or item in a database. A record is also
commonly called a row or an instance. A record consists of field values, also
commonly called a fact.
Eg:
In this database, a record contains the data for one customer support incident
report. Records appear as rows in the database table. A record for Log ID
1201242 is highlighted in Figure.
Fields
A field is part of a record and contains a single piece of data for the subject of
the record. A field is also commonly called a column or an attribute.
Eg:
In the database table illustrated, each record contains four fields:
Log ID, Operator, Resolved, Duration
Fields appear as columns in a database table. Data from the Log ID field for five
records is highlighted in the Figure.
Query
An object that provides a custom view of data from one or more tables. Queries
are a way of searching for and compiling data from one or more tables.
• When you build a query in Access, you are defining specific search
conditions to find exactly the data you want.
• In Access, you can use the graphical query by example facility or you can
write Structured Query Language (SQL) statements to create your queries
Form
• The reason forms are used so often is that they are an easy way to guide
people toward entering data correctly.
• When you enter information into a form in Access, the data goes exactly
where the database designer wants it to go in one or more related tables.
Report
• You can view a report on your screen before you print it.
• If forms are for input purposes, then reports are for output.
Step 1
Click Table Design from the Ribbon
A blank table called Table1 will be displayed in Design View.
Step 2
Add Fields to the Table
Now we will enter each field and select their data type.
In the first cell under Field Name add a field called GRno:. Select Autonumber as
its data type.
Under that field, create a new one called Name and select Short Text for its data
type.
Change the Name Field Properties at the bottom Field Properties frame.
Step 3
Set a Primary Key
Right-click on the GRno: field and select Primary Key from the drop down list.
This makes the field a primary key field. Once you've done this, you'll see a little
key icon to the left of GRno:.
A primary key is the unique identifier for the table. Each value in this field will be
unique — no two records in the table can have the same value in the primary key
field.
This is why we set it to Autonumber. Access will automatically generate a number
each time a new record is created.
Note that a table can only have one primary key.
Step 4
Save the Table
Right-click on the Table1 tab and select Save from the drop down list.
Datasheet View
Datasheet View displays the table as a grid. The fields are displayed as columns,
and the records are displayed as rows. The field names are listed as the column
headers.
Datasheet View displays the data. If this table had data, it would be displayed in
the cells.
Each row represents a record. If the table had say, five records, there would be
five rows of data.
In Datasheet View, if you want to find out a field's data type, you need to select
that field, and then select the Fields tab on the Ribbon. The field's data type and
other properties will be listed on the right side of the Ribbon.
Design View
Design View doesn't display any data. Therefore, there's more space available to
display other settings.
In Design View, the fields are listed vertically. They are listed above and below
each other as opposed to side-by-side.In Design View, you can see the data type
listed next to each field.
The way Design View works is, when you click on a field (in the top frame), the
bottom frame displays the properties for that field. You can then change these
properties as required.
Tables in access can be modified by inserting, deleting, hiding and moving
fields.
WORKING WITH DATA:
Calculations, sorting and filtering of data can be done in MS-Access.
To do calculations:
Home tab- records group – totals command.
The total row appears at the bottom of the table. Click on the field where
calculation has to be done, select function from the drop-down menu.
To sort:
Sorting depends on the type of data entered in each field.
Select the field – right click – sort option
To filter data:
Select the field where filter need to be applied.
Right click- filter data – select values that has to be filtered - click ok