what is database ? a database is a collection of information that's related to a particular...

47
What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Upload: maximillian-imber

Post on 14-Dec-2015

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

What is database ?

A database is a collection of information that's related to a particular subject or purpose.

A structured collection of related data

Page 2: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Some Examples

• Telephone directory

• Patients records in a hospital

Page 3: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Examples contd….

• Library Catalog– Books Available.– Members Information.– Which Books with whom.

• University Class Schedule -Timetable– Students have many

professors.– Professors have many

students.– Classes can be held in

many classrooms.

Page 4: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Database Purpose

Store

Sort

Retrieve

DATA

Page 5: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Data vs. Information

• Data – a collection of facts made up of text, numbers and dates:

Ravi 3,50,000• Information - the meaning given to data in

the way it is interpreted:

Mr. Ravi is a sales person whose annual salary is Rs.3,50,000

Page 6: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Without aid of computer

• You're having to coordinate and organize yourself

• If an STD-code number changes, you might have to update that information in all places

• More than 1 person needs to enter data at the same time

• You need to give certain people access to one view of the data and other people to a different view

Contd…

Page 7: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Querying is difficult

• Select all the people with brown hair, high blood pressure, and younger than 37

• Match all survey information with voting history for 400,000 people

• Show all the purchases on a given day and add on personal information for any people where we have the information

Page 8: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

If your database is stored on a computer

• Any change in a particular data is automatically updated wherever you use it in the database.

• Querying very easy

• define relationships, data types and many more….

Page 9: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Data Integrity is maintained

• Data must be accurate.• Data is RELATED to other data in your

database (e.g., library patron is related to the book(s) that s/he has checked out).

• Maintaining the INTEGRITY of the relationship between different pieces of data is very important.

Page 10: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Steps involvedDetermine the purpose of your database• This will help you decide what data you want your access database to store.Determine the fields that you will need• Decide what specific pieces of information you want to store.Group related fields together• Once you have a clear purpose for your database and know what pieces of

information you want to track.Determine Properties for each field

– Data Typetext, number, yes/no, memo, date/time, currency

– Field Characteristicssize limit, required, case specifications, entry specifications

Determine Keys and Relationships• Look at each table and decide how the data in one table is related to the

data in other tables.

Page 11: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Basic Database Concepts

• Table– A set of related records

Name: RaviDepartment: GardenTel: 2437766

Name: RaviDepartment: GardenTel: 2437766

Name: Ravi

Field

Record– A collection of data

about an individual item

– A single item of data common to all records

Page 12: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Tables to Store and manage your data How data is organized in tables?

• A table is a collection of data about a specific topic.

• Tables organize data into columns (called fields) and rows (called records).

Page 13: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Data types

