Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Introduction
What is Data
Data can exist in many forms for
computer use.
Data stored on computers should be
digital but lots of types of data in the
real world involve physical
measurements of continuously varying
data.
These need to be converted into digital
data for storage and manipulations on a
computer
2
Data Types
Text
Alphanumeric Currency
Numbers AutoNumber
Integer Boolean
Long integer Yes/no
Single True/False
Double -1/0
Date/time
3
Math Operators
+ Addition
- Subtraction
* Multiplication
/ Division
\ Integer Division
^ Exponentiation
Mod Modulo (remainder) division
4
Relational Operators
= Equal
<> Not equal
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
5
Boolean Operator
And Logical And Both operands are true
Or Logical Or Either one of the
operands or both of
them are true
Xor Excusive Or Only one of the
operands (not both of
them) are true
Not Negation Operand is not true
6
String and Miscellaneous
Operators
& Concatenation
Like Similar to
7
Data Structures
• Data is often stored in files, which consist of records, which
in turn consists of fields.
•For example a Company might want to store its employee
information in the following format –
Reference No/ Name / Date-started / Department
The structure of the Employee file would be –
Ref No Name Start-Date Department
Rec -1 1416 J. Smith 30/05/2003 Sales
Rec-2 1417 K. Shah 11/02/1999 Manager Employee
Rec-3 1431 R. Marques 15/10/2001 Finance File
Rec-4
1452 T. Rodriques 27/09/1995 Sales
1461 V. Schruitz 09/12/2005 Finance
Rec-5
Field1 Field2 Field3 Field4
8
Data types of each field for the
Employee File
Ref Name Date Depart Ref No - Numeric Data
No ment (Integer)
101 Deepa Jain 12/01/2000 Accts
Name - Text
102 Sam Pai 01/09/2004 HR
Date - Date Format
103 Ekta Joshi 09/09/2002 Accts (dd/mm/yy)
11
Relational Database
Relational databases consists of a
separate tables which are related.
Each table contains a primary key field
that is also available in one other table.
With this it is possible to combine data
from different tables to produce a
report.
Tables also contain Foreign keys that
relate tables in the database to one
another. Field name may be same or
different.
12
Advantages of Relational
Databases
Faster data retrieval
Easier expansion of the database by
adding extra or new tables
Need to change data in only one table
as all other references get updated
automatically because of data integrity
13
Example of Relational Database
A garage sells cars and keeps a database of sales, customers
and servicing. The Primary key is Car Number. Invoice
Number and Engine Id are Foreign Keys
14
Example of Relational Database
Invoice Car Number Customer Name Customer Annual
Number Details Mileage
Marina G. Erechtchoukova 16
Questions – Example 2
How many records are there in the
Customer Detail Table?
How many fields are there in the
Service Table?
What type of database is being used
between the three tables?
Which field is a Foreign Key?
Marina G. Erechtchoukova 17
Access Database Objects
Tables contain rows called records and
columns called fields.
Queries are requests for specific
information from a database.
Queries are virtual tables built on a
given SQL statement
18
Access Database Objects
(cont. …)
Forms are parts of user interface. Forms
are used to enter, edit or browse data
from a database
19
Create a Database in MS Access
2007 and up
Click on the round Office button
Choose New from the drop-down
menu
In Create Blank Database window
specify the database name
Click Create
20
Create Table
Using Wizard
Design View
Specify field names
Data types
Properties
Determine a primary key
Save the table
21
Access Tables
Design view
Table structure is created and may be edited
Datasheet view
Display table content in spreadsheet-like grid,
Used for entering, editing or deleting data
from tables
22
Queries
Specify the source of data
If multiple tables are used, specify
relationships between tables
Select desirable fields from the table(s)
and options related to the fields
Specify a criterion
23
Query Criteria
To be selected a record must satisfy a
criterion
Expressions may contain the following
operators:
Math Operators
Relational operators
Boolean Operators
String Operators
Miscellaneous Operators
24
Access Forms
Create using Form Wizard
Create using Form Design view
Specify source of data will be presented by
the form
Table
Query
Specify fields related to the form
Add labels, titles, graphics and so on
25
Form Design view
Form Header –a place for titles,
graphics, additional information
Form Details section – the fields used to
create a form and control elements
related to the fields
Form footer –a place for any items
which will appear at the bottom of the
form
26
Form Controls
Must be bound with fields from the
source table or query
27
Viewing Forms
Open database
Click Forms tab to display all available
forms in the database
Select the form
Select Open
To view data use Form Navigation
Tools. To prevent data Editing, use
Locked Property for the Text Boxes
28
Creating Subforms
Represent 1:N relationships
To add a subform to a form
Create a form that will be a subform
Click on Subform/Subreport button and
then click on a form where the subform
should appear
Specify the source for the subform
Specify the fields to link the form and
subform
29
Reports
Reports present table contents or query
results in an easily assimilated format
Reports have Design view and Print
Preview
Report Design View is similar to the
Form Design view
30
Report Design View
Page Header contains data and graphics
appearing at the top of each page
Report Header contains the data and graphics
appearing at the top of the first report page
Detailed section contains data from tables or
queries
Page Footer contains the data and graphics
appearing at the bottom of every page
Report Footer contains the data and graphics
appearing at the bottom of the last report
page
31
Report Types
Columnar reports – a single record on a
page
Tabular reports – datasheets: fields
from the tables are presented as
columns
Justified reports combine two previous
types of the reports
32
Creating Reports
With a Wizard
Design view:
Specify source for the report
Select Fields from the Fields List
Add labels
Add format
Switch the view to see the result.
33