We think you have liked this presentation. If you wish to download it, please recommend it to your friends in any social system. Share buttons are a little bit lower. Thank you!
Presentation is loading. Please wait.
Published byErick Cubit
Modified over 2 years ago
Designing a Database An Introduction for beginning VB Developers Copyright ©2003, Tore Bostrup
6/23/2003Copyright ©2003, Tore Bostrup2 What is a Database There are different types of databases –Relational Databases –Object Databases –Hierarchical Databases –Network Databases –Etc. But usually, we talk about Relational Databases
6/23/2003Copyright ©2003, Tore Bostrup3 What is a Relational Database A Relational Database is briefly described as a collection of Tables Each Table is made up of Rows of data that is organized in Columns –Think of an Excel Spreadsheet where the first row contains the column names, only the columns that are named are used, and each column only contains one type of data.
6/23/2003Copyright ©2003, Tore Bostrup4 What makes it Relational Relational comes from the way that different tables relate to each other. –A column that exists in two tables can be used to relate the two tables by storing the same value in both tables:
6/23/2003Copyright ©2003, Tore Bostrup5 Relationship between two Tables OrderIDCustID(Info) 3001101… 3002126… CustIDCust Name Cust Addr 1B&H… 101PPCC… 126ACME Comp …
6/23/2003Copyright ©2003, Tore Bostrup6 Relationship Types One-to-One –This is not very common, and mostly used for optimization. Usually, only one table is needed. One-to-Many –This is the most common relationship. For instance a Customer may have MANY Orders, but each Order is only for ONE Customer. Many-to-Many –Also relatively common. For example, an Order may contain MANY Products, and a Product may be part of MANY Orders.
6/23/2003Copyright ©2003, Tore Bostrup7 Some Other Concepts Primary Key –A Primary Key is one or more columns that together are sufficient to identify a single row in a table. –It is Unique within the table –It always has a value
6/23/2003Copyright ©2003, Tore Bostrup8 Some Other Concepts Foreign Key –A Foreign Key is a column in a table that contains a copy of a value from another table in order to establish a relationship to that table. –The Foreign Key usually refers to the Primary Key in the other table (to make sure it only points to one row).
6/23/2003Copyright ©2003, Tore Bostrup9 Designing the Database We often design the database using Diagrams called Entity-Relationship or ER Diagrams. Tables are shown as boxes, and Relationships are shown as lines. Orders Customers Products Customers place Orders Orders contain Products
6/23/2003Copyright ©2003, Tore Bostrup10 What Tables Do I Need? Step 1: –What kinds of Things are you keeping information about? For starters, each kind of thing tends to be a Table: –In an order system, wed probably at least keep information about Orders and Customers. –We may also want a catalog of Products that can be ordered
6/23/2003Copyright ©2003, Tore Bostrup11 What Tables Do I Need Step 2: –Determine the data items that you need for each kind of thing, watch out for information that can be repeated Multi-valued columns should be avoided Repeated columns should be avoided No horizontal repetitions should be included Vertical repetitions (multiple rows with same value in a column) should only represent a relationship to another table.
6/23/2003Copyright ©2003, Tore Bostrup12 Repeated Values A value is considered repeated only if it represents the same measurement. The fact that two people are the same height does not mean that the data is repeated in this sense. A repeated value that is part of the Primary Key is allowed if the Primary Key consists of multiple columns.
6/23/2003Copyright ©2003, Tore Bostrup13 Repeated Values Examples of repeated values: OrderNoLine1ItemLine1QtyLine1PriceLine2ItemLine2QtyLine2Price 245PN7681$35PN6563$15 OrderNoItemNoCustomerItemQtyPrice 2451SteelCoPN7681$35 2452SteelCoPN6563$15 2461Acme CorpPN3711$2.99 2462Acme CorpPN0157$5
6/23/2003Copyright ©2003, Tore Bostrup14 What Tables Do I Need Step 3: –Once you have completed defining your kinds of things and fixed any repeating data for those things, draw your relationships. Step 4: –Resolve Many-to-Many relationships (we will get back to this).
6/23/2003Copyright ©2003, Tore Bostrup15 The Relationships Draw the tables Draw the Relationships Define the Relationship Types CustomersOrders CustomersOrdersProducts CustomersOrdersProducts 1NNM
6/23/2003Copyright ©2003, Tore Bostrup16 The Many-to-Many Relationship Consider the Products table – the products that can be ordered. Assume it is simply a catalog with a list of the products available. –Each Order may contain MANY Products, and each Product can be a part of MANY Orders. –But how do we represent this?
6/23/2003Copyright ©2003, Tore Bostrup17 Representing Many-to-Many Remember, a Relationship is defined by keeping a copy of the value of a column from the other table, usually that other tables Primary Key. –So each row in a table can only reference a single row in the related table –And we arent supposed to repeat the data so we shouldnt have multiple rows for the same item.
6/23/2003Copyright ©2003, Tore Bostrup18 OOPS – We Need Another Table The solution is really pretty simple (as long as you know what to do): –Introduce an intermediate table between Orders and Products. –Relate it as Many-to-One to EACH of the two tables (Orders & Products) –This table only needs the Primary Key from the two tables, and their combinations become the representation of a Many-to-Many relationship between Orders and Products
6/23/2003Copyright ©2003, Tore Bostrup19 The Magic Intermediary Table And voila – we have a Many-to-Many relationship between the Orders and the Products table. –It is common to name the table with the name of both of the tables it connects. But in an order system, you will typically see this table named OrderDetail. And it will typically contain additional data such as UnitPrice and Quantity. Orders OrderID CustomerID Other… Products ProductID ProductName Other… ProductOrders OrderID ProductID 1 MN1
6/23/2003Copyright ©2003, Tore Bostrup20 Microsoft Access MS Access actually has many different personalities: –A Database Manager –A Database Design Tool –An Application Development Tool (like VB6) –An ad hoc Query Designer –A Report Designer –…
6/23/2003Copyright ©2003, Tore Bostrup21 Our Main Interests As VB6 Developers, our main interests in MS Access are –As a Database Design Tool –As a Database Manager for small database applications – typically for a departmental, workgroup or single user application.
6/23/2003Copyright ©2003, Tore Bostrup22 Getting Started with Access The Database Wizard lets you create a starter database AND application (developed in the MS Access Application Development Environment) without any prior knowledge. This can be good – it gives you a head start on your design if one of the databases are appropriate for your needs.
6/23/2003Copyright ©2003, Tore Bostrup23 Getting Started The Wizards also can keep you from learning how to design your own database, and you may decide to use the Access Development Environment. –The development environment is easy to use for simple and standard things, but it gets difficult to make it do things the way you want it to (you cant quite get control over it). –PS: That is MY opinion…
6/23/2003Copyright ©2003, Tore Bostrup24 MS Access Database Wizards Access contains several database Wizards: Asset Tracking Contact Management Event Management Expenses Inventory Control Ledger Order Entry Resource Scheduling Service Call Management Time and Billing
6/23/2003Copyright ©2003, Tore Bostrup25 To use the Database Wizard Open MS Access –Specify Access database wizards, pages, and projects and Click OK –Select the Databases tab –Select the database type you want and click OK –Give it a file name and click Create –Click on Next –Additional screens let you select which tables and what data elements you want in the database.
6/23/2003Copyright ©2003, Tore Bostrup26 The MS Access Order Entry DB
6/23/2003Copyright ©2003, Tore Bostrup27 Creating a Table in MS Access Open an existing database, or create a blank Database. You have three choices –Create table in Design view –Create table by using wizard –Create table by entering data
6/23/2003Copyright ©2003, Tore Bostrup28 Create table by entering data This allows you to simply start entering data as if you were typing into an Excel spreadsheet. However: –No column names are defined (they will be called Field1, Field2, etc.) –Access makes a guess as to their data type based on the data entered.
6/23/2003Copyright ©2003, Tore Bostrup29 Create table by using wizard Starting in the middle, this is similar to the Database Wizard, but it only applies to a single table – and doesnt create any application code. –Think of it as creating a new table from predefined table templates.
6/23/2003Copyright ©2003, Tore Bostrup30 Create table in Design view The Table Designer lets you define the column names, their data types, and other information about the columns.
6/23/2003Copyright ©2003, Tore Bostrup31 If You Only have VB6 Ever since VB3 or 4, VB has included a sample application called VISBAS. –In VB6, this application is on the MSDN Library CD, in the Samples\VB98\visbas folder. –An executable VISBAS.EXE is installed in the same folder as VB6, and available under the VB6 menu Add-Ins > Visual Data Manager –The executable is fine for Access 97 databases, but not for Access 2000 databases.
6/23/2003Copyright ©2003, Tore Bostrup32 Making VISBAS Work If you need to work with Access 2000 (or newer) databases, you need to recompile it with reference to Microsoft DAO 3.6 Object Library –Copy the visbas folder to you HD –Remove the Read Only setting from the visbas folder and the files in it. –Open visbas.vbp
6/23/2003Copyright ©2003, Tore Bostrup33 VISBAS for Access 2000 Contd… –Select menu Project > References… –Unselect Microsoft DAO 3.5 Object Library –Select Microsoft DAO 3.6 Object Library –Move the new reference up above the Microsoft ActiveX Data Objects 2.5 Library (and possibly above the Microsoft Visual Basic 6.0 Extensibility) –OK, Save Project, and Make Visdata.EXE…
6/23/2003Copyright ©2003, Tore Bostrup34 Using VISBAS Either run VISBAS.EXE or in the VB IDE, select Add-Ins > Visual Data Manager… –Create a New Database: Select File > New… > Microsoft Access > Version 7.0 MDB… and give the new database a name. –Open an Existing Database: File > Open Database… > Microsoft Access… –In either case, you will get two windows – a Database Window and a SQL Statement window.
6/23/2003Copyright ©2003, Tore Bostrup35 Create a Table using VISBAS Right-Click in the Database Window Select New Table –Type in the table name in the dialog box –Click the Add Field button Type in the (Column) Name Select the (data) type and size (length) of the column, and select other settings as appropriate The OrdinalPosition, ValidationText, ValidationRule, and DefaultValue are optional
6/23/2003Copyright ©2003, Tore Bostrup36 Create a Table using VISBAS Click OK for each field that you add Click Close when you dont want to add any more fields (columns) to the table You can also add Indexes. It is always good to have at least a Primary Key defined. When you are done, click Build the Table.
INTRODUCTION TO ACCESS. OBJECTIVES Define the terms field, record, table, relational database, primary key, and foreign key Create a blank database.
Create Database Tables Lesson 2. Objectives Software Orientation The New tab in the Backstage view, shown below, provides options for creating a database.
MS Access 2003 Tutorial By: Juan GUANTENG!!! Y7. Step 1 Launch the Microsoft Access 2003 program. This can be done by clicking an icon on the desktop.
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali1.
Microsoft ® Access ® 2010 Training Create tables for a new database.
COMPREHENSIVE Access Tutorial 1 Creating a Database.
1 Chapter 17 Creating a Database. Practical Computer Literacy, 2 nd edition Chapter 17 2 What’s Inside and on the CD? In this chapter, you will be introduced.
Copyright © 2014 Pearson Canada Inc. Ext. 5b-1 Copyright © 2014 Pearson Canada Inc. Application Extension 5b Using Microsoft Access Part 2: Using Information.
FIRST COURSE Access Tutorial 1 Creating a Database.
© 2014 by McGraw-Hill Education. This is proprietary material solely for authorized instructor use. Not authorized for sale or distribution in any manner.
Access Module Implementing a Database with Microsoft Access A Great Module on Your CD.
XP New Perspectives on Microsoft Access 2002 Tutorial 1 1 Microsoft Access 2002 Tutorial 1 – Introduction To Microsoft Access 2002.
Course Contents Overview: Database basics Lesson 1: Benefits of using a database Lesson 2: Table that data Lesson 3: Analyzing, viewing, and reporting.
® Microsoft Access 2010 Tutorial 1 Creating a Database.
Tutorial 1 Creating a Database. Objectives Learn basic database concepts and terms Learn basic database concepts and terms Explore the Microsoft Access.
MS Access 2007 Management Information Systems 1. Overview 2 What is MS Access? Access Terminology Access Window Database Window Create New Database.
BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft.
Key Applications Module Lesson 21 — Access Essentials Computer Literacy BASICS.
® Microsoft Office 2013 Access Creating a Database.
DATA, DATABASES, AND QUERIES Managing Data in Relational Databases CS1100Microsoft Access - Introduction1 Created By Martin Schedlbauer
DATA, DATABASES, AND QUERIES Managing Data in Relational Databases CS1100Microsoft Access - Introduction1.
Database Systems Microsoft Access Practical #1 Creating Tables Nos 215.
Lecture Note 9: Introduction to the MS Access. Brief overview of Relational Databases and Database Applications The first databases implemented during.
MBAC 611. Click on the My Computer Icon Open your private network directory Create a new folder named lab7 Copy your lab6 Access file to the lab7.
1 Database Design and Development: A Visual Approach © 2006 Prentice Hall Chapter 8 DATABASE DESIGN AND DEVELOPMENT: A VISUAL APPROACH Chapter 8 Creating.
CS1100: Microsoft Access Managing Data in Relational Databases Created By Martin Schedlbauer CS11001Microsoft Access - Introduction.
Management Information Systems MS Access MS Access is an application software that facilitates us to create Database Management Systems (DBMS)
Office Management Tools II Ms Saima Gul. Office Management Tools II Ms Saima Gul.
McGraw-Hill/Irwin © The McGraw-Hill Companies, All Rights Reserved TECHNOLOGY PLUG-IN T6 Basic Skills Using Access.
MS Access Tour Sesión # 6. MS Access Tour Database Management System (DBMS): An application software that allows users to create, manipulate, and change.
Data-mining & Data As we used Excel that has capability to analyze data to find important information, the data-mining helps us to extract information.
BA271 Week 6 Lecture Database Overview Dave Sullivan.
1 Lesson 22 Getting Started with Access Essentials Computer Literacy BASICS: A Comprehensive Guide to IC 3, 3 rd Edition Morrison / Wells.
Microsoft Access A Hands-On Introduction Chapter 4.
Planning & Creating a Database By Ms. Naira Microsoft Access.
Intro to Access 2007 Lindsey Brewer CSSCR September 18, 2009.
Microsoft Access 2007 Microsoft Access 2007 Introduction to Database Programs.
XP New Perspectives on Introducing Microsoft Office XP Tutorial 1 1 Introducing Microsoft Office XP Tutorial 1.
CSCI 3327 Visual Basic Chapter 13: Databases and LINQ UTPA – Fall 2011.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Plug-In T6: Basic Skills and Tools Using Access 2010 Business Driven Technology.
Microsoft ® Office Excel 2003 Training Using XML in Excel SynAppSys Educational Services presents:
1 Lesson 17 Getting Started with Access Essentials Computer Literacy BASICS: A Comprehensive Guide to IC 3, 3 rd Edition Morrison / Wells.
Microsoft Access 2013 ®® Case Study Creating a Database.
Build a database V: Create forms for a new Access database Overview: A window into your data So far in this series of courses, you’ve built tables, relationships,
Microsoft Access 2013 Chapter 1 Databases and Database Objects: An Introduction.
Advanced Forms Lesson 10. Objectives Software Orientation The Application Parts button in the Templates group and the Navigation and More Forms buttons.
CSC 240 (Blum)1 Introduction to Access CSC 240 (Blum)2 Click on the Access desktop icon or go to Start/All Programs/Microsoft Office/Microsoft Office.
Introduction to Microsoft Access
© 2017 SlidePlayer.com Inc. All rights reserved.