37
WHAT IS A DATABASE? • A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY • A GENERAL PURPOSE CONTAINER FOR STORING AND MANAGING INFORMATION

WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Embed Size (px)

Citation preview

Page 1: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

WHAT IS A DATABASE?

• A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSEOR TO PUT IT SIMPLY

• A GENERAL PURPOSE CONTAINER FOR STORING AND MANAGING INFORMATION

Page 2: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

DATABASE OBJECTS

Page 3: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

OBJECTS IN A DATABASE

• TABLE• QUERY• FORMS• REPORTS

• MACRO• MODULE

Page 4: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Tables

• Fundamental structures in a database

• store data• data is organised in to fields

(columns) and records (rows)

• open to datasheet view

Page 5: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Query

• Tool for asking question about a data

• performing action on your data• can be used to combine or join

data from different related tables• can be used as basis for forms

and reports

Page 6: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Form

• Forms let you display and enter data in a convenient format

• More like fill in the blanks• Forms can include other forms

called subforms that lets you enter data into several tables at once

Page 7: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Report

• Reports let you print or preview data in a useful format

• Reports can print query result in a easy to undestand manner

Page 8: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Macro

• A macro is a set of instruction that automates a task you need to do often

• Access carries out action in the macro in the order in which actions are listed

Page 9: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Module

• Very similar to macros but give precise control over action taken

• requires visual basic programming expertise

Page 10: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

OBJECT NAMING RULES

• THE NAMES CANNOT BE THE SAME AS ANY OTHER OBJECT OF THE SAME TYPE WITHIN THE SAME DATABSE

• YOU CANNOT GIVE A TABLE AND QUERY THE SAME NAME

• THE NAME CAN BE UP TO 64 CHARACTERS, INCLUDING SPACES. HOWEVER NAMES CANNOT START WITH A SPACE

Page 11: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

OBJECT NAMING CONTD…..• THE NAMES CAN INCLUDE PUNCTUATIONS,

CHARACTERS EXCEPT A PERIOD (. ), AN EXCLAMATION MARK (!), OR BRACKETS{( )}

• AVOID USING SPACES IN OBJECT NAMES, FIELD NAMES FOR EXAMPLE USE EMPLOYEENAME INSTEAD OF EMPLOYEE NAME

• WHEN NAMING A FIELD, AVOID CHOOSING NAMES THAT ARE SAME AS BUILT IN ACCESS FUNCTIONS NAMES OR PROPERTY NAMES.

Page 12: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Creating a Table

• Click the Tables tab on the database window and then click new button --> choose design view

Page 13: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Table creating view in access

Page 14: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Defining a Table’s Fields

• Type a filed name (up to 64 characters)

• Select the data type• Description column type a description

of the field• click general or look up tab in the field

property area and define properties• repeat these steps for every field

Page 15: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Table -- Design View

Page 16: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Data Types

• Auto Numbers A number automaticaaly assigned and never

changes• Currency Rupees Amount• Date/Time Stores Date and Time• Lookup Values that come from

another table/query or list of values one supplies

Page 17: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Data Types ---> contd• Memo large bodies of text up to

640000 character in length• Number True numbers such as

quantities. Choose only for field types that require calculations

• OLE object Any OLE object such as picture , sound or word processing document

Page 18: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Data Types ---> contd

• Text Any written text upto 255 characters in length, numbers that don’t require calculations, and certatin

numbers such as zip code, phone numbers etc.,

• Yes/No A true or False Value only

Page 19: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Important General Field Properties• Allow Zero Length: If Yes, the field will

accept an “empty string” as a valid entry, even if required property is set to YesThe empty string will appear as two quotation mark with nothing in between (“”) when first typed into the field. Those quotes will disappear when the cursor is moved to a different field

Page 20: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Important General Field Properties -- continued• Caption: Lets you define an

alternate name for the field that will be used in datasheet view and labels

• Decimal Places: Lets you specify the number of digits to the right of the decimal separator in a numeric field

Page 21: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Important General Field Properties ---- continued• Default Value: Lets you define a

value that is automatically inserted into the field.You can type a different value during data entry if required The default value for a text field is empty string and for a number or currency field is 0

Page 22: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Important General Field properties ----continued• Field Size: Lets you specify the

maximum length of text allotted in a field or the acceptable range of numbersThough Access does’nt pad text that is shorter than its allotted field length, a smaller maximum field size can conserve memory and speed up processing

Page 23: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Important General Field Properties ---- continued• Format : Lets you define the

appearance of a data in a fieldeg., You can show a date as 14/02/2003 or as February 14, 2003

• Indexed: Lets you choose whether to Index this field and whether to allow duplicates in the index

Page 24: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Important General Field Properties ---- continued• Input Mask: Lets you define a

pattern for entering data into a field• Required: If set to Yes, The field

cannot be left Blank• Validation Rule: Lets you create an

expression that tests data as it comes into the field and rejects faulty entries

Page 25: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

EXAMPLES OF VALIDATION RULE EXPRESSION• >0 DISALLOWS 0 OR A

NEGATIVE NUMBER IN A NUMBER OR CURRENCY FIELD

• <>0 ALLOWS ANY NEGATIVE OR POSITIVE NUMBER BUT NOT 0

Page 26: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

EXAMPLES OF VALIDATION RULE EXPRESSION --- CONTD• BETWEEN 1 AND 100 ACCEPTS

NUMBERS ONLY IN THE RANGE OF 1

AND 100 (INCLUSIVE)• >=#30/11/2000 PREVENTS

DATES EARLIER THAN

30/11/2000

Page 27: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

PRIMARY KEY

• A Primary key is a field (or group of fields) that uniquely identifies each record

• When one defines a primary key you do make sure that no two records in the table have the same value in the field that defines the primary keyKeep records sorted by the entries in the primary keyspeeds up processing

Page 28: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Primary key ---- does what?• Primary key ensures that each

record has a unique identificationand that a field is not left null both unique property and not null property is taken when a field is defined as primary key

Page 29: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Input mask

• When you use input mask, special characters tell access how to limit the data that gets entered in a field

Page 30: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Input mask characters

• 0 required numbers (0-9), no plus or minus sign

• 9 optional number (0-9) or space, no plus or minus sign

• # optional number (0-9) or space, plus or minus sign allowed

Page 31: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Input mask characters continued• L required letter (A_Z)• ? Optional letter (A_Z)• A Required letter or number• a optional letter or number• & required character or space• C optional character or space

Page 32: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Input mask characters continued• < characters that gets converted

to lower case• > characters that get converted

to upper case• ! A mask that displays from right

to left, characters always entered left to right

• \ Next character in mask to display as a constant

Page 33: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Sample Input Mask

• The Mask Allows these field values

• (999)000-0000 (080)228-6923( )228-6923

• >LL0000 as02369• AAa d13

15AN

Page 34: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Sample Input Mask

• 00000-9999 98450-1234598451-

• LL-00-L?-0009 KA-02-P-1152

KA-05-MA-116

Page 35: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Relationship

• For tables to be related they must have fields with common valuesfor eg., in two tables dept and emp there is a common field deptno through which the tables can be related.

Page 36: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING

Types of relationship

• One- To- One: This type of relationship exists when there is only one record on each table for each linking value

• One- To- Many: When there can be more than one record for a linking value on one side of a relationship

• Many- To- Many: This type describes the situation where linking values can appear in multiple records on both sides of relationship

Page 37: WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING