Business computing Databases 2 4 january 2005. Program Create a simple database with several tables...

24
Business computing Databases 2 4 january 2005

Transcript of Business computing Databases 2 4 january 2005. Program Create a simple database with several tables...

Business computing

Databases 2

4 january 2005

Program

• Create a simple database with several tables using Access

• Study a more complex database available for download on the Net

• http://lapasserelle.com/escem/business_computing/session09_databases/

• bdcomptoir.mdb

Review of concepts

• Databases are tools to store, treat and retrieve STRUCTURED INFORMATION

• The business environment generates many sets of structured information– Accounting– Sales report– Production planning, production data– Human resources, etc.

Business and information

• In the business world we meet two types of information– Unstructured (or mildy structured) : presented

in letters, reports, various documents, conversations

– STRUCTURED (strongly structured) : information made of many elements, all of them with exactly the same shape. An element is called a RECORD

The various tools to deal with informationand to communicate

• Word : the equivalent of a typewriter to produce pages of text

• Excel : a collection of cells organised into a grid, into which we make calculations. It is also used for clean presentation of tables

• PowerPoint : the equivalent of transparencies with synthetic points to communicate with an audience

• Access (a bit more complicated) : to store, treat, and retrieve (and create documents with) STRUCTURED INFORMATION

• In Access we must clearly distinguish in our minds STORING and RETRIEVING information

One table structured information

• Simple structured information is organised into a set of RECORDS, each of them with the same structure of FIELDS

• The collection of RECORDS is called a TABLE• Think of a set of cards, bearing the same

information on many people, and stored into a shoebox :– Record = Card– Field = an element of information on a card– Table = the collection of cards

A first example : a database of contacts

• We shall create a one table database of contacts, using (to start with) Excel

• On each record we shall have several fields :– Lastname– Firstname– Date of birth– Address– City– Department– Employer– Employer’s address– Salary– Picture

The records and the information in each field

• If we have 10 records (that is ten people in our contact list), this does not mean that we have 10 cities, and 10 employers

• We may have only 3 cities• We may have only 4 employers

• After having created a unique table, we shall create a new database we several tables.

Excel

• When using Excel instead of cards in a box, the equivalent of the cards (that is the records) are ROWS

• The equivalent of fields are COLUMNS

• The whole Excel grid is the shoebox

Example

CourtesyLastnam

e Firstname Address CityDepartm

ent Employer Employer city

Mrs Dupont Mary rue du marché Poitiers 86 Futuroscope Chasseneuil

Mr Dupont John rue du marché Poitiers 86 ABC Poitiers

Mr Durand Jacques place de l'église Tours 37 Escem_Tours Tours

Mrs Durand Hélène place de l'église Tours 37 Futuroscope Chasseneuil

Ms Laforêt Simone rue du Mail Poitiers 86 Escem_Poitiers Poitiers

Mr Dubois Pierre place du marché Paris 75 DEF Paris

Mr Martin Henri rue du Mail Poitiers 86 Futuroscope Chasseneuil

Mrs Martin Pauline rue du Mail Poitiers 86 Escem_Poitiers Poitiers

Ms Martin Nancy place de l'église Poitiers 86 ABC Poitiers

Mr Dutertre Jack cours la reine Paris 75 Escem_Tours Tours

Comments on the example

• We have 10 central elements of information : the 10 people

• For each person, we have EXACTLY THE SAME 8 fields of elementary information– Name– Address, etc

• Some information is repeated : the cities, the employers, etc. (Poitiers -> 86 : so typing 86 each time is a repetition !)

Excel has simple database functionalities

• With our single excel table we can begin to implement databases functionalities

• Select all the data, and implement « data->filter-> automatic filtering »

• Then we can display only the records corresponding to people living in Tours…

• It is called a (simple) REQUEST

The concept of REQUEST is central

• If our database was made of records, each of which is ONE SALE at some date, of some product, to some client, by such and such salesman, etc…

• …we could make a REQUEST to obtain the sales of last month, in the Northern sales region by our salesman John Doe, in the product range A

Usefulness of a database

• A sales database, as described, can provide very useful sales analyses to understand our market, our competitors, what we must correct, which clients we must visit more, etc.

• It is the beginning of information useful for business strategy

• An accounting system is also a database. It is one of the dashboards necessary to pilot a firm

Creation of the same database using Access

• First : we « analyse » our data, to see– What will be the « central elements » (the records) :

here the solution is simple, it is going to be « the persons »

– Which information is repeated several times ; it is going to go into different tables : here it is

• Cities• Employers

– These will be separate tables, beside the central « persons » table

• This « analysis » step is called : choosing the architecture of the database

Knowing how to type

• Knowing typing has always distinguished managers and secretaries

• A generation ago : – Secretaries knew how to type– and Manager didn’t

• Now this is still true, but the other way around.

Working with a database

• When constructing a database and filling it with data, life is not as intuitive as with Word or Excel, where we always « see » our data

• With Access we will often be disturbed by the question « but where the hell is the data ?! »

• It requires some practice to distinguish the data stored and the « things » displayed.

Table creation

• We have to create the tables – the equivalent of « shoeboxes » for some subset of the data

• There will be – a table for the cities– a table for the employers– and a main table for the persons

• We shall discover how this allows us to enter data without repetition

The table for cities• The table for cities, in the « table display »

The table for cities• The table for cities, in the « form display »

Table for employers

• Same procedures as for cities

• Define the structure (the fields)

• Define a primary key• Fill in the data (either

in a table display or in a form display)

Table persons

• Finally : the last central table : persons

Storage and display

• Now our database is filled in :

• But we wonder : « where is the data ? »

• It is inside the tables. But no table contains all the data

Table person

• Displayed as a form