You are on page 1of 33

Course: Database Applications Lesson: Week 1, Lecture 1 Topic: Course Overview Course Overview Welcome to the Database Applications

course! In this course, you will learn about a Database Management System (DBMS) that helps you manage your data efficiently. You will learn about the different types of databases and various database objects, such as tables, queries, reports, and forms. This course will familiarize you with Microsoft Access 2003, which is a commonly used database application. Week 1 introduces you to the concept and types of DBMSes. You will learn about the design and structure of a Relational Database Management System (RDBMS) and the graphic user interface (GUI) of Access. Finally, you will learn how to create and edit tables and add records. In Week 2, you will learn to create relationships between tables, add indexes to retrieve records quickly, and create queries to select records based on specific criteria. Week 3 explores queries in detail. You will learn about action queries, crosstab queries, and top-value queries. You will also learn to use joins between two or more tables to extract records. Week 4 will discuss forms and reports. It will discuss the need to create customized reports. Finally, you will learn about adding custom controls to reports. Please go to the Assignments listed on the last page of this week's lectures to review this week's assignments before reviewing this week's lecture material. Course Overview Introducing a DBMS Structuring of a Database Designing a Database Introducing the Access GUI Creating a Database Creating Tables Modifying Tables

File Name: MC1400_W1_L1_S1_G1.gif

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 1 of 33

Course: Database Applications Lesson: Week 1, Lecture 2 Topic: Introducing a DBMS Introducing a DBMS (1 of 6) A DBMS is a system that provides an environment to organize data so that you can manage it easily. It enables you to store and retrieve data from a database and report results in fractions of seconds. A database can be compared to a filing cabinet at a doctor's office that contains files of various patients in alphabetical order. A database table can be compared to the cabinet drawer that contains files of patients whose names start with a particular letter. Just as a cabinet drawer contains files of multiple patients, a database table contains records related to relevant sets of data. Purpose of Using a DBMS Lets try to understand why we need a DBMS by using an example. Suppose an airline does not use databases. When you contact the airline for details of flights leaving Washington for London, the staff takes a long time to find out the information. This is because the office does not use a central repository of information and the staff needs to contact other offices to find out any information. This increases the response time for each query and leads to inefficiency. Let's now understand how the use of a database improves the situation at the airline. Please proceed to the next page. DBMS? Organize & manage store & retrieve A database is a central repository of related data that ensures faster information retrieval. File Name: MC1400_W1_L2_S1_G1.gif

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 2 of 33

Course: Database Applications Lesson: Week 1, Lecture 2 Topic: Introducing a DBMS Introducing a DBMS (2 of 6) The airline recently started using a database to store details of the schedule, availability of seats, and other flight-related information. The database also stores data about annual profits, expenses, and passenger profiles. This voluminous data is difficult to maintain without a database. Graphic Description: Main page graphic File Name: MC1400_W1_L2_S2_G1.gif

The airline maintains a database to store details about the schedule, availability of seats, and other flight-related information. A database enables several executives to respond quickly and simultaneously to queries from customers. Using the database, the airline staff can handle similar and complex queries quickly and with the same amount of ease. As shown, a database allows executives to simultaneously respond to queries BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna Page 3 of 33

from multiple customers. This is in contrast to a conventional data storage method where each user needs to maintain a copy of the same data. By using a database, the airline staff can quickly and easily handle queries, such as those regarding the fare on different routes, flight schedules, and other flight-related information. In addition to ease accessibility and use, a database offers the advantage that there are minimal chances of storing the same information two times. In contrast, duplicate entries can be recorded when data is stored manually. Please proceed to the next page.

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 4 of 33

Course: Database Applications Lesson: Week 1, Lecture 2 Topic: Introducing a DBMS Introducing a DBMS (3 of 6) A database, therefore, is a central organized store of related data that one or more users can access to obtain required information. Databases ensure faster information retrieval than conventional data storage methods that require manual searches to retrieve the required information. A database can store both static and dynamic data. Static data does not change; for instance, records of the books in a library. Dynamic data changes frequently, maybe daily, weekly, bi-weekly, or at any other time interval. For example, transactional data such as daily transactions in a store changes everyday. Graphic:

A database helps to: Handle large amounts of data Provide multi-user access Answer complex queries Return unambiguous results Minimize redundancies

File Name: MC1400_W1_L2_S3_G1.gif Static Data Library Database Book Code


MA346 ME350 IB374

Title
Microsoft Access 2003 Microsoft Excel 2003 Internet for Beginners

Author
Wallace Wallace Peterson

Edition
2004 2004 2002

ISBN
0-619-20030-2 0-619-20028-4 0-514-10014-2

Dynamic Data Library Database Receipt No


23 24

Date
05/22 05/22

Item Code
CL22 CA14

Description
Cereal Cleaning Agent

Cost
$6.99 $4.99

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 5 of 33

25

05/23

CG02

Candles

$3.99

File Name: MC1400_W1_L2_S3_G2.gif Please proceed to the next page.

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 6 of 33

Course: Database Applications Lesson: Week 1, Lecture 2 Topic: Introducing a DBMS Introducing a DBMS (4 of 6) Types of DBMS There are two main types of DBMS, a flat file system and an RDBMS. Lets discuss each of these in detail. Flat File System A flat file can be any file that you create in Notepad, Microsoft Word, or any other application to store data. Usually, the data stored in a flat file is in the form of strings and is separated using a common delimiter, such as a comma, space, semicolon, or colon. Graphic Description: Main page graphic

File Name: MC1400_W1_L2_S4_G1.gif A flat file can store small amounts of data that is simple in nature. You can use a flat file to store data that needs to be human-readable and hand-editable. For example, you can store simple lists and data values in a flat file. If a flat file is used to store complex and voluminous data, then managing the data would be difficult, time-consuming, and costly. A flat file is not suitable for storing data of complex nature. The most common problem of using a flat file system is that it is prone to corruption. A flat file does not provide any mechanism to prohibit several users from simultaneously viewing or modifying files, if the files are already in use by another user. Please proceed to the next page.

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 7 of 33

Course: Database Applications Lesson: Week 1, Lecture 2 Topic: Introducing a DBMS Introducing a DBMS (5 of 6) RDBMS An RDBMS is a database system that stores related data. The data in an RDBMS is stored in tables, which can be linked to each other. An RDBMS is suitable for storing complicated data with complex data structures. The most common RDBMS applications are Structured Query Language (SQL) Server, Oracle, and Access. An RDBMS consists of a collection of tables. A table contains a collection of information on a specific topic or of a specific nature, for example, an Employee table will contain information about the employees in a company. Lets discuss an example of a database used to store details of employees in a company. This database can contain two tables, an Employee table and an Employee Compensation table. The Employee table stores employee details such as EmployeeID, Name, Address, Date Hired, and Position. The Employee Compensation table stores details of the Compensation/hr and the Leave Used by the employees in a year, along with the EmployeeID and Name. Both these tables contain information on all the employees. The Employee and Employee Compensation tables can be linked. The relation comes from the fact that the Employee table can be cross-referenced with the Employee Compensation table with the help of EmployeeID, which is common to both the tables and unique to each employee. No two employees can have the same EmployeeID. Such information can be used as a unique identifier and can be used to link two or more tables in a database.

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 8 of 33

Graphic Description: Employee Table


Employee ID 23 34 48 Name Ron Floyd Mary Peterson David Wong Address E Ave, 3rd St, TX 42 Dr, TX 18 St, TX Date of Hire 12/04/200 0 05/18/200 2 01/20/198 8 Position Sales Manager Sales Executive Area Manager

Employee Compensation Table


Employee ID 18 34 14 Name Susan Ward Mary Peterson Ed Young Compensation/Hour $14 $15 $14 Leave availed 10 3 5

File Name: MC1400_W1_L2_S5_G1.gif

Please proceed to the next page.

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 9 of 33

Course: Database Applications Lesson: Week 1, Lecture 2 Topic: Introducing a DBMS Introducing a DBMS (5 of 6) Data Analysis Data analysis and selection of the type of database is critical to the effective use of a database. It is useful to know the exact nature of data to be stored in a database so that you can select an appropriate type of database. For instance, you must decide which type of data you want to store and whether you want to store the data for personal or professional use. If you are an event manager, you may want to store data related to the events you are going to work on. That may include the date, time, location, type of event, names of guests, expenses, and other information related to planning the event. You analyze data based on the type of reports you want to generate from your database. For example, if you want a report showing the number of events in a particular month, you need to store information about only the date, time, and location of all the events. Details such as reason, cost, and names of guests need not be stored in the database. Therefore, selection of a database depends on your requirements. While deciding whether to choose an RDBMS or a flat file system you should analyze the data. Graphic Description: A flash file. Caption: Features of RDBMS and Flat File System Instructions: Click each listed item to view its detail. Graphic Name: MC1400_W1_L2_S6_G1.swf Type of Data

