is.cba.edu.kwis.cba.edu.kw/240/Access Tutorial/Access Note-TA. Waad... · Web viewA program that...

16
Kuwait University College of Administration Sciences Department of QMIS 240 Access Review Session Fall -2017 Prepared By TA. Waad Akra

Transcript of is.cba.edu.kwis.cba.edu.kw/240/Access Tutorial/Access Note-TA. Waad... · Web viewA program that...

Page 1: is.cba.edu.kwis.cba.edu.kw/240/Access Tutorial/Access Note-TA. Waad... · Web viewA program that can be used to store and manipulate data among multiple tables, such as Access (which

Kuwait UniversityCollege of Administration SciencesDepartment of QMIS240

Access Review SessionFall -2017

Prepared ByTA. Waad Akra

Page 2: is.cba.edu.kwis.cba.edu.kw/240/Access Tutorial/Access Note-TA. Waad... · Web viewA program that can be used to store and manipulate data among multiple tables, such as Access (which

Created By:

TA. Waad S. A

Kuwait UniversityCollege of Business Administration

Quantitative Methods & Information Systems

Introduction to Management Information Systems (QM240)

Topics to be covered:- What is DataBase (DB) Means?

It is a storage system that consists of a collection of tables that contain data and other objects. The data stored in a database is usually related to a particular subject or process, such as inventory information for a manufacturing warehouse.

Simply a database is an organized collection of data which can be successfully updated, retrieved, or modified.

It is also known as a collection of information organized in such a way that a computer program can quickly select desired pieces of data. You can think of a database as an electronic filing system.

Databases are organized by fields, records, and files:

- A field is a single piece of information.

- A record is one complete set of fields.

-A file is a collection of records.

For example, a telephone book is analogous to a file. It contains a list of records, each of which consists of three fields: name, address, and telephone number.

- Why do we use Database? Why it is important?

Databases can store and organize very large numbers of records efficiently. It is very quick and easy to find information. It is easy to add new data and to edit or delete old data, (records). Data can be searched easily, e.g. 'Find all Students who have GPA 3.5 and above'. More than one person can access the same database at the same time - multi-access. Security may be better than in paper files, and more….

P a g e | 2

Page 3: is.cba.edu.kwis.cba.edu.kw/240/Access Tutorial/Access Note-TA. Waad... · Web viewA program that can be used to store and manipulate data among multiple tables, such as Access (which

Created By:

TA. Waad S. A

Kuwait UniversityCollege of Business Administration

Quantitative Methods & Information Systems

- What is Relational DataBase Management (RDBM) Means?

A program that can be used to store and manipulate data among multiple tables, such as Access (which used for homes or small business), MSQL, and Oracle etc…, but all of them have the same functionalities.

Microsoft Access lets you store data into files, it contains seven main kinds of objects these are all stored together in one file (.mdb) extension and are called databases. Inside the database, there are tables and they are the most important type of objects, because that’s where the data are stored.

Each table has its own fields. Each field will have a certain value or piece of information.

The hierarchy of a database goes like this: Database Table Field Value. Forms and Queries are indispensable tools for viewing and editing data. Reports work great for creating hard copies of data. You are less likely to use Pages, Macros, or Modules.

- Why (RDBM) is important?

By using the RDBM you will be able to reduce the unnecessary data or redundant data.

- What are the Phases to design a Database?

A) Logical Design:

1) Conceptual Design.

2) Logical Design.

3) Normalization.

1- Conceptual Design

The result of this phase is an Entity-Relationship (ER) diagram. It describes how different entities (objects, items) are related to each other. It also describes what attributes (features) each entity has.

2- Logical Design

The result of the logical design phase (or data model mapping phase) is a set of relation schemas. The ER diagram is the basis for these relation schemas. Creating relation schemas (ER diagram) is quite a mechanical operation, and they are the basis for table definitions. In this phase (if not done in previous phase) the primary keys and foreign keys are defined.

P a g e | 3

Page 4: is.cba.edu.kwis.cba.edu.kw/240/Access Tutorial/Access Note-TA. Waad... · Web viewA program that can be used to store and manipulate data among multiple tables, such as Access (which

Created By:

TA. Waad S. A

Kuwait UniversityCollege of Business Administration

Quantitative Methods & Information Systems

- What is ER Diagram? It is stands for Entity Relationship, and it is a graphical representation of entities and their relationships to each other.

- What are the Main Parts of ER Diagram?1) Entity (later on in physical design it is called Table) It is the first building block of the

data model, such as a person, place, thing, concept, or event about which your organization maintains facts. For example: “STUDENT,” “INSTRUCTOR,” and “COURSE” are specific entities about which a college or university must be knowledgeable to perform its business.

