0% found this document useful (0 votes)
9 views

Week 3

The document discusses the history of databases from the 1950s to present. Early databases were simply collections of data stored on computers. The relational database model was developed in the 1970s and became the standard, using Structured Query Language (SQL) to organize and retrieve data from related tables. The document also covers popular database management system types, database models, and how to create databases using Microsoft Access.

Uploaded by

Game Account
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)
9 views

Week 3

The document discusses the history of databases from the 1950s to present. Early databases were simply collections of data stored on computers. The relational database model was developed in the 1970s and became the standard, using Structured Query Language (SQL) to organize and retrieve data from related tables. The document also covers popular database management system types, database models, and how to create databases using Microsoft Access.

Uploaded by

Game Account
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/ 61

Week 3 – Databases Management

Definition ................................................................................................................................................................. 2
Section 1: History of Databases ............................................................................................................................. 2
Section 2: Database Management Systems ........................................................................................................... 5
Popular types of DBMSes..................................................................................................................................... 6
Relational database management system (RDMS): .......................................................................................... 7
NoSQL DBMS .................................................................................................................................................. 7
In-memory database management system (IMDBMS): ................................................................................... 7
Columnar database management system (CDBMS) ......................................................................................... 8
Cloud-based data management system ............................................................................................................. 8
Advantages of a DBMS ........................................................................................................................................ 9
Section 3: Models of Databases ............................................................................................................................ 10
Hierarchical Database Model .............................................................................................................................. 10
Network Model ................................................................................................................................................... 11
Entity Relationship Model .................................................................................................................................. 11
Object-Oriented Database Models ...................................................................................................................... 15
Relational Model................................................................................................................................................. 16
Normalization ..................................................................................................................................................... 17
Data Types .......................................................................................................................................................... 20
Big Data and Metadata ....................................................................................................................................... 21
Section 4: Creating Databases using Microsoft Access ..................................................................................... 22
Tables .................................................................................................................................................................. 22
Forms .................................................................................................................................................................. 23
Queries ................................................................................................................................................................ 23
Reports ................................................................................................................................................................ 23
Microsoft Access 2016 ....................................................................................................................................... 25
The Interface ................................................................................................................................................... 25
Object working and sorting in the Navigation pane ....................................................................................... 26
Understanding tables....................................................................................................................................... 27
Validation rules ............................................................................................................................................... 31
Working with Forms ....................................................................................................................................... 33
Subforms ......................................................................................................................................................... 36
Queries ............................................................................................................................................................ 39
Reports ............................................................................................................................................................ 50
References .............................................................................................................................................................. 61

COM-1010 Introduction to Information Technology Page 1


WEEK 3 – Database Management

Definition

What is a Database Management System?

A Database Management System is the tool that allows a person to organize, store, and retrieve data
from a computer. In other words, it is a way of communicating with a computer’s stored memory.

 Databases have played a very important part in the recent evolution of computers.

Databases Definition

Databases are basically containers for data. Taking as an example a public library which stores books,
we could also say that a library is a database of books. Databases are computer structures that save,
organize, protect, and deliver data. A system that contains databases is called a database management
system, or DBM.

Section 1: History of Databases

Early 1950s: At the time, computers were basically giant calculators and data (names, phone numbers)
was considered the leftovers of processing information. It was the time that computers were just starting
to become available to the public, and businesses, so the leftover data suddenly became important.

In 1960s: A database, as a collection of information, can be organized so a Database Management


System can access and pull specific information.
 In 1960, Charles W. Bachman designed the Integrated Database System, the “first” DBMS.
 IBM, at the same time, created a database system of their own, known as IMS.
 Both database systems are described as the forerunners of navigational databases.

By the mid-1960s, because if the fast development of computers, many kinds of general database
systems became available.
 This lead to Bachman forming the Database Task Group.
 This group took responsibility for the design and standardization of a language called Common
Business Oriented Language (COBOL).
 The Database Task Group presented this standard in 1971, which also came to be known as the
“CODASYL approach.”
 The CODASYL approach was a very complicated system and required substantial training.
 Searching for records could be accomplished by one of three techniques:
1. Using the primary key (also known as the CALC key)
2. Moving relationships (also called sets) to one record from another
3. Scanning all records in sequential order

COM-1010 Introduction to Information Technology Page 2


In 1973: Michael Stonebraker and Eugene Wong (both then at UC Berkeley) research relational
database systems.
 The project was called INGRES (Interactive Graphics and Retrieval System), and successfully
demonstrated a relational model could be efficient and practical.
 INGRES worked with a query language known as QUEL.
 This forced IBM make a move so they developed SQL in 1974 (more advanced computer
language - SQL became ANSI and OSI standards in 1986 1nd 1987).
 SQL quickly replaced QUEL as the more functional query language.
 It was also in this decade that Relational Database Management System, or RDBMS, became a
recognized term.

In 1976: A new database model called Entity-Relationship, or ER, was proposed by P. Chen. This
model made it possible for designers to focus on data application, instead of logical table structure.

In 1980s: Structured Query Language, or SQL, became the standard query language.
 Also, Relational database systems became a commercial success because of the rapid increase
in computer sales, causing a major decline in the popularity of network and hierarchical
database models.
 DB2 became the main database product for IBM.
 The introduction of the IBM PC at the time resulted in the establishments of many new database
companies and the development of products such as: PARADOX, RBASE 5000, RIM, Dbase
III and IV, OS/2 Database Manager, and Watcom SQL.

Early 1990s: New client tools for application development were released, including the Oracle
Developer, PowerBuilder, VB, and others. In addition, a number of tools for personal productivity, such
as ODBC and Excel/Access were developed.

Mid 1990s: The development of the Internet led to exponential growth of the database industry,
allowing the average desktop users using client-server database systems to access computer systems
that contained legacy data.

In late 1990s: the increased investment in online businesses resulted in a rise in demand for Internet
database connectors, such as Front Page, Active Server Pages, Java Servelets, Dream Weaver,
ColdFusion, Enterprise Java Beans, and Oracle Developer 2000.
 The use of cgi, gcc, MySQL, Apache, and other systems brought open source solution to the
Internet.
 With the increased use of point-of-sale technology, online transaction processing and online
analytic processing began to come of age.

In early 2000s: Although the Internet industry experienced a decline, database applications continue to
grow.
 New interactive applications were developed for PDAs, point-of-sale transactions, and
consolidation of vendors.
Until today, the three leading database companies in the world are Microsoft, IBM, and Oracle.

COM-1010 Introduction to Information Technology Page 3


Database Management Systems (DBMS)

1960’s Hierarchical Network


1970’s Navigational
1980’s Relational

1990’s Object-oriented & Object-relational (Distributed)

XML IMDB
1995’s+ Java CMDB Mobile
Embedded

2000’s+ Post Relational

COM-1010 Introduction to Information Technology Page 4


Section 2: Database Management Systems
Database Management Systems (DBMS) makes it possible for end users to create, read, update and
delete data in a database. The DBMS essentially serves as an interface between the database and end
users or application programs, ensuring that data is consistently organized and remains easily
accessible. Many software applications have this ability: iTunes for example can read its database to
give you a listing of its songs (and play the songs); your mobile-phone software can interact with your
list of contacts.

The DBMS manages three important things:


1. The data.
2. The database engine that allows data to be accessed locked and modified.
3. The database schema, which defines the database’s logical structure.

These three foundational elements help provide concurrency, security, data integrity and uniform
administration procedures.

Typical database administration tasks supported by the DBMS include:


 Change management.
 Performance monitoring and Tuning.
 Backup.
 Recovery.

The DBMS is useful for providing a centralized view of data that can be accessed by multiple users,
from multiple locations, in a controlled manner. A DBMS have the ability to limit what data the end
user sees, as well as how the end user can view the data, providing many views of a single database
schema.

Side Note: The term "database schema" can refer to a visual representation of a database, a set of
rules that govern a database, or to the entire set of objects belonging to a particular user.

A database schema represents the logical configuration of all or part of a relational database. It can
occur both as a visual representation and as a set of formulas known as integrity constraints that
regulate a database.

These formulas are expressed in a data definition language, such as SQL. A database schema
indicates how the entities that make up the database relate to one another, including tables, views,
stored procedures, and more.

Typically, a database designer creates a database schema to help programmers whose software will
interact with the database. The process of creating a database schema is called data modelling.

COM-1010 Introduction to Information Technology Page 5


There are two main kinds of database schema:
1. A logical database schema conveys the logical constraints that
apply to the stored data. It may define integrity constraints,
views, and tables.
2. A physical database schema lays out how data is stored
physically on a storage system in terms of files and indices.

A database schema at the most basic level, indicates which tables or


relations make up the database, as well as the fields included on each
table. Thus, the terms schema diagram and entity-relationship
diagram are often interchangeable.

End of Side Note

In addition, the DBMS can provide both logical and physical data independence. It can protect users
and applications from needing to know where data is stored or having to be concerned about changes to
the physical structure of data (storage and hardware). As long as programs use the application
programming interface (API) for the database that is provided by the DBMS, developers won't have to
modify programs just because changes have been made to the database.

DBMS packages generally provide an interface to view and change the design of the database, create
queries, and develop reports. Most of these packages are designed to work with a specific type of
database, but generally are compatible with a wide range of databases.

For example, Microsoft’s Access DBMS is used to work with databases in its own Microsoft Access
Database format. Microsoft Access has the ability to read and write to other database formats as well.

