Presentation on theme: "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."— Presentation transcript:
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
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.
Database Purpose Store Sort Retrieve 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
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…
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
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….
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.
Steps involved Determine 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 Type text, number, yes/no, memo, date/time, currency –Field Characteristics size 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.
Basic Database Concepts Table –A set of related records Name: Ravi Department: Garden Tel: Name: Ravi u Field u Record –A collection of data about an individual item –A single item of data common to all records
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).
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
Fungi in the order - ‘Meliolales’ Information to be stored Fungus –Family –Genus –Species –Author Citation –Description Host Details –Host Genus –Host Species –Host Family
The single table database
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
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.
family, genus, host_genus, host_family
Normalization is a process designed to achieve three ends... eliminate redundant information, increase data integrity and make systems more efficient. Normalization
After Normalization Primary Key Foreign Key
Similarly Host Details also splitted Foreign Key Primary Key
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.)
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.
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.
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.
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
Field Properties – Filed Size
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
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
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.
Creating Form by Using Wizard (1/4) Create form by using wizard Tables/Queries Select table/query Select the fields Next
Creating Form by Using Wizard (2/4) Select the layout –Columnar –Justified –Tabular –Datasheet Next
Creating Form by Using Wizard (3/4) Select a visual style Next
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
Create Forms in Design View (1/2) To create a form from scratch –New –Design View –Select table/query –View|Toolbox
Create Forms in Design View (2/2) Add controls to the form –Clicking and dragging the field names –Creates a text box and label
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
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
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