RDBMS: If the data you want to store is complex and consists of hierarchical information, then an RDBMS is the best choice. An RDBMS supports database structures and imposes relationships on data. This ensures easy and efficient management of data. Flat File: If the data you want to use is simple, then a flat file is the best choice. If you want to use a flat file for complex data, you may have to create several flat files to store the data. It is also difficult to retrieve and manage complex data from a flat file.

Accuracy

RDBMS: If the data stored in an RDBMS is designed correctly, the records you retrieve from the database will be accurate. You can be sure of no duplicity. Flat File: The flat file system does not provide any means to ensure data accuracy. The manual editing and updating of records may result in data replication and inaccuracy. BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna Page 10 of 33

Speed

RDBMS: One database connection can allow you to access all the tables in the database. This speeds up data retrieval from the database. Flat File: Several flat files can emulate an RDBMS but each time you want to access data, you may have to open a new file.

Security

RDBMS: An RDBMS provides built-in security of data. When a user modifies a record, the database enforces a lock on the table so that no other user can modify the same record at the same time. Flat File: A flat file does not enforce any kind of security on the database. The responsibility for security relies on the application that uses the flat file.

Please proceed to the next page.

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 11 of 33

Course: Database Applications Lesson: Week 1, Lecture 3 Topic: Structure of a Relational Database Structure of a Relational Database (1 of 2) A relational database consists of tables, fields, and records. Lets discuss each of these in detail. Tables: Contain information or data on a specific topic or of specific nature. A relational database consists of a collection of tables. Each database table has a unique name. For example, an inventory database can consist of tables such as Suppliers, Products, and Invoice. An example of a database table might look like this:

Graphic Description: Graphic Name: MC1400_W1_L3_S1_G2.gif


Supplier ID 1001 1002 Rows Anna 1003 First Name John Jones George Last Name Smith 122, 2nd St. Doe Address 147, NE 1st St Chicago 14 A, 1st St City Chicago IL Chicago

Fields
State IL 60647 IL 60625 Zip Code 60635

Fields: Are columns in tables and they contain specific information. Fields are similar to topic headings in a chapter. For example, in the Supplier table, the fields are Supplier ID, Name, Address, City, and State. Records: Are the rows in a table that contain information about a person or a product. They are also knows as tuples. All values in a row are related to each other. For example, a row in the Supplier table contains information about a specific supplier, so John, Anna and George would each have their own record Let's discuss the types of data contained in the fields and records of a table. Please proceed to the next page.

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 12 of 33

Course: Database Applications Lesson: Week 1, Lecture 3 Topic: Structure of a Relational Database Structure of a Relational Database (2 of 2) Each field in a table is different; for example, while the Name field can store only text and the Zip Code field can store only numbers, the Address field can store both text and numbers. The nature of the content stored in each field defines the data type of that field. Data types: Refer to the properties of each field. In other words, data types define the nature of the content stored in a specific field. In an Access database, the data type of a field can be:

Text

Can contain only characters. The maximum limit of characters in this field is 255. Can contain only numbers, both positive and negative. Can contain only monetary data and displays values with currency symbols. Can store only date and time. Can contain both text and numbers. The total number of characters should not exceed 255 characters.

Number

Currency Date/time

Memo

AutoNumber

Can store only a unique sequential number that Access generates. Can store only Boolean values such as Yes and No. Can store only OLE objects, which can be linked or embedded in a table. Can store only the text that can be used as a hyperlink. Can store only values from another table or from a list of values by using a list box or a combo box.

Yes/No

OLE Objects

Hyperlink

Lookup Wizard

Please proceed to the next page.

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 13 of 33

Course: Database Applications Lesson: Week 1, Lecture 4 Topic: Unemployment Tax Regulations Designing a Database (1 of 6) Purpose of Designing a Database Database design refers to how your data is stored in a database. A good database design is critical for a relational database. It ensures high level of data accuracy and a reliable database system. Before designing a database, you must analyze your requirements and find out the information that you need to store in your database. Problems Resulting from a Poor Design If your database is not designed properly, then you may not get the desired result. The data retrieved from a poorly designed database can be: Unreliable and inaccurate Duplicated Retrieved slowly Difficult to add, modify, or delete