Microsoft Access is an example of personal database-management systems. These systems are


primarily used to develop and analyse single-user databases. These databases are not meant to be shared
across a network or the Internet, but are instead installed on a particular device and work with a single
user at a time.

Popular types of DBMSes

Popular database models and their management systems include:


 Relational database management system (RDMS): adaptable to most use cases, RDBMS
Tier-1 products can be quite expensive.
 NoSQL DBMS: well suited for loosely defined data structures that may evolve over time.
 In-memory database management system (IMDBMS): provides faster response times and
better performance.
 Columnar database management system (CDBMS): well suited for data warehouses that
have a large number of similar data items.
 Cloud-based data management system: the cloud service provider is responsible for providing
and maintaining the DBMS.

COM-1010 Introduction to Information Technology Page 6


Relational database management system (RDMS): is a database system based on the relational
model specified by Edgar F. Codd which is the father of modern relational database designed in 1970.
Most modern commercial and open-source database applications are relational in nature.

The most important relational database features include an ability to use tables for data storage while
maintaining and enforcing certain data relationships.

NoSQL DBMS: The NoSQL term can be applied to some databases that predated the relational
database management system (RDBMS), but it more commonly refers to the databases built in the early
2000s for the purpose of large-scale database clustering in cloud and web applications.

NoSQL Database Types include (In Brief):


 Document databases pair each key with a complex data structure known as a document.
Documents can contain many different key-value pairs, or key-array pairs, or even nested
documents.
 Graph stores are used to store information about networks of data, such as social connections.
 Key-value stores are the simplest NoSQL databases. Every single item in the database is stored
as an attribute name (or 'key'), together with its value.
 Wide-column stores

The Benefits of NoSQL (In Brief):


When compared to relational databases, NoSQL databases are more scalable and provide superior
performance, and their data model addresses several issues that the relational model is not designed to
address:

 Large volumes of rapidly changing structured, semi-structured, and unstructured data


 Agile sprints, quick schema iteration, and frequent code pushes
 Object-oriented programming that is easy to use and flexible
 Geographically distributed scale-out architecture instead of expensive, monolithic architecture

In-memory database management system (IMDBMS): is a database management system that


primarily relies on main memory for computer data storage. It is contrasted with database management
systems that employ a disk storage mechanism.

Accessing data in memory eliminates seek time when querying the data, which provides faster and
more predictable performance than disk.

Applications where response time is critical, such as those running telecommunications network
equipment and mobile advertising networks, often use main-memory databases.

A potential technical hurdle with in-memory data storage is the volatility of RAM. Specifically, in the
event of a power loss, intentional or otherwise, data stored in volatile RAM is lost.

COM-1010 Introduction to Information Technology Page 7


Columnar database management system (CDBMS): also known as a column-oriented database is a
database management system (DBMS) that stores data in columns rather than in rows as relational
DBMSs.

The main difference between a columnar database and a traditional row-oriented database are centred
on performance, storage necessities and schema modifying techniques.

The goal of a columnar database is to efficiently write and read data to and from hard disk storage
and speed up the time it takes to return a query.

Benefits:
 One of the main benefits of a columnar database is that data can be highly compressed allowing
columnar operations like: MIN, MAX, SUM, COUNT and AVG, to be performed very rapidly.
 It is a self-indexing database, so it uses less disk space than a relational database management
system (RDBMS) containing the same data.

Here is an example of a simple database table with 4 columns and 3 rows:

In a row-oriented database management system, the data would be stored like this:

 1,Doe,John,8000;2,Smith,Jane,4000;3,Beck,Sam,1000;

In a column-oriented database management system, the data would be stored like this:

 1,2,3;Doe,Smith,Beck;John,Jane,Sam;8000,4000,1000;

Cloud-based data management system: A cloud DBMS (CDBMS) is distributed database that
delivers computing as a service instead of product, which allow sharing of resources and information
between multiple devices over internet. CDBMS provide managed backup, restore and automated
scheduling you may also able to pay little or nothing for unused time.

One example of CDBMS is SaaS (software as a service), which is an application that delivers through
the browser to customers.

In addition, cloud database management system typically runs on a cloud computing platform, such as
Amazon EC2, GoGrid, Salesforce and Rackspace.

There are two methods to run a database on the cloud (just to have in mind):
1. Virtual machine
2. Database as a service

COM-1010 Introduction to Information Technology Page 8


Advantages of a DBMS

Using a DBMS to store and manage data comes with advantages, but also overhead. One of the biggest
advantages of using a DBMS is that it lets end users and application programmers access and use the
same data while managing data integrity. Data is better protected and maintained when it can be shared
using a DBMS instead of creating new iterations of the same data stored in new files for every new
application.

The DBMS provides a central store of data that can be accessed by multiple users in a controlled
manner.

Central storage and management of data within the DBMS provides:


 Data abstraction and independence.
 Data security.
 A locking mechanism for concurrent access.
 An efficient handler to balance the needs of multiple applications using the same data.
 The ability to swiftly recover from crashes and errors, including restart-ability and
recoverability.
 Logging and auditing of activity.
 Simple access using a standard application programming interface (API).
 Uniform administration procedures for data.

Furthermore, a DBMS can also provide many views of a single database schema. A view defines what
data the user sees and how that user sees the data.

When a DBMS is used, systems can be modified much more easily when business requirements
change. New categories of data can be added to the database without disrupting the existing system and
applications can be insulated from how data is structured and stored.

In order for DBMS to provide these advantages must perform additional work, thereby bringing with it
the overhead. A DBMS will use more memory and CPU than a simple file storage system.

Different types of DBMSes will require different types and levels of system resources.

COM-1010 Introduction to Information Technology Page 9


Section 3: Models of Databases
Common logical data models for databases include:
 Navigational databases
o Hierarchical database model
o Network model
o Graph database
 Entity-Relationship Model
o Enhanced entity–relationship model
 Object-Oriented Database Models
o Physical data models
 Flat file
 Star Schema
 Relational Model

Hierarchical Database Model

A hierarchical database model is a data model in which the data is organized into a tree-like structure.
The data is stored as records which are connected to one another through links.

A record is a collection of fields, with each field containing only one value. The entity type of a record
defines which fields the record contains.

Example of a hierarchical model a record in the hierarchical database model corresponds to a row (or
tuple) in the relational database model and an entity type corresponds to a table (or relation).

The hierarchical database model mandates that each child record has only one parent, whereas each
parent record can have one or more child records. In order to retrieve data from a hierarchical database
the whole tree needs to be traversed starting from the root node. This model is recognized as the first
database model created by IBM in the 1960s.

COM-1010 Introduction to Information Technology Page 10


Network Model
The network model is a database model conceived as a flexible way of representing objects and their
relationships. Its distinguishing feature is that the schema, viewed as a graph in which object types are
nodes and relationship types are arcs, is not restricted to being a hierarchy or lattice.

While the hierarchical database model structures data as a tree of records, with each record having one
parent record and many children, the network model allows each record to have multiple parent and
child records, forming a generalized graph structure.

This property applies at two levels: the schema is a generalized graph of record types connected by
relationship types (called "set types" in CODASYL), and the database itself is a generalized graph of
record occurrences connected by relationships (CODASYL "sets").

Until the early 1980s the performance benefits of the low-level navigational interfaces offered by
hierarchical and network databases were persuasive for many large-scale applications, but as hardware
became faster, the extra productivity and flexibility of the relational model led to the gradual
obsolescence of the network model in corporate enterprise usage.

Entity Relationship Model

An entity–relationship model (ER model) describes inter-related things of interest in a specific domain
of knowledge. Entity–relationship modeling was developed for database design by Peter Chen and
published in a 1976 paper. An ER model is composed of entity types and specifies relationships that can
exist between those entity types.

An entity–relationship model is usually the result of systematic analysis to define and describe what is
important to processes in an area of a business.

It is usually drawn in a graphical form as boxes (entities) that are connected by lines (relationships)
which express the associations and dependencies between entities.

COM-1010 Introduction to Information Technology Page 11


Entities may be characterized not only by relationships, but also by additional properties (attributes),
which include identifiers called "primary keys". Diagrams created to represent attributes as well as
entities and relationships may be called entity-attribute-relationship diagrams, rather than entity-
relationship models.

In a simple relational database implementation, each row of a table represents one instance of an entity
type, and each field in a table represents an attribute type. In a relational database a relationship
between entities is implemented by storing the primary key of one entity as a pointer or "foreign key" in
the table of another entity.

Side Note: There is a tradition for ER/data models to be built at two or three levels of abstraction.
 Conceptual data model
The conceptual ER model normally defines master reference data entities that are commonly used
by the organization. The purpose of the conceptual ER model is to establish structural metadata
commonality for the master data entities between the set of logical ER models. The conceptual data
model may be used to form commonality relationships between ER models as a basis for data model
integration.
 Logical data model
A logical ER model does not require a conceptual ER model, especially if the scope of the logical
ER model includes only the development of a distinct information system. The logical ER model is
developed independently of the specific database management system into which it can be
implemented.
 Physical data model
One or more physical ER models may be developed from each logical ER model. The physical ER
model is normally developed to be instantiated as a database. Therefore, each physical ER model
must contain enough detail to produce a database and each physical ER model is technology
dependent since each database management system is somewhat different.
End of Side Note