2) Attribute = (later in physical design it is called field): It is a characteristic of an entity that we want to store information about. Each attribute (field) has data type (Look at Table1 ) , and size.

As a general rule of thumb, nouns tend to be entities and adjectives tend to be attributes.

Table 1

DATA TYPE WHEN TO USE

* Short TextUse for fields that contain text or combinations of text numbers or other characters. Stores up to 255 characters. Also use for numbers that will not be used in calculations (e.g. Zip codes).

*Long Text Use for long text entries. Stores up to 65,536 characters.

* Number Use for numeric data that will be included in calculations (except currency). The Field Size property allows you to specify the type of number (Fraction or integer).

* Date/Time Use for dates and times

* Currency Use for currency

AutoNumber Use for automatic numbering (generate numbers automatically) that can be used for primary key. (Ex. Student number 1,2,3,4..etc)

* Yes/No Use when there are only two choices, such as Yes/No, True/False, On/Off. Can be displayed as a checkbox.

OLE Object Use for objects such as Word documents, Excel spreadsheets, pictures, sounds and other (Object Linking and Embedding) objects created using OLE, in other programs.

Hyperlink Hyperlink Use for hyperlinks

Lookup wizard Allows you to create a list of choices for the user to pick from.

P a g e | 4

Page 5: is.cba.edu.kwis.cba.edu.kw/240/Access Tutorial/Access Note-TA. Waad... · Web viewA program that can be used to store and manipulate data among multiple tables, such as Access (which

Created By:

TA. Waad S. A

Kuwait UniversityCollege of Business Administration

Quantitative Methods & Information Systems

3) Relationship: A relationship is an association that exists between two relational database tables (entities) that links instances of entities when one table has a foreign key that references the primary key of the other table (entity). In other words, relationship is how the data is shared between entities (could be one entity or 2 entities or 3 entities). There are three types cardinalities associated with relationships:

1. One-to-One One instance of an entity (A) is associated with one other instance of another entity (B). For example, in a database of employees, each employee name (A) is associated with only one social security number (B).

2. One-to-Many One instance of an entity (A) is associated with zero, one or many instances of another entity (B), but for one instance of entity B there is only one instance of entity A. For example, for a company with all employees working in one building, the building name (A) is associated with many different employees (B), but those employees all share the same singular association with entity A.

3. Many-to-Many One instance of an entity (A) is associated with one, zero or many instances of another entity (B), and one instance of entity B is associated with one, zero or many instances of entity A. For example, for a company in which all of its employees work on multiple projects, each instance of an employee (A) is associated with many instances of a project (B), and at the same time, each instance of a project (B) has multiple employees (A) associated with it.

P a g e | 5

Page 6: is.cba.edu.kwis.cba.edu.kw/240/Access Tutorial/Access Note-TA. Waad... · Web viewA program that can be used to store and manipulate data among multiple tables, such as Access (which

Created By:

TA. Waad S. A

Kuwait UniversityCollege of Business Administration

Quantitative Methods & Information Systems

3- Normalization

Normalization is the last part of the logical design. The goal of normalization is to eliminate redundancy. Redundancy means that the same data is saved more than once in a database. If a piece of data is saved in more than one place, the same data must be updated in more than one place. Normalization is a technique by which one can modify the relation schema to reduce the redundancy. Example, if a relationship associates two entities with Many to Many the normalization process results in the creation of three different tables. Example: (the relationship between SALES and PRODUCT is many to many, in this case we should create the third table between them which is SALEDETAILS as associative table).

B) Physical Design:

The goal of the last phase of database design, physical design, is to implement the database. At this phase one must know which database management system (DBMS) is used. In our tutorial we will use Microsoft Access.

Creating A New Microsoft Access Database:

- How many objects are there in MS Access? They are 7 components, but we will focus on:

Table Form Query Report

Relationship

P a g e | 6