Graphic Description: Graphic Name: MC1400_W1_L3_S1_G2.gif

A Database with a Poor Design


Prod Supplier ID 34 Bigfoot Breweries City Bend Region Country OR USA

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 14 of 33

34

Heli Swaren GmbH Specialty Biscuits, Ltd. Leka Trading Specialty Biscuits, Ltd. Specialty Biscuits, Ltd. Durable Goods Life Long Friends Bigfoot Breweries

Berlin

Germany

68 42 42

Manchester Singapore Manchester

UK Singapore UK

21 61 46 35

Manchester SteHyacinthe Lyngby Bend OR

UK Qubec Canada Denmark USA

While creating tables and its fields, you must keep in mind that the tables should not contain any redundant data. Eliminate duplicate fields from the same table. This will ensure faster and accurate retrieval of data. Please proceed to the next page.

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 15 of 33

Course: Database Applications Lesson: Week 1, Lecture 4 Topic: Designing a Database Designing a Database (2 of 6) Steps to Design a Relational Database Lets discuss the steps that you need to follow to create a good database design. Create a design on paper. A rough database design helps you perfect the design before you actually create the database. The first step to design a database is to design the structure of the database based on the information available to you. To understand the steps of designing a database, consider the given scenario: Excellent Food Traders (EFT) supplies all kinds of packaged foods, including beverages, confectionery items, and dairy products. EFT maintains lists of suppliers and clients who are located all over the United States. At times, the company also has to ship products to new clients in different parts of the world. The company has 100 sales employees. To design a database for EFT, you need to: Step 1: Create a list of all the entities. Entities are the objects that have their own set of properties and features, such as a person, place, concept, or an activity on which data can be collected. For example, in this case, a client can be an entity. The company has a number of clients each with the same set of values, such as name, location, and contact person. The following are the entities that you can define for the database: Clients Products Sales Employees Suppliers Shippers Orders

Steps to design a database

1. Create a list of all the entities.


2. Create a list of attributes of the required entities. 3. Convert the entities into tables. 4. Identify key keys. 5. Determine relationships between tables. File name: MC1400_W1_L4_S2_G1.gif

Step 2: Create a list of attributes of the required entities. Attributes are the characteristics of entities that differentiate one entity from the other. For example, an address can have values such as apartment number, city, state, zip, and country. While listing the attributes, include only the important ones and eliminate the unimportant ones. For example, the attributes associated with the Clients table could include company name, contact person, address, number of employees, founder of the company, and stock price of the company. However, EFT needs to store only the attributes that are directly related to its business such as company name, address, and contact person. The attributes such as number of employees, founder of the company, and stock price are not important for EFT and dont need to be included in the table. BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 16 of 33

Please proceed to the next page.

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 17 of 33

Course: Database Applications Lesson: Week 1, Lecture 4 Topic: Designing a Database Designing a Database (3 of 6) The following are the attributes of the entities in the previous example that can be stored in the database:

Graphic Description: File Name: MC1400_W1_L4_S3_G1.gif Entities Attributes Clients Client ID, Company Name, Contact Name, Contact Title, Address, City, Region, Country, Zip Code, Phone Products Product Name, Category, Quantity per Unit, Unit Price, Units in Stock, Units on Order Sales Name, Designation, Work Assigned, Target Employees Employee Name, Designation, Address, City, Region, Country, Zip Details Code, Phone, Hire Date, Marital Status, Guardians Name Suppliers Company Name, Contact Name, Contact Title, Address, City, Region, Country, Zip Code, Phone Shippers Company Name, Contact Name, Phone Orders Shipping Date, Sales Person, Customer, Ship Name, Ship to Address, Tax, Freight Order Details Date, Order ID, Product ID, Product Name, Unit Price, Quantity, Discount Category Category Name, Category ID, Description Step 3: Convert the entities into tables After deciding what you need to store, convert all the entities into tables and the BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna Page 18 of 33

attributes into fields. Specify the data type and size for all the fields. For example, the Name field will store the character data, so the data type for the Name field should be Text. To specify the size, estimate the number of characters the field might store. For example, a name cannot be more than 50 characters, so the size of the Name field can be 50. Similarly, specify the field type and size for all the fields in the table:

Graphic Description: File Name: MC1400_W1_L4_S3_G2.gif Field Data Type Size Company Name Text 40 Contact Name Text 50 Contact Title Text 30 Address Text 50 City Text 15 State Text 25 Country Text 15 Zip Code Number 10 Phone Number 24 Lets discuss the next step in designing a database, defining keys. Please proceed to the next page.

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 19 of 33