Enhanced entity–relationship
The enhanced entity–relationship (EER) model (or extended entity–relationship model) in computer
science is a high-level or conceptual data model incorporating extensions to the original entity–
relationship (ER) model, used in the design of databases.

It was developed to reflect more precisely the properties and constraints that are found in more complex
databases, such as in engineering design and manufacturing (CAD/CAM), telecommunications,
complex software systems and geographic information systems (GIS).

There are three types of relationship that exist between Entities.

1. Binary Relationship
2. Recursive Relationship
3. Ternary Relationship

COM-1010 Introduction to Information Technology Page 12


1. Binary Relationship is what we call a relation between two Entities.
This is further divided into three types:

a. One to One:

The above example describes that one student can enroll only for one course and a course
will also have only one Student. This is not a common relationship.

b. One to Many:

The arrows in the diagram describes that one student can enroll for only one course.

c. Many to One:

The arrows in the diagram describes that Student enrolls for only one Course but a Course
can have many Students.

d. Many to Many :

The arrows in the diagram describes that Student enrolls for many Courses and many
Courses can have many Students.

2. Recursive Relationship is called when an Entity is related with itself it is known as Recursive
Relationship.

COM-1010 Introduction to Information Technology Page 13


3. Ternary Relationship is called is when three entities participate in the relationship.

Going a little further, we have three ways or approaches of reading or analyse an E-R Diagram.
There are:

o Generalization is a bottom-up approach in which two


lower level entities combine to form a higher level
entity. In generalization, the higher level entity can
also combine with other lower level entity to make
further higher level entity.

o Specialization is opposite to Generalization. It is a


top-down approach in which one higher level entity
can be broken down into two lower level entity. In
specialization, some higher level entities may not
have lower-level entity sets at all.

o Aggregration is a process when relation between


two entity is treated as a single entity. Here the
relation between Center and Course, is acting as an
Entity in relation with Visitor.

COM-1010 Introduction to Information Technology Page 14


Object-Oriented Database Models

The Object-Oriented Database Management System (OODBMS) is far more abstract from other
Database models. In an OODBMS, you can store any kind of data you desire, along with the methods to
be used with that data. To retrieve this more complex and varied data, the user sends queries written in
object query language (OQL) which is an Object-Oriented Version of SQL.

As the usage of web-based technology increases with the implementation of Intranets and extranets,
companies have a vested interest in OODBMSs to display their complex data. Some object-oriented
databases are designed to work well with object-oriented programming languages such as Delphi,
Ruby, Python, Perl, Java, C#, Visual Basic .NET, C++, Objective-C, etc.

Disadvantages of Object-Oriented Database Management System:

One downside is how editing an OODBMS based application is more time consuming because changes
have to be made to the other classes in the application that interact with instances of the parent class,
versus an RDBMS system where edits can typically be independent of the parent application.

o Very time consuming, that means a lot of money has to be spent on making changes to the
object-oriented database management system.
o Lack of support for security and presentation.
o Do not contain a view mechanism
o Lack of standards for the system
o There is no universal data model.

Flat file database


 A flat file database is a database stored as an ordinary unstructured file.
 To access the structure of the data and manipulate it on a computer system, the file must be read in
its entirety into the computer's memory.
 Upon completion of the database operations, the file is again written out in its entirety to the host's
file system.
 In this stored mode, the database has no structure for indexing and there are usually no structural
relationships between the records.
 A flat file can be a plain text file or a binary file.

The term has generally implied a small, simple database. As computer memory has become cheaper,
more sophisticated databases can now be entirely held in memory for faster access. These newer
databases would not generally be referred to as flat-file databases.

Typical examples of flat files are /etc/passwd and /etc/group on Unix-like operating systems. A list of
names, addresses, and phone numbers written by hand on a sheet of paper is a flat file database. This
can also be done with any typewriter or word processor. A spreadsheet or text editor program may be
used to implement a flat file database, which may then be printed or used online for improved search
capabilities.

COM-1010 Introduction to Information Technology Page 15


Star Schema

The star schema gets its name from the physical model's resemblance to a star shape with a fact table
at its centre and the dimension tables surrounding it representing the star's points. The star schema
consists of one or more fact tables referencing any number of dimension tables. The star schema is an
important special case of the snowflake schema, and is more effective for handling simpler queries.

Examples of fact data include sales price, sale quantity, and time, distance, speed, and weight
measurements. Related dimension attribute examples include product models, product colours, product
sizes, geographic locations, and salesperson name

Star schema is one of the simplest database models and is commonly used as a model for relational
data warehouses and multidimensional databases. It consists entirely of fact tables and dimension
tables.

Fact tables are an event or entity such as a sale and a dimension table consists of details about that
event such as date, place, speed of delivery, etc. For example, a geography dimension table can be used
to describe location data, such as country, state, or city.

In a star schema, a fact table is surrounded by numerous dimensions that branch out, creating an image
similar to a star.

Advantages of a star schema model:

 Is compatible with Online Analytical Processing (OLAP), which allows for data mining of
specific information from different points of view. For example, a user can view the sales from
a specific item at any specific time in the past.
 One of the disadvantages of the star schema model is that it is a simplistic model so it is not
capable of creating complex relational analytics. Star schemas are also denormalized so it is
possible for redundancies to occur within the database.

Relational Model

The most popular form of database today is the Relational Database (RM). A Relational Database is
one in which data is organized into one or more tables. Each table has a set of fields, which define the
nature of the data stored in the table. A record is one instance of a set of fields in a table. To understand
it better, think of the records as the rows of the table and the fields as the columns of the table. Popular
examples of relational databases are Microsoft Access, MySQL, and Oracle.

The purpose of the Relational Model is to provide a declarative method for specifying data and
queries: users directly state what information the database contains and what information they want
from it, and let the database management system software take care of describing data structures for
storing the data and retrieval procedures for answering queries.

Most relational databases use the SQL data definition and query language; these systems implement
what can be regarded as an engineering approximation to the relational model.

COM-1010 Introduction to Information Technology Page 16


Normalization

When designing a database, one important concept to understand is normalization. In simple terms, to
normalize a database means to design it in a way that:
 Reduces duplication of data between tables,
 Gives the table as much flexibility as possible (so it can be modified anytime).

In order to normalize a database, you have to understand the database anomalies. There are three types
of anomalies that occur when the database is not normalized.

These are:

1. Insertion Anomaly.
2. Update Anomaly.
3. Deletion Anomaly.

To understand these anomalies let us take an example of Student table.

Insertion Anomaly: Suppose for a new admission, we have a Student id(S_id), name and address of a
student but if student has not Subject_opted for any subjects yet then we have to insert NULL (no
value) there, leading to Insertion Anomaly.

Updating Anomaly: To update address of a student who occurs twice or more than twice in a table, we
will have to update S_Address column in all the rows, else data will become inconsistent.

Deletion Anomaly: If S_id 401 has only one subject and temporarily he drops it, when we delete that
row, entire student record will be deleted along with it.

Normalization Rules:
So, to create a normalized database (normal forms) you have to have in mind the following
Normalization rules:

1. First Normal Form (1NF)


2. Second Normal Form (2NF)
3. Third Normal Form (3NF)
4. Boyce and Codd Normal Form (BCNF)

COM-1010 Introduction to Information Technology Page 17


1. First Normal Form (1NF)
The First Normal Form rule says that:
o No two Rows of data must contain repeating group of information. For example, each set of
column must have a unique value, such that multiple columns cannot be used to fetch the
same row.
o Each table should be organized into rows, and each row should have a primary key that
distinguishes it as unique.
 The Primary key is usually a single column, but sometimes more than one column
can be combined to create a single primary key. For example consider a table which
is not in First normal form.

In First Normal Form, any row must not have a column in which more than one value is
saved, like separated with commas. Rather than that, we must separate such data into
multiple rows.

Using the First Normal Form, data redundancy increases, as there will be many columns
with same data in multiple rows but each row as a whole will be unique.

2. Second Normal Form (2NF)


The Second Normal Form Rule says that:
o There must not be any partial dependency of any column on primary key. Meaning that for a
table that has concatenated primary key, each column in the table that is not part of the
primary key must depend upon the entire concatenated key for its existence. If any column
depends only on one part of the concatenated key, then the table fails Second normal form.
As we saw in the first example of First Normal Form, there are two rows for Adam, to
include multiple subjects that he has opted for. Even if this is searchable, and follows First
normal form, it is an inefficient use of space. In addition, in the above Table we can see that,
while the candidate key is {Student, Subject}, Age of Student only depends on Student
column, which is incorrect as per Second Normal Form.
To achieve second normal form, it would be helpful to split out the subjects into an
independent table, and match them up using the student names as foreign keys.

COM-1010 Introduction to Information Technology Page 18


The New Student Table following 2NF:

In Student Table the candidate key will be Student column, because all other column (for
example the Age is) dependent on it.
The New Subject Table introduced for 2NF:

In Subject Table the candidate key will be {Student, Subject} column.


Both of the above tables qualifies for Second Normal Form and will never suffer from Update
Anomalies. Although there are a few complex cases in which table in Second Normal Form
suffers Update Anomalies, and to handle those scenarios Third Normal Form is there.

3. Third Normal Form (3NF)