• Data type for data integrity (field data type: A characteristic of a field that determines what kind of data it can store. For example, a field whose data type is Text can store data consisting of either text or number characters, but a Number field can only store numerical data.

• Applicable data types– Text– Byte– Integer– Long Integer– Single– Double– Decimal

Page 14: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data
Page 15: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Plants ClassificationFamily-A

Genus-1Genus-2

Page 16: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Scenario:Fungi-1Fungi-2

Host-A

Host-B

Host-C

Fungi-3

Fungi-4

Host Family-1

Host Family-2

Page 17: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Fungi in the order - ‘Meliolales’Information to be stored

• Fungus– Family– Genus– Species– Author Citation– Description

• Host Details– Host Genus– Host Species– Host Family

Page 18: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

The single table database

Page 19: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Problems in Single Table Databases

• Data redundancy is more (eats up more memory)

• Need to update one by one if a data is to be corrected (no automatic updating)

• Chance of errors is more

• Data Entry is pain staking

Page 20: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Reducing Data redundancy

• Analyzing the table find out redundant (repeating) split the table accordingly

Using a separate table for each topic means that you store that data only once. This results in a more efficient database and fewer data-entry errors.

Page 21: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

family, genus, host_genus, host_family

Page 22: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Normalization is a process designed to achieve three ends ... eliminate redundant

information, increase data integrity and

make systems more efficient.

Normalization

Page 23: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

After NormalizationPrimary Key

Primary Key

Primary Key

Foreign Key

Foreign KeyForeign Key

Page 24: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Similarly Host Details also splittedForeign Key

Primary Key Primary Key

Page 25: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Primary Keys & Foreign keys

• Primary Key is a variable/attribute that uniquely identifies each row

• Foreign key is a primary key from another table in your table.( When two tables are related you need a way to show that they are related.)

Page 26: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Relationships

• Relationships ‘connect’ tables. In other words they link the data in one table to the data in another. Relationships are established using a common field that is present in both the tables to be related.

Page 27: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Relationships

Page 28: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Types of Relations

• In a one-to-one relationship each record in one table has at most one related record in another table. This type of relationship is rare.

• A one-to-many relationship is by far the most common. Here one record in one table can be related to many records in another table.

• A many-to-many relationship means that for each record in one table there can be many records in another table and for each record in the second table there can be many in the first.

Page 29: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Referential integrity

Referential integrity is to ensure that relationships between records in related tables are valid and that you don't accidentally delete or change related data.

The referential integrity rule says that the database must not contain any unmatched foreign key values. What this is saying is that a record cannot be added to a table with a foreign key unless the referenced value exists in the primary table.

Page 30: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Hands-on Session

Page 31: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

New Database

Page 32: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data
Page 33: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Creating Tables in Design View

• Field Name - can not exceed 64 characters in length and may include spaces.

• Data Types– Text, Memo, Number, Date/Time, Currency, AutoNumber,

Yes/No– OLE Object – An OLE (Object Linking and Embedding) object

is a sound, picture, or other object such as a Word document or Excel spreadsheet that is created in another program

– Hyperlink – DisplayText#Address#SubAddress#ScreenTip. • Internet: CS287 Web#http://www.cse.mrt.ac.lk/lecnotes/cs287#• Database: #c:\My Documents\database.mdb#MyTable

• Description• Field Properties

Page 34: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data
Page 35: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Field Properties – Filed Size

Page 36: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Queries

• Queries select records from one or more tables

• They can be viewed, analyzed, and sorted on a common datasheet

• Resulting record set is called a dynaset (short for dynamic subset)

• Dynaset can save for future use

Page 37: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Queries examples

Basic Queries

• Get Fungi list in Family-1

• Get Fungi list under Genus-1

Host Related Queries

• Get Fungi list under Host Family-1

• Get Fungi list under Host-1

Page 38: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

What is a Form?

It is simply an alternative way to enter data into a database table It also provides an alternative way of displaying data. Rather than displaying the data in datasheet view, a Form can be used to make data entry easier.

Page 39: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Creating Form by Using Wizard (1/4)

• Create form by using wizard • Tables/Queries

• Select table/query

• Select the fields

• Next

Page 40: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Creating Form by Using Wizard (2/4)

• Select the layout– Columnar – Justified– Tabular– Datasheet

• Next

Page 41: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Creating Form by Using Wizard (3/4)

• Select a visual style

• Next

Page 42: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Creating Form by Using Wizard (4/4)

• Name the form – Open the form to view or enter information– Or – Modify the form's design

• Finish

Page 43: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Create Forms in Design View (1/2)

• To create a form from scratch– New – Design View – Select table/query – View|Toolbox

Page 44: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Create Forms in Design View (2/2)

• Add controls to the form– Clicking and dragging the field names – Creates a text box and label

Page 45: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Adding Records Using Forms

• Input data filling out the fields of the form

• Use Tab to move from field to field

• Create a new record– Press Tab after the last field of the last record– Click the New Record

• Records are automatically saved

Page 46: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Qualities of a Good Database Design

• Reflects real-world structure of the problem

• Can represent all expected data over time

• Avoids redundant storage of data items

• Provides efficient access to data

• Supports the maintenance of data integrity over time

• Clean, consistent, and easy to understand

Page 47: What is database ? A database is a collection of information that's related to a particular subject or purpose. A structured collection of related data

Conclusion

• Access is good for– Beginners– Small to medium size DBs < 200mbs– 1 to 2 concurrent users– Windows only teams (for the most part)– Front ends to more complicated DBs