Course: Database Applications Lesson: Week 1, Lecture 4 Topic: Fair Employment Laws Fair Employment Laws Step 4: Identify key fields. After creating the tables, you can express the relationship between the tables in a database by using keys. Keys are the fields that uniquely identify a record in a table. There are three types of keys: Primary Key: A unique identifier that is common to two or more tables in a database. This key can be used to identify the related records in different tables. For example, Product ID can be used as a primary key for the Product table, which can uniquely identify the product stored in the table. Composite Key: A combination of more than one primary key. For example, in the Order Detail table, Order ID and Product ID are the composite keys. To identify an order for a customer, you should refer to both these fields because the same customer can purchase many products and generate many orders. The name of a composite key field can be modified. Foreign Key: A copy of the primary key from another relational table that is included in a table to relate the two tables with each other. For example, to relate a client with an order, the Client ID, which is the primary key of the Client table, needs to be added to the Order Detail table to associate an order with a client. We know that key fields can uniquely identify a row in a table. In a scenario where it is difficult to find a unique field, you can assign a unique identifier to the tables, which can uniquely identify the rows in a table. For example, the key fields of the tables in the EFT database are: Suppliers table Supplier ID Primary Category table Category ID Product table Product ID Order Detail table Order ID Sales Employee table Sales Employee ID Employee Details table Employee ID Order table Order ID Customer table Customer ID Please proceed to the next page.

Graphic Description: Types of Keys Product Product ID Product Name Description Supplier Client Client ID Company Name First Name Last Name Order Detail Order ID Product ID Client ID Page 20 of 33

Key

Composite Key Foreign Key


BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Price

Course: Database Applications Lesson: Week 1, Lecture 4 Topic: Designing a Database Designing a Database (5 of 6)

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 21 of 33

Step 5: Determine relationships among tables. All the tables in an RDBMS are related to each other. There can be three types of relationships between database tables. These relationships are: One-to-one: Represents that for a table A, there is only one corresponding row in table B. For example, consider the Sales Employee and Sales Employee Detail tables we discussed earlier. The Sales Employee table stores data such as employee name, designation, work assigned, and targets, and the Sales Employee Detail table stores the personal details of sales employees, such as address, city, sate, country, and zip code. Therefore, for an employee Anna, there can be only one row in the Sales Employee Detail table, which would contain her personal details. One-to-many: Represents that for a table A, there can be many corresponding rows in table B. For example, consider a relationship between the Category and Product tables. Each category can contain more than one product. Many-to-many: Represents that for a table A, there can be many corresponding rows in table B, and for a table B, there can be many corresponding rows in table A. For example, consider a relationship between the Product and Order tables. For a specific product, there can be many orders and each order can be for many products. Graphic Description: File Name: MC1400_W1_L4_S5_G1.gif Caption: Types of Relationships Sales_Employee EmployeeID LastName FirstName Designation Work Assigned Employee_Detail EmployeeID Address City Region ZipCode

One-to-one

One-to-many

Categories CategoryID CategoryName Description Picture Products ProductID ProductName SupplierID CategoryID BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna Page 22 of 33

Orders OrderID CustomerID EmployeeID OrderDate Products ProductID ProductName SupplierID Order Details OrderID ProductID UnitPrice Quantity

Many-to-many

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 23 of 33

Please proceed to the next page.

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 24 of 33

Course: Database Applications Lesson: Week 1, Lecture 4 Topic: Designing a Database Designing a Database (6 of 6) To determine the relationship between tables, answer questions that enable you to find how a table is related to another table. For example, answer questions such as: Is Customer related to Order? (Yes) How? One customer record points to one or many orders? One customer record points to many orders because one customer can generate many orders. Therefore, the relationship between the Customer and Order tables is one-to-many. Ask reverse questions such as: One order row links with one or many customers? One order row links with one customer, so that an order can be uniquely identified. Therefore, the reverse relationship between the Customer and Order tables is one-to-many. Similarly, you can answer the following questions to determine relationships: Graphic Description: Flash file File name: MC1400_W1_L4_S6_G1.swf

1. Is customer related to any other table in the list?


Yes, it is related to the Order, Product, and Supplier tables.

2. Is the Sales Employee table related to the Order table?