The Third Normal form applies that:
o Every non-prime attribute of table must be dependent on primary key, or in other words,
there should not be the case that a non-prime attribute is determined by another non-prime
attribute. So this transitive functional dependency should be removed from the table and also
the table must be in Second Normal form.
Student_Detail Table:

In this table Student_id is Primary key, but street, city and state depends upon Zip.
The dependency between zip and other fields is called Transitive Dependency.
To apply 3NF, we need to move the street, city and state to new table, with Zip as primary key.
The New Student_Detail Table after the modification will be like this:

The New Address Table that will include the new modification will be like this:

COM-1010 Introduction to Information Technology Page 19


The advantage of removing Transtive Dependency is:
 Amount of data duplication is reduced.
 Data integrity achieved.

4. Boyce and Codd Normal Form (BCNF)


Boyce and Codd Normal Form is a higher version of the Third Normal form. This form deals
with certain type of anomaly that is not handled by 3NF.
For a table to be in BCNF, following conditions must be satisfied:
o R must be in 3rd Normal Form
o For each functional dependency ( X -> Y ), X should be a super Key.

Source: http://www.studytonight.com/dbms/database-normalization.php

Data Types

When defining the fields in a database table, we must give each field a data type. For example, the field
Birth Year is a year, so it will be a number, while First Name will be text. Most modern databases allow
for several different data types to be stored.

The most Common Data Types are:


 Text: for storing non-numeric data that is brief, generally under 256 characters. (The database
designer can identify the maximum length of the text).
 Number: for storing numbers. There are usually a few different number types that can be selected,
depending on how large the largest number will be.
 Yes/No: a special form of the number data type that is (usually) one byte long, with a 0 for “No” or
“False” and a 1 for “Yes” or “True”.
 Date/Time: a special form of the number data type that can be interpreted as a number or a time.

COM-1010 Introduction to Information Technology Page 20


 Currency: a special form of the number data type that formats all values with a currency indicator
and two decimal places.
 Paragraph Text: this data type allows for text longer than 256 characters.
 Object: this data type allows for the storage of data that cannot be entered via keyboard, such as an
image or a music file.

There are two important reasons that we must properly define the data type of a field.

1. A data type tells the database what functions can be performed with the data.
For example, if we wish to perform mathematical functions with one of the fields, we must be
sure to tell the database that the field is a number data type. So if we have, say, a field storing
birth year, we can subtract the number stored in that field from the current year to get age.
2. Is to define data type so that the proper amount of storage space is allocated for our data.
For example, if the First Name field is defined as a text (50) data type, this means fifty
characters are allocated for each first name we want to store. However, even if the first name is
only five characters long, fifty characters (bytes) will be allocated. While this may not seem like
a big deal, if our table ends up holding 50,000 names, we are allocating 50 * 50,000 = 2,500,000
bytes for storage of these values. By declaring the correct data type, it can reduce the size of the
field so we do not waste storage space.

Big Data and Metadata

Big Data: The term refers to such massively large data sets that conventional database tools do not
have the processing power to analyse them. For example, Walmart must process over one million
customer transactions every hour. Storing and analyzing that much data is beyond the power of
traditional database-management tools.

Big data can also been defined by the four Vs:


 Volume: The amount of data. While volume indicates more data, it is the granular nature of the
data that is unique.
 Velocity: The fast rate at which data is received and perhaps acted upon. The highest velocity
data normally streams directly into memory versus being written to disk.
 Variety: New unstructured data types. Unstructured and semi-structured data types, such as
text, audio, and video require additional processing to both derive meaning and the supporting
metadata.
 Value: Data has intrinsic value but it must be discovered.

Metadata: The term metadata can be understood as “data about data.”


The metadata about that value would be the field name Year of Birth, the time it was last updated, and
the data type (integer). Another example of metadata could be for an MP3 music file. Information such
as the length of the song, the artist, the album, the file size, and even the album cover art, are classified
as metadata. When a database is being designed, a “data dictionary” is created to
hold the metadata, defining the fields and structure of the database.

COM-1010 Introduction to Information Technology Page 21


Section 4: Creating Databases using Microsoft Access

One of the most common applications to create databases is Microsoft Access. Microsoft Access
provides you with everything you need in order to build your own database environment.

Databases in Access are composed of four objects: tables, queries, forms, and reports. Combining these
objects allow you to enter, store, analyze, and compile data however you want.

Tables
We have to have in mind that database is a collection of data organized into many connected lists. In
Access, all data is stored in tables.

In Access, rows and columns are referred to as


records and fields.

A field is more than just a column, it’s a way of


organizing information by the type of data it is.

Every piece of information within a field is of the


same type. For example, in the field called First
Name every entry would be names and in the field
called Street Address every entry would be an
address.

So, we can say that a record is more than just a row; it's a unit of information.
Every cell in a given row is part of that row’s record.

Notice how each record spans several fields.


The number at the left of each row, it’s the
ID number that identifies each record.

The ID number for a record refers to every


piece of information contained on that row.

Tables are good for storing closely related


information.

For example, let's say we own a coffee shop and have a database that includes a table with your
customers' names and information, like their phone numbers, home addresses, and email addresses.
Because these pieces of information are all details on your customers, you’d include them all in the
same table. Each customer would be represented by a unique record, and each type of information about
these customers would be stored in its own field. If you decided to add any more information
(customer's birthday) you would simply create a new field within the same table.

So each table is filled with details according to their Subject.

COM-1010 Introduction to Information Technology Page 22


Forms
In Access, Forms are used for entering, modifying, and viewing records. You likely have had to fill out
forms on many occasions, like when visiting a doctor's office, applying for a job, or registering for
school. The reason forms are used so often is that they're 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.

Working with extensive tables can be confusing,


and when you have connected tables you might
need to work with more than one at a time to enter
a set of data. However, with forms it's possible to
enter data into multiple tables at once, all in one
place. Database designers can even set restrictions
on individual form components to ensure all of the
needed data is entered in the correct format.
Finally, forms help keep data consistent and
organized, which is essential for an accurate and
powerful database.

Queries
Queries are responsible in a way of searching for and compiling data from one or more tables. Running
a query is like asking a detailed question of your database. When you build a query in Access, you are
defining specific search conditions to find exactly the data you want.

However, Queries are more powerful than the simple searches you
do. While a search would be able to help you find the name of one
customer at your business, you could also run a query to find the
name and phone number of every customer who is made a
purchase within the past week. A query that design correctly can
give information you might not be able to find just by looking
through the data in your tables.

Reports
Reports offer you the ability to present your data in print. A Database
Report could be a computer printout of a class schedule or a printed
invoice of a purchase. Reports allow you to present components of
your database in an easy to read format. You can even customize a
report's appearance to make it visually appealing. Access offers you
the ability to create a report from any table or query.

COM-1010 Introduction to Information Technology Page 23


Putting everything together

Every piece of data a query, form, or report uses is


stored in one of your database tables.

Forms allow you to both add data to tables and view


data that already exists.

Reports present data from tables and also from queries,


which then search for and analyze data within these
same tables.

When the databases objects are connected correctly to


each other throw their common fields, the relationship
between them will be so natural that you will not
notice that you are using connected database objects.

Example: Electronic card catalog search. You entered your search into something that looks like this:

When you perform a search, you are entering your search terms into a form that then creating and run a
query based on your request. When the query finishes the search throw the database's tables records to
find match of your search, you were shown a report that drew information from the query and the
related tables. In this case, if a list of books is matching your search terms, you could represent the
connections between the objects like this:

COM-1010 Introduction to Information Technology Page 24


Microsoft Access 2016
For our learning purposes we are going to work with the latest version of Microsoft Access, Microsoft
Access 2016. Access 2016 uses the Ribbon to organize commands, just like in Access 2013 and 2010.
Just like we have seen with Microsoft Word, Excel and PowerPoint, Access 2016 continues to use
features like the Ribbon and the Quick Access Toolbar, where you will find commands to perform
common tasks in, as well as Backstage view.

The Interface
1. Quick Access Toolbar.
2. The Ribbon: The Ribbon contains all
of the commands you will need to perform
common tasks in Access.
3. Tell Me: The Tell me box works like a
search bar to help you quickly find tools or
commands you want to use.
4. Microsoft Account: From here, you
can access your Microsoft account
information, view your profile, and switch
accounts.
5. Navigation Pane: The Navigation pane
displays all of the objects contained in
your database.
6. Document Tabs Bar: All open objects are displayed in tabs on the Document Tabs bar.
7. Record Navigation Bar: The Record Navigation bar allows you to navigate records one at a time.
8. Record Search Box: You can use the Record Search box to search for any term in the current
object.

Access uses a tabbed Ribbon system instead


of traditional menus. The Ribbon contains
multiple tabs, each with several groups of
commands. For example, the Clipboard group
on the Home tab contains commands such as
Cut, Copy, and Paste. In addition, some groups
also have a small arrow in the bottom-right corner that you can click for even more options.

The Quick Access Toolbar is the same toolbar that exist also in Microsoft Word, Excel, and
PowerPoint. Is located above the Ribbon and lets you access common commands
no matter which tab you are on. By default, it shows the Save, Undo, and Redo
commands. If you'd like, you can customize it by adding additional commands.

COM-1010 Introduction to Information Technology Page 25


The Navigation pane is a list containing every object in your database.
For easier viewing, the objects are organized into groups by type. Using
the Navigation pane you can open, rename, and delete objects.

Object sorting in the Navigation pane

By default, objects are sorted by type (tables, forms, queries and so on).
However, if you want you can sort the objects in the Navigation pane
into groups of your choosing.

There are four sort options:

1. Custom allows you to create a custom group for sorting objects.


2. Object Type groups objects by type. This is the default setting.
3. Tables and Related Views groups forms, queries, and reports with the tables they refer to.
4. Created Date or Modified Date sorts’ objects based on when they were created or last edited.

Working with objects in the Navigation pane


To open an object, you locate and double-click the desired one.

When you open it, the object will appear as a tab in the
Document Tabs bar.

To save a new object:

Select the object you want to save by clicking its tab in the Document Tabs bar.

Then, click the Save command on the Quick Access Toolbar, or press Ctrl+S
on your keyboard.

The first time you save an object, you will be prompted to name it.
Enter the desired object name, then click OK.

To close an object:

Select the object you want to close and then click the X to the right of the Document Tabs bar. You can
also close an object by right-clicking its tab on the Document Tabs bar and selecting Close. Select
Close All to close all open objects

COM-1010 Introduction to Information Technology Page 26


To rename an object:

In the Navigation pane, right-click the desired object, then select Rename.

Backstage view gives you various options for saving, opening, and printing your database.

1. Back to Access: You can use the


arrow to return to Access interface.
2. Info: The Info pane contains
information on the current database and
tools to help you compact, repair, and
encrypt the database.
3. New: With New, you can create a
new database from scratch, or choose
from a selection of templates.
4. Open: From here, you can open
databases from your computer.
5. Save and Save As: You can use
Save or Save As to save your current
work or a new version of it.
6. Print: The Print pane contains options for printing the current object in your database.
7. Close: With Close you can close the current database.
8. Account: From the Account pane, you can access your Microsoft account information, modify
your theme and background, and sign out of your account.
9. Options: Here, you can change various Access options. For example, you can choose a form to
automatically display when your database is opened or modify the default cell and font style.

Understanding tables
Adding records and entering data

Entering data into tables in Access is similar to entering data in Excel. To work with records, you'll
have to enter data into cells.

There are three ways to add a new record to a table:

1. In the Records group on the Home tab, click the New command.

COM-1010 Introduction to Information Technology Page 27


2. On the Record Navigation bar at the bottom of the window, click the New record button.

3. Begin typing in the row below your last added record.

Delete a Record

You have to follow these steps in order to delete a record:

1. Select the entire record by clicking the gray border on the left side of the record.

2. Select the Home tab and locate the Records group and Click the Delete command.

3. A dialog box will appear and Click Yes. The record will be permanently deleted.

COM-1010 Introduction to Information Technology Page 28


Side Note: The ID numbers assigned to records stay the same even after you delete a record. For
example, if you delete the 205th record in a table, the sequence of record ID numbers will read 204,
206, 207 rather than 204, 205, 206, 207.

End of Side Note

In addition, Access offers various ways to modify the appearance of tables, including resizing fields and
rows and temporarily hiding information you don't need to see. These changes aren't just about making
your table look good but they also can make the table easier to read.

Adding and rearranging fields

When you add a new field, you can even set the data type, which dictates which type of data can be
entered into that field.

There are several types of fields you can add to a table:

Short Text: This is the default option and is best for most text in Access. You should also
choose it for numbers you don't plan to do math with, like postal codes and phone numbers.
Number: This is best for numbers you might want to do calculations with, like quantities of an
item ordered or sold.

COM-1010 Introduction to Information Technology Page 29


Currency: This automatically formats numbers in the currency
used in your region.
Date & Time: This allows you to choose a date from a pop-out
calendar.
Yes/No: This inserts a checkbox into your field.
Rich Text: This allows you to add formatting to text, like bold and
italics.
Long Text: This is ideal for large amounts of text, like product
descriptions.
Attachment: This allows you to attach files, like images.
Hyperlink: This creates a link to a URL or email address.

To Move a field:

Locate the field you want to move, and hover your mouse over the bottom border of the field header.
When you see the cursor becoming a four-sided arrow you can Click and drag the field to its new
location. By releasing the mouse button, the field will appear in its new location.

When you set field data type, you are really setting a rule for that field. Databases often include rules
because they help ensure users enter the correct type of data.

This is important because Computers aren't as smart as humans about certain things. While you might
recognize that one and 1 or NY and New York are the same thing, Access will not and therefore won't
group these things together. Making sure to enter your data in a standard format will help you better
organize, count, and understand it.

Rules
Furthermore, by adding Rules you can also determine which options you have for working with your
data. For example, you can only do math with data entered in number or currency fields, and you can
only format text entered into text fields.

There are Three Main Types of Rules you can set for a field:

1. Data Type,
2. Character Limit,
3. Validation Rules.

COM-1010 Introduction to Information Technology Page 30


To change the data type for existing fields:

 Select the field whose data type you want


to change.
 Select the Fields tab, then locate the
Formatting group. Click the Data Type
drop-down arrow.
 Select the desired data type.

Depending on the data type you chose, you may notice changes to your information. For instance, if we
set the data type for the Email field to Hyperlink all of the email addresses in the field will become
clickable links.

Validation rules
A validation rule is a rule that dictates which information can be entered into a field. When a
validation rule is in place, it is impossible for a user to enter data that violates the rule. For example, if
we were asking users to input a state name into a table with contact information, we might create a rule
that limits the valid responses to U.S. state postal codes. This would prevent users from typing
something that wasn't actually a real state postal code.

To create a validation rule:


 Select the field you want to add a validation rule to. In our example, we'll set a rule for the State
field.
 Select the Fields tab, then locate the Field Validation group. Click the Validation drop-down
command and then select Field Validation Rule.

COM-1010 Introduction to Information Technology Page 31


Then the Expression Builder dialog box will appear.

By clicking the text box, you can type your validation rule. In our
example, we want to limit data in the State field to actual state
postal codes. We will type each of the valid responses in
quotation marks and separate them with the word Or, which lets
Access know that this field can accept the response "AL" Or
"AK" Or "AZ" or any of the other terms we've entered.

Once you're satisfied with the validation rule, click OK. The
dialog box will close.

Finally, by clicking the


Validation drop-down command
again and selecting the Field
Validation Message option, a
dialog box will appear where you
can type the phrase you want to
appear in an error message when
users try to enter data that
violates the validation rule.

When you're satisfied with the error


message, click OK.

The validation rule is now included in the


field. Users will be unable to enter data that
violates the rule.

COM-1010 Introduction to Information Technology Page 32


Calculated fields and totals rows

Adding calculated fields and totals rows to your table lets you perform calculations using your table
data. A calculated field calculates data within one record, while a totals row performs a calculation on
an entire field of data. Whenever you see a subtotal for one record, you are looking at a calculated field.
Similarly, whenever you see a grand total at the bottom of a table, you're looking at a totals row.

Working with Forms


Forms are are a way of requiring information in a specific format, which means the person filling out
the form knows exactly which information to include and where to put it.

This is just as true of forms in Access. When you enter information into a form in Access, the data goes
exactly where it's supposed to go: into one or more related tables. While entering data into simple tables
is fairly straightforward, data entry becomes more complicated as you start populating tables with
records from elsewhere in the database.

For instance, the orders table in a coffee shop's database might link to information on customers,
products, and prices drawn from related tables. For example, in the Orders Table below the Customer
ID field is linked to the Customers table.

In fact, in order to see the entire order you would also have to look at the Order Items table, where the
menu items that make up each order are recorded.

COM-1010 Introduction to Information Technology Page 33


A form containing the same data might look like this:

As you can see, this record is much easier to understand when viewed in a form.

When you're using a form, you don't have to worry about entering data into the right tables or in the
right format, the form can handle these things itself. There's no need to go back and forth between
tables because forms bring all of the information you need together in one place.

With forms, database designers can control exactly how users are able to interact with the database.
They can even set restrictions on individual form components to ensure all of the needed data is entered
and that it's all entered in a valid format. This is useful because keeping data consistent and organized is
essential for an accurate and powerful database.

Using form features

The exact procedure you use for filling out a form will vary depending on the content and design of the
form you're using.

1. Drop-Down Search Box: The drop-down search


box allows you to search for existing records.
Simply begin typing, and records that match your
search will appear in the drop-down list. You can
also browse existing records.
2. New Record Button: Clicking the New Record
button will create a new record with all fields
cleared except for fields with a default value.
3. Text Box: Most data entry using forms is done
with labeled text boxes. A text box is the Access
equivalent of the blank space where you would
write your information on a paper form.

COM-1010 Introduction to Information Technology Page 34


4. Text Box with Validation Rule: If the database designer has created any rules specifying what type
of data can be entered into each field, these rules will be reflected in the related forms. If you
encounter a message like this one, click OK and re-enter the data following the instructions in the
dialog box.
5. Combo Box: In order to guarantee that users only enter valid responses, the database designer may
use a combo box. A combo box allows you to enter data by choosing from a drop-down list of
choices.
6. Form Buttons: Form buttons can provide quick and easy ways to carry out common tasks instead of
using the commands on the Ribbon. From left to right, the buttons here allow a user to save, delete,
and print the current record.

Some forms may include more options, like calendar buttons, drop-down lists, yes/no checkboxes,
subforms, and embedded tables.

1. New Order Button: This customized button


will create a new record with all fields cleared.
2. Drop-Down List: This allows you to select
an existing customer from the Customers table.
Simply begin typing, or select a name from the
drop-down list. This form requires each order to
be linked to an existing customer record, which
helps to preserve the integrity of the database. If
a customer is not in our database, we can add
them with the Customers form.
3. Calendar Button: Because the Pickup Date
field on the related form only accepts
information formatted as a date, the Pickup
Date text box includes a calendar button to
ensure users can only enter a date in the desired format. Requiring dates to be entered in a
consistent format ensures that the database will recognize each entry in this field as a date.
4. Yes/No Checkboxes: There are only two valid responses for the Pre Order and Paid fields in our
related table: yes and no. Checkboxes give users an easy way to input this data. Simply click the
checkbox for yes or leave it unchecked for no.
5. Add Item to Subform: This button launches the subform that allows you to add a new record to
the embedded table. When using a subform like this, enter the data as you would in a normal form,
then click Save and Close. The new record will be displayed in the embedded table.
6. Subform and Embedded Table: In our database, order items are stored in a separate table from
the orders themselves. In order to enter and display order data, this form includes an embedded
subform and table. This orders table can be viewed and searched like a normal table, but it only
includes data linked to this particular order.

COM-1010 Introduction to Information Technology Page 35


To create a form:

In the Navigation pane, select the table you want to use to create a form.

Then, Select the Create tab, locate the Forms group, and click the Form command.

Your form will be created and opened in Layout view.

To save the form, click the Save command on the Quick Access Toolbar. When prompted, type a name
for the form, then click OK.

Subforms
If you created a form from a table whose records are
linked to another table, your form probably includes a
subform. A subform is a datasheet form that displays
linked records in a table-like format. If you find that you
don't need a subform, you can easily delete it. To do this,
simply click it and press the Delete key on your keyboard.

COM-1010 Introduction to Information Technology Page 36


Subforms are often quite helpful, depending on the content and source of your form you might find that
contains useful information.

When you use the Form command on an existing table, all of the fields from the table are included in
the form. However, if you later add additional fields to the table, these fields will not automatically
show up in existing forms. In situations like this, you can add additional fields to a form.

Formatting forms

Command Buttons

If you want to create a way for users of your form to quickly perform specific actions and tasks, you
can add command buttons. When you create a command button, you specify an action for it to carry out
when clicked. By including commands for common tasks right in your form, you're making the form
easier to use.

Access offers many different types of command buttons, but they can be divided into a few main
categories:
 Record Navigation command buttons, which allow users to move among the records in your
database
 Record Operation command buttons, which let users do things like save and print a record
 Form Operation command buttons, which allow users to quickly open or close a form, print the
current form, and perform other actions
 Report Operation command buttons, which offer users a quick way to do things like preview or
mail a report from the current record

To add a command button to a form:

In Form Layout view, select the Design tab, then locate the Controls group.

 Click the Button command.

 Choose the desired location for the command button, then click the mouse button.

COM-1010 Introduction to Information Technology Page 37


Placing the new command button

The Command Button Wizard will appear. In the Categories


pane, select the category of button you want to add. We want to
find a way to move more quickly to specific records, so we'll
choose the Record Navigation category.

The list in the Actions pane will update to reflect your chosen
category. Select the action you want the button to perform, then
click Next. In our example, we'll choose Find Record.

You can now decide whether you want your button


to include text or a picture. A live preview of your
button appears on the left.

To include text, select the Text option, then type


the desired word or phrase into the text box.

To include a picture, select the Picture option. You can


decide to keep the default picture for that command
button or select another picture. Click Show All Pictures
to choose from another command button icon or Browse
to choose a picture from your computer.

When you are satisfied with the appearance of your


command button, click Next.

Type a name for the button. This name won't appear on


the button, but knowing the name will help you quickly
identify the button if you ever want to modify it with the
Property Sheet. After adding the button name, click
Finish.

 Switch to Form view to test the new


button. Our Search button opens the Find
and Replace dialog box.

COM-1010 Introduction to Information Technology Page 38


Modifying form layout

When you create a form, Access arranges the form


components in a default layout where the fields are
neatly stacked on top of each other, all exactly the same
width. While this layout is functional, you might find
that it doesn't best fit your information. For instance, in
the form below, most of the fields are almost completely
empty because the data stored there doesn't take up
much room.

To resize and rearrange our fields the way we want,


we'll have to modify the form layout. For instance,
because the default layout for our form contains only two columns one for the field labels and another
for the fields, we would have to create a new column to put two fields side by side.

Moving form components:

If necessary, add columns or rows to make room for the field or button you want to move by using the
Insert commands in the Rows & Columns group.

If we want to move the Last Name field to the right of


the First Name field, we will have to create two new
columns to the right: one for the field label, and one for
the field itself. To do this, we will click the Insert Right
command twice.

If you want to make a field take up more or less space


than one column, you can use the Merge and Split
commands. The Merge command combines two or more
cells, while the Split command divides a cell.

More formatting options

Adding logos and other images to your forms can greatly improve their appearance, as can applying
theme colors and fonts.

Queries
The real power of a relational database lies in its ability to quickly retrieve and analyze your data by
running a query. Queries allow you to pull information from one or more tables based on a set of search
conditions you define. In this lesson, you will learn how to create a simple one-table query.

Queries are a way of searching for and compiling data from one or more tables. Running a query is like
asking a detailed question of your database. When you build a query in Access, you are defining
specific search conditions to find exactly the data you want.

COM-1010 Introduction to Information Technology Page 39


Using Queries:

Queries are far more powerful than the simple searches or filters you might use to find data within a
table. This is because queries can draw their information from multiple tables. For example, while you
could use a search in the customers table to find the name of one customer at your business or a filter on
the orders table to view only orders placed within the past week, neither would let you view both
customers and orders at once. However, you could easily run a query to find the name and phone
number of every customer who's made a purchase within the past week. A well-designed query can give
information you might not be able to find out just by examining the data in your tables.

When you run a query, the results are presented to you in a table, but when you design one you use a
different view. This is called Query Design view, and it lets you see how your query is put together.

1. View Options: Click the View drop-


down arrow to switch to another view of your
query. In most cases, you will only need to use
two main views: Datasheet view and Design
view. Datasheet view lets you view your query
results in the form of a table. Design view,
featured here, allows you to view and modify the
design of your query.
2. Run Query Command: After you have
designed your query, click the Run command to
view the results of the query in a table.
3. Object Relationship Pane: All of the
tables you choose to include in your query will
appear as small windows in the Object
Relationship pane. Each window contains a list
of every available field within that table.
4. Fields and Table Names: The first row of the design grid contains the names of the fields
included in the query. Directly beneath each field name is the name of the table that field
belongs to.
5. The Design Grid: The bottom part of Query Design view is called the design grid. It contains a
table that lists all of the fields included in the query. Within this table, you can set criteria to
specify which information the query should retrieve.
6. Sorting: You can sort the data retrieved by a query. Simply click in the Sort: row of the field you
want to sort, and select either an Ascending or Descending sort. By default, query results are not
sorted
7. Showing and Hiding Fields:You may want to include fields in the design of your query but hide
them in the query results. To hide a field, uncheck the checkbox in the Show: row of that field.
8. Query Criteria: Entering query criteria lets you specify exactly what type of information you
want your query to retrieve. Simply type the desired criteria in the Criteria: row of the field you
want to search. Here, the criteria has been set so the query will search for records with Raleigh
in the City field or zip code 27513.

COM-1010 Introduction to Information Technology Page 40


One-table queries

Let's familiarize ourselves with the query-building process by building the simplest query possible: a
one-table query.

We will run a query on the Customers table of our bakery database. Let's say our bakery is having a
special event, and we want to invite our customers who live nearby because they are the most likely to
come. This means we need to see a list of all customers who live close by, and only those customers.

We want to find our customers who live in the city of Raleigh, so we'll search for "Raleigh" in the City
field. Some customers who live in the suburbs live fairly close by, and we'd like to invite them as well.
We'll add their zip code, 27513, as another criteria.

If you think this sounds a little like applying a filter, you're right. A one-table query is actually just an
advanced filter applied to a table.

To create a simple one-table query:

 Select the Create tab on the


Ribbon, and locate the
Queries group
 Click the Query Design
command.

Access will switch to Query Design view. In the Show Table dialog box that
appears, select the table you want to run a query on. We are running a query on
our customers, so we'll select the Customers table.

Click Add, then click Close.

The selected table will appear as a small window in the Object Relationship
pane. In the table window, double-click the field names you want to include in
your query. They will be added to the design grid in the bottom part of the
screen. In our example, we want to mail invitations to customers who live in a
certain area, so we'll include the First Name, Last Name, Street Address, City,

and Zip Code fields.

Set the search criteria by clicking the cell in the


Criteria: row of each field you want to filter.
Typing criteria into more than one field in the
Criteria: row will set your query to include only
results that meet all criteria. If you want to set
multiple criteria but don't need the records shown
in your results to meet all of them, type the first
criteria in the Criteria: row and additional criteria

COM-1010 Introduction to Information Technology Page 41


in the or: row and the rows beneath it. Because we want to find customers who either live in Raleigh or
in the 27513 zip code, we'll type "Raleigh" in the City field and "27513" into the or: row of the Zip
Code field. The quotation marks will search these fields for an exact match.

After you have set your criteria, run the query by clicking the Run command on the Design tab.

The query results will be displayed in the query's Datasheet view, which looks like a table. If you want,
save your query by clicking the Save command in the Quick Access Toolbar. When prompted to name
it, type the desired name, then click OK.

Designing a multi-table query

Planning a query

When planning a query that uses more than one table, you should go through these four steps:

1. Pinpoint exactly what you want to know. If you could ask your database any question, what
would it be? Building a query is more complicated than just asking a question, but knowing
precisely what question you want to answer is essential to building a useful query.
2. Identify every type of information you want included in your query results. Which fields contain
this information?
3. Locate the fields you want to include in your query. Which tables are they contained in?

COM-1010 Introduction to Information Technology Page 42


4. Determine the criteria the information in each field needs to meet. Think about the question you
asked in the first step. Which fields do you need to search for specific information? What
information are you looking for? How will you search for it?

Joining tables in queries

The final thing you need to consider when designing a query is the way you link—or join—the tables
you're working with. When you add two tables to an Access query, this is what you'll see in the Object
Relationship pane:

The line connecting the two tables is called the join line.
See how the join line is actually an arrow? This is because
it indicates the order in which the query looks at data from
the two tables. In the image above, the arrow is pointing
from left to right, which means the query will look at data
in the left table first, then look at only the data in the right
table that relates to the records it's already seen in the left
table.

Your tables won't always be joined this way. Sometimes


Access will join them right to left. In either case, you
might need to change the direction of the join to make sure your query includes the correct information.
The join direction can affect which information your query retrieves.

To understand what this means, consider the query we're designing. For our query, we need to see
customers who have placed orders, so we've included the Customers table and the Orders table. Let's
take a look at some of the data contained in these tables.

We now have exactly the information we want: all of the customers


who have placed an order, and only those customers. As you can
see, we had to join our tables in the correct direction to obtain the
information we wanted.

Now that we understand which join direction we need to use, we're


ready to build our query!

Side Note

In our query, we needed to use the right-to-left join, but the correct join direction for the tables in your
queries will depend on what information you want to see and where that information is stored. When
you add tables to a query, Access will automatically join the tables for you, but it often doesn't join
them in the correct direction. This is why it's important to always review the joins between your tables
before you build a query.

COM-1010 Introduction to Information Technology Page 43


Creating a multi-table query

To create a multi-table query we have to:

 Select the Query Design command from the


Create tab on the Ribbon.

In the dialog box that appears, select each table you want to include in your query and
click Add.
You can press and hold the Ctrl key on your keyboard to select more than one table.
When we planned our query, we decided we needed information from the Customers and
Orders tables, so we'll add these.
After you have added all of the tables you want, click Close and The tables will appear in
the Object Relationship pane, linked by a join line.
By Double-clicking the thin section of the join line between two tables to edit its join
direction.

The Join Properties dialog box will appear. Select an option to choose the direction of your join. In our
example, we'll choose option 3 because we want a right-to-left join.

COM-1010 Introduction to Information Technology Page 44


In the table windows, double-click the field names you want to include in your query. They will be
added to the design grid in the bottom part of the screen. In our example, we'll include most of the fields
from the Customers table: First Name, Last Name, Street Address, City, State, Zip Code, and Phone
Number. We'll also include the ID number from the Orders table.

Set field criteria by entering the desired criteria in the criteria row of each field. We want to set two
criteria: Not in ("Raleigh") in the City field, and Like ("919*") in the Phone Number field. This will
find customers who do not live in Raleigh but who do live in the 919 area code.

After you have set your criteria, run the query by clicking the Run command on the Design tab.

The query results will be displayed in the query's Datasheet view, which looks like a table. If you want,
save your query by clicking the Save command in the Quick Access Toolbar. When prompted to name
it, type the desired name, then click OK.

COM-1010 Introduction to Information Technology Page 45


More modification options

Access offers several options that let you design and run queries that return exactly the information
you're looking for. For instance, what if you need to find out how many of something exists within your
database? Or what if you would like your query results to automatically be sorted a certain way? If you
know how to use query options in Access, you can design almost any query you want.

In this lesson, you'll learn how to modify and sort your queries within Query Design view, as well as
how to use the Totals function to create a query that can perform calculations with your data. You'll
also learn about additional query-building options offered in Access.

When you open an existing query in Access, it is displayed in Datasheet view, meaning you will see
your query results in a table. To modify your query, you must enter Design view, the view you used
when creating it.

There are two ways to switch to Design view:

On the Home tab of the Ribbon, click the View command. Select Design View from the drop-down
menu that appears.

In the bottom-right corner of your Access window, locate the small view icons. Click the Design View
icon, which is the icon farthest to the right.

Once in Design view, make the desired changes, then select the
Run command to view your updated results.

Side note: You may notice that Access also offers SQL view. You can ignore this. SQL view allows you
to create advanced functions that you will not need to use for this tutorial or for most Access functions.

Sorting queries

Access allows you to apply multiple sorts at once while you're designing your query. This allows you to
view your data exactly the way you want.

A sort that includes more than one sorted field is called a multilevel sort. A multilevel sort allows you
to apply an initial sort, then further organize data with additional sorts. For instance, if you had a table
filled with customers and their addresses, you might choose to first sort the records by city, then
alphabetically by last name.

When more than one sort is included in a query, Access reads


the sorts from left to right. This means the leftmost sort will be
applied first. In the example below, customers will be sorted
first by the City where they live and then by the Zip Code
within that city.

COM-1010 Introduction to Information Technology Page 46


To apply a multilevel sort:

 Open the query and switch to Design view.


 Locate the field you want to sort first. In the Sort: row, click
the drop-down arrow to select either an Ascending or
Descending sort.
 Repeat the process in the other fields to add additional sorts.
Remember, the sorts are applied from left to right, so any
additional sorts must be applied to fields located to the right
of your primary sort. If necessary, you can rearrange the
fields by clicking the top of a field and dragging it to a new
location.
 To apply the sort, click the Run command and your query results will appear with the desired sort.

You can also apply multilevel sorts to tables that


don't have queries applied to them. On the Home
tab on the Ribbon, select the Advanced drop-down
command in the Sort & Filter group. From the
menu that appears, select Advanced Filter/Sort and
create the multilevel sort as you normally would.
When you're finished, click the Toggle Filter
command to apply your sort.

Sometimes you might have fields that contain


important criteria, but you might not need to
actually see the information from that field in the
final results. For example, take one of the queries we built in our last lesson: a query to find the names
and contact information of customers who had placed orders. We included Order ID numbers in our
query because we wanted to make sure we only pulled customers who had placed orders.

However, we really didn't need to see this information in our final query results. In fact, if we were just
looking for customer names and addresses, seeing the order number mixed in there might have been
distracting. Fortunately, Access makes it easy to hide fields while still including any criteria they
contain.

To hide a field within a query:

 Open the query and switch to Design view.


 Locate the field you want to hide.
 Click the checkbox in the Show: row to uncheck it.

COM-1010 Introduction to Information Technology Page 47


 To see the updated query, select the Run command and the field will be hidden.
 To unhide a hidden field, simply return to Design view and click the checkbox in the field's
Show: row again.

Totals queries

Sometimes setting simple criteria won't give you the results you need, especially when you're working
with numerical values. You may want to see your query results grouped or counted in some way. For
example, let's say we want to find out how many of each menu item at our bakery has been ordered—
how many Almond Croissants, Apple Pies, and so on. To do this, we could create a totals query to find
the sum of the quantities for each item.

First, the totals query will group all


similar menu items from separate
orders (for example, Almond
Croissants). Then, the Sum function
will add the values in the Quantity
field to calculate the total number sold
for that item.

The Sum function helped us find the


desired information in this example,
but in other situations you may need to
use a different function to find the
answer you need.

There are several functions you can choose from:

Count: Counts the total number of each item. Sum: Adds the values together.
Average: Finds the average of the values. Maximum: Returns the highest value.
Minimum: Returns the lowest value. First: Returns the first or earliest value.
Last: Returns the last or most recent value.

To create a totals query:

If you wanted to create a grand total for all of the items, you would need to add a totals row.

 Create or open a query you want to use as a totals query.


 From the Design tab, locate the Show/Hide group, then select the Totals command.

COM-1010 Introduction to Information Technology Page 48


A row will be added to the table in the design grid, with all values in that row set to Group By. Select
the cell in the Total: row of the field you want to perform a calculation on, then click the drop-down
arrow that appears.

Select the calculation you want to be


performed in that field. In our example, we
want to add the quantities of products
we've sold, so we'll select the Sum option.

When you are satisfied with your query design,


select the RUN command on the Query Tools
Design tab to RUN the query.

The query results will be displayed in the query's Datasheet view, which looks like a table. If you want,
save your query by clicking the Save command on the Quick Access Toolbar.

COM-1010 Introduction to Information Technology Page 49


More query options

Parameter query

A parameter query allows you to create a query that can be updated easily to reflect a new criterion, or
search term. When you open a parameter query, Access will prompt you for a search term and then
show you query results that reflect that search.

Find duplicates query

A find duplicates query lets you find all duplicate records in your database so you can delete them.
Duplicate records can negatively affect the integrity of your database.

Reports
Reports give you the ability to present components of your database in an easy-to-read, printable
format. Access lets you create reports from both tables and queries.

To create a report:

 Open the table or query you want to use in


your report. We want to print a list of
cookies we've sold, so we'll open the
Cookies Sold query.

Select the Create tab on the Ribbon.


Locate the Reports group, then click
the Report command

Access will create a new report based on your object.

It's likely that some of your data will be located on the other side of the page break. To fix this, resize
your fields. Simply select a field, then click and drag its edge until the field is the desired size. Repeat
with additional fields until all of your fields fit.

COM-1010 Introduction to Information Technology Page 50


To save your report, click the Save command on the Quick Access Toolbar. When prompted, type a
name for your report, then click OK.

Deleting fields

You might find that your report contains some fields you don't really need to view. For instance, our
report contains the Zip Code field, which isn't necessary in a list of orders. Fortunately, you can delete
fields in reports without affecting the table or query where you grabbed your data.

To delete a field in a report:

 Click any cell in the field you want to delete, then


press the Delete key on your keyboard.
 The field will be deleted.

When you delete a field, be sure to delete its header as


well. Simply select the header and press the Delete key.

Printing and saving reports in Print Preview

While you can print reports using commands in Backstage view, you can also use Print Preview. Print
Preview shows you how your report will appear on the printed page. It also allows you to modify the
way your report is displayed, print it, and even save it as a different file type.

COM-1010 Introduction to Information Technology Page 51


Access Report – Print Preview

1. Print: Click the Print


command to print your report.
2. Page Size Options: With
page size options, you can set the
width of the margins in your report.
3. Page Layout Options: Here,
you can change the orientation of
your report. Select either portrait
(tall) or landscape (wide). You can
also create columns or click the
Page Setup command for more
layout options.
4. Zoom Options: With zoom options, you can decide how much of the report you want to see on
screen. You can also opt to view multiple pages at once.
5. Export Options: Export options allow you to save your report in another format. This makes it
possible to view your report in other programs.

To print a report:

From the Home tab, click the View command, then select Print Preview from the drop-down
list. Your report will be shown as it will appear on the printed page.

If necessary, modify the page size, margin width, and page orientation using the related
commands on the Ribbon.

Click the Print command. The Print dialog box will


appear. Set any desired print options, then click OK. The
report will be printed.

COM-1010 Introduction to Information Technology Page 52


Saving Reports

With Microsoft Access, you can save reports in other formats so they will be viewable outside of
Access. This is called exporting. It allows you to view or even modify reports in other formats and
programs.

In Access you have the options to save your report as:


 an Excel file,
 text file,
 PDF,
 HTML document

To export a report:

From the Home tab, click the View command, then select Print Preview from the drop-down list.

 Locate the Data group on the Ribbon.


 Select one of the file type options, or click More
to see options to save your report as a Word or
HTML file.

A dialog box will appear in order to Select the location where you want to save the report.

 There you can enter a name for the report file, then
click Publish.
 A dialog box will appear to notify you that your file
has been successfully saved.
 Click Close to return to your report.

The Report Wizard

Another way or method to create reports is with a


feature called Report Wizard. While using the Report
command is a quick way to create reports from the
current object, it is not as helpful if you want to create a
report with data from multiple objects. The Report
Wizard makes it easy to create reports using fields from
multiple tables and queries. I addition, lets you choose
how your data will be organized.

To create a report with the Report Wizard:

To create a Report with Report Wizard, you have to follow the steps below:
 Select the Create tab and locate the Reports group and Click the Report Wizard command.

COM-1010 Introduction to Information Technology Page 53


The Report Wizard will appear:

Step 1: You have to select the fields you want to include in your report. This can be done by clicking on
the drop-down arrow and from the drop-down list you can select the table or query that contains the
desired field(s).

Then, Select a field from the list on the left, and click the right arrow to add it to the report

You can add fields from more than one table or query by repeating the above steps. Once you've added
the desired fields, click Next.

Step 2: Organize the report.

The Report Wizard will provide you with options that let you choose how to view and organize your
data. These options group similar data within your fields and organize these fields into multiple levels,
like in an outline or bulleted list.

This is valid when you are building a report from multiple tables or queries.

COM-1010 Introduction to Information Technology Page 54


Microsoft Access offers a list of several organization options which can be selected from a list. When
you are satisfied with the basic organization of your data you can click Next to proceed (Fig.1).

Fig.1 Fig.2

If you're not satisfied with the way your data is organized and want to modify them a little more, you
can do so by modifying the grouping levels.

This can be done by selecting a field from the list and clicking the right arrow to add it as a new level.

If necessary, modify the order of your grouped fields by selecting a field and clicking the up or down
Priority arrow to move it up or down a level.

Once you are satisfied with the organization of your report, click Next.

Step 3: Sort your report data.

Sorting reports data is another way of modifying your reports. You can sort your report data following
the next steps:

 First, Click the top drop-down arrow, and select the name of the first field you want to sort.
 Then, Click the button on the right to change the sort to ascending or descending.

COM-1010 Introduction to Information Technology Page 55


You can Add any additional sorts. You can sort up to four fields.
The sort will be applied from top to bottom, meaning the sort at
the top of the list will be the main sort.

When you are satisfied with the way your data is sorted, click
Next.

Depending on the grouping you have chosen for your data, your
sorting options may be limited.

Step 4: Select a layout and title.

Click the various layout options to see how they look, then
select one to use in your report.

Select either a portrait (tall) or landscape (wide) orientation


for your report.

Once you are satisfied with your report layout, click Next.

Select the text box, and type the title you want for your report.

Select whether you want to preview the report or modify its


design, then click Finish.

Your report will be created and saved.

You may have to adjust your field and row size and location
to make sure your data looks the way you want it to. To do
this, you'll need to switch to Design view. When you're done,
switch back to Report view to see your changes.

Formatting reports

One of the strengths of reports is that you can modify their


appearance to make them look how you want. You can add
headers and footers, apply new colors, and even add a logo.
All of these things can help you create visually appealing
reports.

COM-1010 Introduction to Information Technology Page 56


Modifying the page header and footer

To view and modify the header and footer that appear on each page of your report, select the View
command on the Ribbon and switch to Design view. The header and footer are located in the white
space beneath the Page Header and Page Footer bars.

In case your report's design does not have a white space in the page header and footer, as in the image
below, you must resize the header and footer before you can add anything to them. You can do so by
clicking and dragging the bottom border of the header or footer to make it larger.

To add text to a header or footer:

Select the Design tab, locate the Controls group, and click the Label command.

Click and drag the mouse inside the white area


to create your label. Release the mouse when it is
the desired size.

Click the text box, and type the desired text.

COM-1010 Introduction to Information Technology Page 57


To add the date and time to a header or footer:

Select the Design tab, locate the Header/Footer


group, and click the Date and Time command.

A dialog box will appear to Select the desired formatting options.

Every time you make a change, a preview of the text that will be
included in your report will appear.

When you are satisfied with the appearance of the date and time,
click OK.

By default, the date and time appear in the header. If you would like
to move them to the footer instead, simply click the date and time
boxes and drag them to the desired location.

To add page numbers to a header or footer:

Select the Design tab, then locate the


Header/Footer group.

Click the Page Numbers command.

The Page Numbers dialog box will appear. Under Format, choose Page N to
display the number of only the current page, or Page N of M to display the
number of the current page and the number of total pages.

Under Position, choose Top of Page or Bottom of Page to control where the page
numbers appear.

Click the drop-down arrow to select the alignment of the page numbers.

When you are satisfied with the settings, click OK.

COM-1010 Introduction to Information Technology Page 58


Modifying your report's appearance

To add a logo:

From the Design tab, click the View command, then


select Layout View from the drop-down list.

Locate the Header/Footer group and then click the


Logo command.

A dialog box will appear. Locate and select the desired file, then click OK to add it to your report.

A small version of the image will appear in the header. Click and drag the image border to resize it. If
necessary, move your logo to the desired location by clicking and dragging it.

Themes and fonts

A theme is a set of colors and fonts that applies to the entire database to give it a consistent,
professional look. By default, databases use the Office theme. When you change the theme, all of the
theme fonts and colors in your database change to match the new theme. Designing and modifying
reports using theme elements can help you keep the appearance of your reports consistent.

To change the theme:

Select the Design tab, locate the Themes group, and click the Themes
command.

A drop-down menu will appear. Select the desired theme. The theme
will be applied to your entire database.

COM-1010 Introduction to Information Technology Page 59


To change the theme fonts:

Select the Design tab, locate the Themes group, and click the Fonts
command.

A drop-down menu will appear. Select a set of theme fonts.

COM-1010 Introduction to Information Technology Page 60


References
Business Wire. (2002). Mobile Operators and Carriers Gain Real-Time Platform for Location-Based Services,
"TeleCommunication Systems Signs up as a Reseller of TimesTen".

Michael Vizard, "The Rise of In-Memory Databases", Slashdot.

O'Leary, Timothy, & O'Leary, Linda, & O'Leary, Daniel. (2015). Computing Essentials, 25th Edition.
Prentice-Hall. (2010). Information Systems Today, Managing in the Digital World, fourth edition.
Prentice-Hall. (2012). Management Information Systems, twelfth edition.
Rajaraman V. (2013). Introduction to Information Technology.
Turban Efraim, & Kelly, R. R., & Richard, P. E. (2005). Introduction to Information Technology, 3rd
Edition.
Williams Brian, & Sawyer Stacey. (2015). Using Information Technology, 11th Edition.

COM-1010 Introduction to Information Technology Page 61

You might also like