You are on page 1of 18

An Introduction to

Databases
Created by: H.R. Lawrence

 A structure that can be used to store information about various entities and the relationships that exist among them .What is a database?  A collection of data organized in a manner that allows access. retrieval and use of that data.

place or thing about which information will be stored. A person.  An attribute is a property of an entity. it is used to maintain links between entities (tables) using a key. Typically. .  A relation is an association between entities.Common Database Terminology  An entity is an object.

Types of Keys  Primary.  Alternate/Secondary – Any candidate key that is not selected to be the primary key  Foreign – A primary key in one table that appears in another table but does not function as the primary key . In most cases it is the indexed key that is used to maintain sequence  Composite – is made up of two or more fields  Candidate – Any key that can be used as a primary key – but was not chosen to function as such.used to uniquely identify each record/tuple in a table.

.  Examples of powerful desktop DBMS are: Microsoft Access. sort. FileMaker Pro. and Paradox. modify. Lotus Approach.Database Management System (DBMS)  A software package that is designed to manipulate (add. MySQL. retrieve and delete) data in a database by an end user.

a binary digit can either be a one (1) or zero (0). number symbol or punctuation mark.g. name. Bit.  Character is a collection of eight (8) bits.  Field is a column in a database.Hierarchical Structure of a Database  Bit is the smallest unit of data that a computer can understand. gender and address of a student . age. also known as a byte. This can be any letter. A field contains a specific piece of information e.

for example.  Record (Tuple) is a row in a database.  Files are made up of records. In a school. A record is a unit of information about something e. you find files on students and teachers ..g. about a single student in a class.Hierarchical Structure of a Database cont.

Objects in a Database Management System  Tables  Forms  Reports  Queries .

.  A table is a collection of data about a specific topic.Creating a Database  Tables are the building blocks of databases. such as person or thing.

 A separate table should be created for each entity as this will greatly reduce data entry errors and increase efficiency.Creating a Database cont…  Tables provide easy mechanisms for adding. changing and deleting data including the ability to make mass changes in a single operation.  It is a good idea to design your database initially using pen/pencil and paper. .

5. address.Defining the Structure of Tables In defining the structure of a table you need the following (as a start): 1. such as text. Field Name —Each field in the table must have a unique name. Field Properties – which include data validation check . some fields in your school record would be first name. Field length – (for text) this determines the size of the field. For example. date or currency. 2. Data Type — This indicates to Access the type of data the field will contain. DOB. last name. 3. 4. Description — Access allows you to enter a detailed description of the field (optional). gender etc. number.

Example of Table Structure .

Number Data to be used for calculation except money. 8 bytes . postal and telephone numbers. Used with numbers that will not be used in calculations. The user can control the number of character. 8 or 16 bytes.536 characters.Data Types use by Microsoft Access Data Type Use For Size Text Made up of combination of letters and numbers. 2. 4. Memo Use for long text and numbers such as notes or descriptions Up to 65. for example. Up to 255 characters. Currency Used to store money. 1. This data type accurately calculates money 8 bytes Date / Time Use to store date and time.

Look Up Wizard If two tables have the same entries the entry is typed once in the first table and a look up field is used to pull the entries from the first to the second. Up to 1 GigaByte. . Yes/No (a. Graphics.k.Data Types use by Microsoft Access cont… Data Type Use For Size AutoNumber Use for automatically sequencing data.a. true or false and on or off. Sound etc. Boolean or Logical field) Use for fields that will contain only one 1 bit of two values such as yes or no. Hyperlink Contain a link to a URL on the Internet. OLE Objects Stores objects such as Microsoft Applications: Pictures.

Advantages of a database  Quicker and easier access to data  Allowing sharing of data .

Click OK  Choose your storage location (  Enter the File Name in the textbox.TO CREATE A NEW DATABASE FILE  Click Start. and then click Create .  Microsoft Office. Microsoft Office Access 2003  Select Blank Access Database. All Programs.

Click in the respective row. Press the TAB key then enter the description (if given one) [IF THE DATA TYPE IS TEXT delete the 50 at Field Size and enter the value given] Repeat from step 3 to enter remaining fields. enter the table name and then click OK. . select the Data Type (Text is the default) by clicking on it. Primary Key. Click Edit. Close the design view window.TO DEFINE THE STRUCTURE OF A TABLE           Click Tables in the Objects pane Double click Create table in Design view OR click once and then press the Enter Key Enter the first Field Name in the Field Name Column. To select a Primary Key. and then press the TAB key Click on the drop down list. Click File then Save.

TO POPULATE (ENTER DATA INTO) A TABLE  Click on Tables in the object pane (the names of existing table(s) will be displayed)  Double click the name of the table you want OR click once and then press the Enter Key  Enter the relevant data for EACH record under the respective Field Names .