Yes, because the sales employee takes the order from the customers. 3. How many orders does a sales employee write? A sales employee writes many orders to store all the sales. 4. How many sales employees write an order? One, because one order can be written by one sales employee only. Therefore, the relationship between the Sales Employee and Order tables is one-to-many.

5. Is the Product table related to the Order table?


Yes, because a customer orders products and therefore, generates an order. 6. How many orders can a product create one or many? Many, because many customers can buy the same product. 7. Can an order be linked to one or many products? BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 25 of 33

Many, because an order can contain more than one product that a customer purchases. Therefore, the relationship between the Product and Order tables is many-to-many. Please proceed to the next page.

Course: Database Applications Lesson: Week 1, Lecture 5 Topic: Introducing the Access GUI Introducing the Access GUI BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 26 of 33

Identifying the Components of the Access GUI Before you start creating a database, it is important that you be familiar with the Access user interface. To open the Access database, click Start ->Programs -> Microsoft Office -> Microsoft Office Access 2003. The Access window appears, displaying a task pane. It provides commonly used links that help you open and create new files and search Office-related topics on the Microsoft Web site. You can use the task pane to create a new database and then close it. All database objects such as tables, reports, forms, and queries are stored in a database. Therefore, before creating any of these objects, you need to create a database. Please proceed to the next page. Graphic Description: Interactive graphic, with rollovers. Opens in a pop window. File Name: MC1400_W1_L5_S1_G1.swf Title Bar: Displays the title of the application, in this case Microsoft Access. It is the top bar in the Access window. The icon on the left of the tile bar is the Control-menu. It displays a menu from where you can Maximize, Minimize, or Close the Access window. The button on the right of the task bar is the Close button. Clicking on it closes the Access window. Menu Bar: Displays all the menus, such as File, Edit, View, Insert, Tools, Window, and Help. It is displayed right below the title bar. Each menu represents a menu of commands. Toolbar: Displays icons for the menu items. This is displayed below the menu bar. The toolbar allows you to perform a task more quickly. Taskbar: Displays the active windows and the Start button right at the bottom of the screen. Status Bar: Displays the information about the tasks. In Figure 1 it shows Ready, this means that Access is ready to accept commands. Task Pane: Displays commonly used links and commands that allow you to open files, create new files, or search Office-related topics on the Microsoft Web site. It is displayed on the right side of the screen at the startup.

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 27 of 33

Course: Database Applications Lesson: Week 1, Lecture 6 Topic: Creating a Database Creating a Database You can create a database in two ways:

Using the Menu option Using the Database Wizard

Creating a Database Using the Menu Option

To create a database using the Menu option, perform the following steps:

1. Click File on the menu bar and select New. A New File task pane
appears to the right in the screen.

2. Go to the New section of the task pane and click Blank


Database. A File New Database dialog box appears.

Graphic Description: Similar steps with screenshots appear in the simulations as on the main page. Graphic name: MC1400_W1_L6_S1_G1.html

3. Specify a name for the database file and click the Create button
to create the database. The Access window reappears and shows a Database window where you can start the process of creating the database objects. The Database Wizard enables you to use a template for your database. For example, you can create a database to track inventory by using the Inventory Control template. Similarly, you can use the Resource Scheduling template to manage information related to resources, customers, and schedules. These templates save time because they provide predefined tables with fields and data types. Please proceed to the next page.

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 28 of 33

Course: Database Applications Lesson: Week 1, Lecture 7 Topic: Creating Tables Creating Tables (1 of 3) Data needs to be stored in tables. You need to first create tables in order to create other database objects. Creating Tables You can create tables in Access by: Using the Design view Using a wizard By entering data Creating Tables Using the Design View

Creating Tables Using the Design View You use the Design view to create and modify the structure of a table. This method is used when a table contains many fields with different data types. To create a table using this view, you need to identify: The names of the table and the fields The data type for each field The description of the fields to specify the content of each field The primary key of the table Graphic Description: Similar steps with screenshots appear in the simulations as on the main page. Graphic name: MC1400_W1_L7_S1_G1.html

To create a table using this view, you need to: 1. Click Tables under Objects and select Create table in Design view. The Design view window appears. 2. Enter the field names in the Field Name column. 3. Enter the data type for each field in the Data Type column. 4. Enter the description of the fields to specify the content of each field in the Description column. This is an optional entry. 5. Click the Primary Key icon on the tool bar to create the primary key. Primary key is a mandatory field, which must contain a value. If you do not enter data for a field, Access will prompt you to enter a value. 6. Go to the File menu and click Save after entering all the fields of the tables. The Save As dialog box appears. 7. Enter the table name in the Save As dialog box and click OK to create the table. Please proceed to the next page.

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 29 of 33