Page 7: is.cba.edu.kwis.cba.edu.kw/240/Access Tutorial/Access Note-TA. Waad... · Web viewA program that can be used to store and manipulate data among multiple tables, such as Access (which

Created By:

TA. Waad S. A

Kuwait UniversityCollege of Business Administration

Quantitative Methods & Information Systems

- Steps:

1. Open Microsoft Access.

You should be able to find Microsoft Access if you go to Start Programs Microsoft Office

Microsoft Access.

2. Click on File New.

When Access open, create a new database by clicking on File New. Alternatively, you can

click on the "New" icon on the toolbar.

3. On the new tab on the right, select "Blank database...”

For this reading, we will be creating a blank database. You will notice there are at least 4 other

methods of creating a new Access database file. For now, we want to create a blank database,

so select that choice. Once you click on it, a new dialog window will open asking for the

location to store you first Access database (figure 1).

4. Creating the database file.

In this new window, select any location, give it any file name (maybe "MyFirstAccessDB")

and click "Create". You have just created a Microsoft Access database. However, this database

is empty. How do you put data into your Access database? Without data, the database is really

of no use.

P a g e | 7

Page 8: is.cba.edu.kwis.cba.edu.kw/240/Access Tutorial/Access Note-TA. Waad... · Web viewA program that can be used to store and manipulate data among multiple tables, such as Access (which

Created By:

TA. Waad S. A

Kuwait UniversityCollege of Business Administration

Quantitative Methods & Information Systems

Figure 1

P a g e | 8

Create your own new database

The Location to store your Database

Insert the name of your

database

Click to create it

Page 9: is.cba.edu.kwis.cba.edu.kw/240/Access Tutorial/Access Note-TA. Waad... · Web viewA program that can be used to store and manipulate data among multiple tables, such as Access (which

Created By:

TA. Waad S. A

Kuwait UniversityCollege of Business Administration

Quantitative Methods & Information Systems

5- Creating a Database Table.

You will learn how to create a table for your Access database into which you put actual data!

Now you know that Databases store information in tables. Once you create the table and define

what kind of data goes into it, you can start adding actual data into the table (data entering).

Go to Create Tab Table Design. (Figure 2)

Tables (The Storage): Tables = entity = File

Contain all of the actual data in the database which can be edited directly, but it is better to create forms for editing data. Relationships between tables can be defined for the database.

P a g e | 9

The Name of the table

Right click to set the primary key for the

customer ID

Type the name of the field

Determine the size of the field

Select the data Type

Design View

Page 10: is.cba.edu.kwis.cba.edu.kw/240/Access Tutorial/Access Note-TA. Waad... · Web viewA program that can be used to store and manipulate data among multiple tables, such as Access (which

Created By:

TA. Waad S. A

Kuwait UniversityCollege of Business Administration

Quantitative Methods & Information Systems

- What is Primary Key, and what is a foreign Key?

A primary key is a column that uniquely identify a row (record). Every table should have a primary key. And a table cannot have more than one primary key.

A foreign key is a column or set of columns in one table whose values must have matching values in the primary key of another table. A foreign key is said to reference its primary key, it shows the relation.

CUSTOMER is an entity (table)

The table forms of rows and columns:

- The rows consist records (row = record) and each record has many fields.- The column consists the attributes = fields of specific type.

6- Creating the Relationship.

P a g e | 10

Datasheet View

Column =Field =Attribute

Row=Record

Data

Page 11: is.cba.edu.kwis.cba.edu.kw/240/Access Tutorial/Access Note-TA. Waad... · Web viewA program that can be used to store and manipulate data among multiple tables, such as Access (which

Created By:

TA. Waad S. A

Kuwait UniversityCollege of Business Administration

Quantitative Methods & Information Systems

How to define the Relationship between the tables in Access?

- Referential Integrity:Referential integrity is a set of rules designed to prevent you from accidentally deleting or changing records in a primary or parent table when there are related records in a secondary table. To set referential integrity, click the checkbox before creating the join.

- Cascade Update:If cascade update is selected, then if a record is changed in a primary table, the related records in a secondary table are updated. For example, if you changed a primary key in the primary table, the new key would be reflected in any related records. Referential integrity must be enforced for cascade update to be available.

- Cascade Delete:If cascade delete is selected, and a record is deleted from a primary table, all related records in the secondary table are deleted. USE EXTREME CAUTION with this feature. Referential integrity must be enforced for cascade delete to be available.

7- Creating Forms.

Form gives another way of looking, it allows the user to view or displays the contents of just one record at a time, while table allow the user to view many records at a once.

So the form functions are:

- View contents of one record.

- Useful for entering data into new record.

P a g e | 11

Page 12: is.cba.edu.kwis.cba.edu.kw/240/Access Tutorial/Access Note-TA. Waad... · Web viewA program that can be used to store and manipulate data among multiple tables, such as Access (which

Created By:

TA. Waad S. A

Kuwait UniversityCollege of Business Administration

Quantitative Methods & Information Systems

- Updating data in an existing record.

8- Creating Queries.

In a query we retrieve specific information according to criteria or conditions.(Will be discussed the Lab)

9- Creating Reports.

Used to display data from one or more tables in a format that is neatly laid out to be easier for the user to mentally digest, the same data can be displayed in different ways by different reports.

P a g e | 12