Chapter At a Glance-16
Chapter At a Glance-16
Desktop Database
Desktop database is mostly designed to run on “desktop” or personal computers. It is much cheaper and simpler.
Most of the desktop databases are very user friendly. A user does not need to understand SQL in order to use
them, and contain a fairly graphical interface. It also many a times provides web solutions so that the user can
publish data onto the web in various fashions. Microsoft Access is a very popular, well known, desktop database
that many people already own.
1
Server Database
Server database is comparatively more complex and expensive than desktop database. This type of databases
offer organizations the ability to manage large amounts of data and many users. In a server database, APIs are
used for rapid development of custom applications providing users with a lot of flexibility. It can also expand
very quickly if the money is put into investing the proper hardware into one. Unfortunately, this can get rather
costlier. Common server database includes Microsoft SQL Server and Oracle.
2
In the left side Navigation Pane you will see that a default table has already been created and the same is also opened
up in the working area of the window.
We can straight away start working on this table assuming it to be our first table. All we have to do is to type an
employee name (say ‘Ram Kishore’) in the second column and click enter (or use Tab) to move to third column; type
a designation ID (say ‘1’) followed by enter; and finally move to fourth column and type a location ID (say ‘1’).
In this case, Access will automatically set a data type for each field based on the type of data entered into each
column. You will see that headings of these columns are named as ‘Field1’, ‘Field2’ and ‘Field3’.
Move the mouse pointer over the column heading ‘Field1’ and then double-click to select the column heading.
Type ‘EmpName’ and press enter to change the column name from ‘Field1’ to ‘EmpName’. Similary, change the names
of columns ‘Field2’ and ‘Field3’ to ‘DesgID’ and ‘LocationID’.
You might have noticed by now that the first column of the table has the name ‘ID’ which was created automatically.
This is an AutoNumber field in which the field value is assigned automatically by Access as we enter a new record.
Move the mouse pointer over ‘ID’ heading; double click to select this heading, and change its value to ‘EmpID’.
The structure of the ‘Table’ in the Datasheet View is already complete. At this stage, you can choose to enter the
values of the other records as well. If you are not contended with the width of any column in your table then with
the insertion point positioned in any record of this column click
Home Tab > More (under Records Group) > Column Width.
Click on the Save button on the Quick Access toolbar on left hand top corner of window. A Save As dialogue box will
appear with the default table name. Replace the name with ‘TabEmpDetails’ and press enter or click OK button to
save the table with the intended name.
Now let us look at this table in Design View. Click on the View button placed on the left end of the ribbon (in View
group) under the Datasheet Tab. In Design View, you can tell Access which all fields will go into the table by entering
desired attributes in the column titled ‘Field Name’. The type of data corresponding to each attribute can be identified
in the column ‘Data Type’.
Having fully completed the structure and data of our first table and also having understood the various concepts
related to its design, we can now move on and create rest of the four tables. Click on Create Tab > Table Button.
You can choose this view or the Design View to create the rest of the tables and save them under intended names.
The field names and data types of all five tables are summarrised as under:
3
Having completed the designs of all data tables, we will now move on to the task of establishing relationships
between different tables. Click on the Database Tools Tab and then Relationships button under Show/Hide
group. In the working area, a Show Table dialogue box will appear. In case you do not see this dialogue box
click on Design > Show Table. In the Show Table dialogue box, select a table and click Add button to add it in
the relationship window. Add all the five tables in this manner. Close the Show Table dialogue box by clicking
on Close button.
In the working area you will see all five table objects, each detailing the fields within them. You can reposition
these table objects anywhere within the relationship window. To do this, point the mouse pointer in the caption
area of the selected table object, hold down the left mouse button and then drag the mouse to shift table to
its new location.
Now to create a relationship between TabMonthlySalary and TabDARates, position the mouse pointer over
MonthID in the TabMonthlySalary table object, hold down the left mouse button, drag the pointer right to
MonthID in the TabDARates, and then release the mouse button. A Edit Relationships dialogue box will appear
as soon as you release the mouse button. You will notice that the dialogue box shows relationship type as One-
To-Many.
Access has determined the relationship type based on the fields selected for joining the two tables. Click on
the Create button. A black line will appear joining the two tables at the common field. This line, also referred
to as Join Line, establishes the relationship between TabMonthlySalary and TabDARates using the common field
of MonthID. Remember, MonthID forms Primary Key in TabDARates and Foreign Key in TabMonthlySalary and
hence is the relationship One-To-Many type. You may now repeat above steps to establish other relationship
between the tables. The overall relationship between different tables are summarised as under:
Table Related Table Common Field Relationship Type
TabDARates TabMonthlySalary MonthID One-To-Many
TabEmpDetails TabMonthlySalary EmpID One-To-Many
TabDesignations TabEmpDetails DesgnID One-To-Many
TabLocations TabEmpDetails LocationID One-To-Many
4
At this stage, if you click on the Run button under Results group of Design Tab, you will see the result of Query
displayed with the fields of SalaryID, SalMonth, EmpName, and Basic. Clicking of ‘Run’ actually tells the Access
to execute all instructions stored by you in the Query, and to display the results. You may adjust the column
widths by any of the methods described earlier for Tables. Click on the Save button on the Quick Access toolbar.
At the Save As disalogue box, type QueryMonthlySalary and click OK to save our Query.
As we are not seeing the computational fields and the field of Ded For PF in the DataSheet View. Go back to
the Design Grid view by clicking on Design View under Home Tab. In the Design Grid, Click on the Field row of
the first blank column (after Basic) and type ‘DA: [Basic]* [TabDARates. RateOfDA]/100’. In this expression, the
word ‘DA’ coming before the column(:) will be treated as the name of the computational field which will appear
as heading of the column. The rest of the typed part will form the actual expression which will be evaluated
and its value displayed on clicking of Run command.
In our expression for ‘DA’, we have made use of ‘Basic’ field which is already forming a part of Query by taking
it within the square parenthesis ([ ]). We have also made use of ‘RateOFDA’ field which is not appearing in the
Query columns; and for this we recorded the corresponding Table name as well as Field name separated by a
period (.) within the square parenthesis. It may be easily comprehendable that the operator ‘*’ and ‘/’ stand
for multiplication and division respectively. At this stage if you click on the ‘Run’ command, you will notice the
last field for ‘DA’ with its computed values for different employees as per the % DA Rates for different months.
Come back to the design view (by Clicking Design View button under Views Group) and repeat above listed
procedure to fill up the next field of Query for computing HRA using the expression ‘HRA: [Basic]*
[Tab Locations. RateOfHRA]/100’. The next column in the Query is for the TA field, which is to be included as
such from the Table ‘TabDesignations’ using any of the methods enumerated earlier. Next, create the field for
‘Gross Salary’ by typing the expression ‘GrossSalary: [Basic]+[DA]+[HRA]+[TA]’.
Now we can also include the field of ‘DedForPF’ from the ‘TabMonthlySalary’. Finally, we shall include the field
of Net Salary using the simple expression ‘NetSalary: [GrossSalary]-[DedForPF]’. At this stage, save your Query as
instructed earlier and also run the ‘Run’ command to look back the outcome of your effort in the Data Sheet View.
For a better presentation, you may also like to sort the records in ascending or descending order against a
chosen field of the Query. For this, click on the Sort row below the Emp Name field. Now Click on the pull down
button that appears on the end of the cell and select Ascending. Run the Query and notice that the records are
alphabetically arranged as per names of the employees.