Lesson: Week 1, Lecture 7 Topic: Creating Tables Creating Tables (2 of 3) Creating Tables Using the Table Wizard The simplest way of creating a database table is to use a table wizard. In Access and other Microsoft applications, a wizard is a tool that guides you through the process of performing a task in a step-by-step manner. To create a table using a table wizard, you need to: 1. Open the database and double-click the Create table by using wizard option. A dialog box called Table Wizard appears, which helps you choose the type of information and fields you want to include in the database table. 2. Click the Business option to create a Business database. 3. Select a sample table from the Sample Tables list box and then select the fields. To create the Customers table, select the Customers option from the Sample Tables list box. 4. Pick the fields to be included from the Sample Fields list box. For instance, if the sample table is for customers, the fields available include CustomerID, CompanyName, and ContactFirstName. The fields that you choose will appear in the Fields in my new table box. 5. Click the Rename Field... button to change the name of the sample field. 6. Click Next and another page of the wizard opens. This page enables you to name the table. You can select the Yes, set a primary key for me option. to set a primary key for the table. 7. Click the Enter data directly into the table. option. 8. Click Finish. A window containing the table you created appears. The sample fields you selected also appear selected in the window. 9. Add the required data in the appropriate cells. Please proceed to the next page. Graphic Description: Similar steps with screenshots appear in the simulations as on the main page. Graphic name: MC1400_W1_L7_S2_G1.html Creating Tables Using the Table Wizard

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 30 of 33

Course: Database Applications Lesson: Week 1, Lecture 7 Topic: Creating Tables Creating Tables (3 of 3) Creating Tables by Entering Data 1. Open the database and double-click the Create table by entering data option. A Table1 window appears where you can add data in the cells. 2. Click the cell and type the required data. 3. Click the Close Window button of the table, which is a cross in the upper-right corner of the window. A Save As dialog box appears where you can enter the name of the table. Click the OK button to save the data. Please proceed to the next page. Graphic Description: Similar steps with screenshots appear in the simulations as on the main page. Graphic name: MC1400_W1_L7_S3_G1.html Creating Tables by Entering Data

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 31 of 33

Course: Database Applications Lesson: Week 1, Lecture 8 Topic: Modifying Tables Modifying Tables Editing Tables One of the most important aspects of modifying a table is that, sometimes, data in table cells, rows, and fields needs to be changed. For instance, if theres a new contact person of a supplier, you need to modify the data in the Supplier table. To change or edit data in tables: 1. Double-click the Suppliers table in the ExcellentFoodTraders : Database window to open the database. 2. Click the field in which the data has to be changed. In this case, the Contact Name field needs to be clicked. 3. Delete the existing data by using the Delete or Backspace key on the keyboard and then type in the new data. 4. Repeat steps 2 and 3 to edit data, if there is more than one record to be modified. 5. Click Save from the File menu to save the table. Deleting a Record Another common change that needs to be made to existing tables is deleting redundant records. The steps to delete a record are: 1. Point the cursor to the extreme left of the row you want to delete. The left margin of the row is also known as the Row Selector. 2. Wait for a right arrow to appear and then click to select the row. 3. Right-click to open a shortcut menu. 4. Click the Delete Record command on the shortcut menu. This deletes the selected row. Please proceed to the next page. Graphic Description: Similar steps with screenshots appear in the simulations as on the main page. Graphic name: MC1400_W1_L8_S1_G1.html

Editing Data

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 32 of 33

Course: Database Applications Lesson: Week 1, Lecture 9 Topic: Summary Summary This week introduced you to DBMS in Access. You learned about the purpose of using database applications. You were introduced to two main types of DBMS a flat file system and an RDBMS and the advantages of an RDBMS over a flat file system. This week also discussed the importance of creating a design before creating a database. This week introduced you to Access and its features and to the method of opening and creating an Access database. Finally, the steps to create and modify tables and edit records in a database were explained. The next week will explore Access in more detail. Please go to the Assignments of this week's lectures.

BMC_MC1400_Lecture.doc SME: Minakshi Mathur, ID: Shirin Bhasin, Editor: Prasanna

Page 33 of 33

You might also like