Presentation on theme: "A structured collection of related data"— Presentation transcript:
1 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
2 Some ExamplesTelephone directoryPatients records in a hospital
3 Examples contd…. Library Catalog University Class Schedule -Timetable Books Available.Members Information.Which Books with whom.University Class Schedule -TimetableStudents have many professors.Professors have many students.Classes can be held in many classrooms.
5 Data vs. InformationData – a collection of facts made up of text, numbers and dates: Ravi ,50,000Information - 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
6 Without aid of computer You're having to coordinate and organize yourselfIf an STD-code number changes, you might have to update that information in all placesMore than 1 person needs to enter data at the same timeYou need to give certain people access to one view of the data and other people to a different viewContd…
7 Querying is difficultSelect all the people with brown hair, high blood pressure, and younger than 37Match all survey information with voting history for 400,000 peopleShow all the purchases on a given day and add on personal information for any people where we have the information
8 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 easydefine relationships, data types and many more….
9 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.
10 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 needDecide what specific pieces of information you want to store.Group related fields togetherOnce you have a clear purpose for your database and know what pieces of information you want to track.Determine Properties for each fieldData Typetext, number, yes/no, memo, date/time, currencyField Characteristicssize limit, required, case specifications, entry specificationsDetermine Keys and RelationshipsLook at each table and decide how the data in one table is related to the data in other tables.
11 Basic Database Concepts Name: Ravi Department: Garden Tel:TableA set of related recordsRecordName: Ravi Department: Garden Tel:A collection of data about an individual itemFieldName: RaviA single item of data common to all records
12 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).
13 Data typesData 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 typesTextByteIntegerLong IntegerSingleDoubleDecimal
19 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 moreData Entry is pain staking
20 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.
24 Similarly Host Details also splitted Foreign KeyPrimary KeyPrimary Key
25 Primary Keys & Foreign keys Primary Key is a variable/attribute that uniquely identifies each rowForeign 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.)
26 RelationshipsRelationships ‘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.
28 Types of RelationsIn 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.
29 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.
33 Creating Tables in Design View Field Name - can not exceed 64 characters in length and may include spaces.Data TypesText, Memo, Number, Date/Time, Currency, AutoNumber, Yes/NoOLE 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 programHyperlink – DisplayText#Address#SubAddress#ScreenTip.Internet: CS287 Web#http://www.cse.mrt.ac.lk/lecnotes/cs287#Database: #c:\My Documents\database.mdb#MyTableDescriptionField Properties
36 Queries Queries select records from one or more tables They can be viewed, analyzed, and sorted on a common datasheetResulting record set is called a dynaset (short for dynamic subset)Dynaset can save for future use
37 Queries examples Basic Queries Get Fungi list in Family-1 Get Fungi list under Genus-1Host Related QueriesGet Fungi list under Host Family-1Get Fungi list under Host-1
38 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.
39 Creating Form by Using Wizard (1/4) Create form by using wizard Tables/Queries Select table/query Select the fields Next
40 Creating Form by Using Wizard (2/4) Select the layoutColumnarJustifiedTabularDatasheet Next
41 Creating Form by Using Wizard (3/4) Select a visual style Next
42 Creating Form by Using Wizard (4/4) Name the form Open the form to view or enter informationOrModify the form's design Finish
43 Create Forms in Design View (1/2) To create a form from scratchNew Design View Select table/query View|Toolbox
44 Create Forms in Design View (2/2) Add controls to the formClicking and dragging the field names Creates a text box and label
45 Adding Records Using Forms Input data filling out the fields of the formUse Tab to move from field to fieldCreate a new recordPress Tab after the last field of the last recordClick the New RecordRecords are automatically saved
46 Qualities of a Good Database Design Reflects real-world structure of the problemCan represent all expected data over timeAvoids redundant storage of data itemsProvides efficient access to dataSupports the maintenance of data integrity over timeClean, consistent, and easy to understand
47 Conclusion Access is good for Beginners Small to medium size DBs < 200mbs1 to 2 concurrent usersWindows only teams (for the most part)Front ends to more complicated DBs