0% found this document useful (0 votes)
4 views7 pages

course 5 Access

Uploaded by

fifa03fifa3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views7 pages

course 5 Access

Uploaded by

fifa03fifa3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

INFORMATIQUE 2EME ANNEE

Course 5 : Databases under “Access”

1-Introduction

MCD MLD MPD

MPD : This step consists of implementing the model in the DBMS, that is to say
translating it into a data definition language, such as: SQL.( Structured Query Language)

The DBMS “DataBase Management Systems” is software that allows managing databases.

• Access is a relational DBMS.

• Other examples: MySQL, SQL Server, Oracle, etc.

A DBMS allows you to:

• Create a DB

• Modify the table structure

• Question the DB

• Modify the DB…

2- Some constraints

• Two tables in the same database cannot have the same name.

• Two fields in the same table cannot have the same name.

• The same field can be present in several tables.

• The names of tables and fields must not contain a space or a special character
such as: “é” or “{”, but they can contain a “_”.

3- Access home screen (creation of database):

Microsoft Access (officially Microsoft Office Access) is a relational database


manager published by Microsoft.

1
INFORMATIQUE 2EME ANNEE

Here is its home screen:

For create a
new DB

Examples
of DB

Name
of DB

4- Interface Access :

Formatting
buttons

Tables of
DB
The columns
of table 1
Access tabs

Note: Table 1 is a table automatically created by Access, because you cannot create a
database that does not contain a table.
2
INFORMATIQUE 2EME ANNEE

5- Creation of Tables:
To create a new table in our new database, we click on the “Create” tab then on
“Table Creation” and the table will be created, but it will be empty (i.e. without
columns and without rows)

To add columns and rows, Access uses two display modes:

a- Design mode (Mode Création ): to specify the columns.

b- Datasheet mode(Mode feuille de données ): to specify the rows.

And here is an example:

Assuming we have the following table in our database:

PRODUIT (IdPro, IdCategorie, Designation, Marque, PrixUHT,dateFabric, Qstock)

The creation mode is as follows:

The datasheet mode (Mode feuille de données ) after creation is as follows:

We can now enter the rows (or lines) of the table which are called
records(“enregistrements” in French), and here is an example:

3
INFORMATIQUE 2EME ANNEE

After creating this table you can enter, delete, modify records.

Note: in the IDprod column if we enter an ID that already exists access will display an
error message and also if we want to enter a new product without typing its ID access
will display another error message.

6- Field types:
 Numeric: By default, it is an integer but you can specify if it is a real number.
This field format allows you to enter numbers in different formats:
 Byte: (octet in French) integers from 0 to 255.
 Integer (2 bytes): (Entier in French) integers between - 32,768 and + 32,767.
 Long integers (4 bytes): between -2 147 483 648 and + 2 147 483 647
 Real: Access uses the scientific writing of real numbers. Example: if we write
in Access the number: -123456 it will be displayed: -1.23456E+05.

-123456 = - 1,23456 x 10 5

Sign mantissa exponent


 Simple real (4 bytes): the mantissa contains a maximum of 7 digits and
the exponent is less than or equal to 38.
 Real double (12 bytes): the mantissa contains a maximum of 15 digits
and the exponent is less than or equal to 308.
4
INFORMATIQUE 2EME ANNEE

 AutoNumber: (NuméroAuto in french) number incremented each time a new


record is inserted.

The automatic number is a long integer. It is assigned by the system, and the user
cannot change it. The increment can be regular (+1), or random (signed numbers).
The same number is never assigned twice.

Attention ! When a line is deleted, the automatic number will not be reused by the system.

 Text: allows you to create a field with mixed letters and numbers. You
cannot do calculations in these types of fields. We can specify its size
(but if we don't change it, it will be equal to 255 characters).
 Memo: is equivalent to TEXT but can contain more information. The
maximum size is 65 535 characters.
 Yes/No: this corresponds to fields which can only take one of the two
values YES or NO. (for example: amount paid or not)
 Date/Time: Type of fields which indicate a notion of time. Several
formats are available. For example :

 Monetary (4 bytes): numbers between -922 337 203 685 477.5808 and
922 337 203 685 477.5807

Note: the monetary type uses the Windows default monetary and to change it you
must modify the Windows regional settings.

 Still other types but rarely used.

5
INFORMATIQUE 2EME ANNEE

7- Access field properties:


The most important additional properties of Access fields are:
 Size of the field (for text and numeric types), for example: we can set the
maximum size of the “first name” field to 40 characters.
 Format: This format affects the way the information is displayed (not entered),
for example: if we choose the “full date” format (“date complète” in French) the
date will be displayed as follows: Tuesday October 18, 2022.
 Input mask: (“masque de saisie” in French) determines how data should be
entered.
For example: if you choose the “reduced date” format, the date must be entered
as follows: 18-Oct-2022.
 Decimal: (for numeric and monetary types only), the number of digits behind the
decimal point. For example: for student averages we can set 2 so that the system
displays only 2 digits after the decimal point.
 Legend: a name that will replace the field name in datasheets.
For example: if in the MLD model a field is called “NumM” we can use this name
when creating the table but if we want to display to the user a full name we enter
in the legend: “merchandise number".
 Default value: the value proposed automatically. For example: if you want
“Access” to display the current date automatically in a field, you can type in the
default value: “Date( )”.
 Valid if: validation rule for data entered.
Example1: a student's mark must always be less than 20.

6
INFORMATIQUE 2EME ANNEE

Example2: if we have a field in our database called “Expiration date” and we want
to enter only unexpired products, we can write in the field of “valid if”: “> Date( )”, and
the system will only accept unexpired products.
 Message if error: This allows you to display a message in the case of invalid
data (in the case of using Valid if).
Example: if we take the previous example, our system must display an error message
if we want to enter an expired product. Here is the error message:

Null prohibited :(Null interdit ) If the choice is yes, data must be entered.
Example: if we take the previous example, if we enter a product without entering
its expiration date, Access will display the following message:

You might also like