ie 423 – design of decision support systems database development – building tables

26
IE 423 – Design of Decision Support Systems Database development – Building Tables http://crimethinc.com/blog/wp-content/uploads/ 2007/02/table5big.jpg

Upload: hilary-lewis

Post on 04-Jan-2016

222 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: IE 423 – Design of Decision Support Systems Database development – Building Tables

IE 423 – Design of Decision Support Systems

Database development – Building Tables

http://crimethinc.com/blog/wp-content/uploads/2007/02/table5big.jpg

Page 2: IE 423 – Design of Decision Support Systems Database development – Building Tables

Important Dates to Remember

St. Patrick’s Day – March 17th

Page 3: IE 423 – Design of Decision Support Systems Database development – Building Tables

By now you should have

Read Chapters 1,2,3, 4, 5 and 6 in Pol and AhujaAlso, read chapter 7 in Pol and Ahuja

Page 4: IE 423 – Design of Decision Support Systems Database development – Building Tables

DataBase Development

We are going to skip an important topic Normalization

…but, will get to this topic very soon

Page 5: IE 423 – Design of Decision Support Systems Database development – Building Tables

DataBase Development

Remember that our earlier modeling efforts resulted in the creation of schemasIn our modeling we defined entities, relations and relationshipsIn DB development we are interested in Defining the entities = Tables …and their attributes = fields …and the relationships among tables Later we will add data to create instances =

records

Page 6: IE 423 – Design of Decision Support Systems Database development – Building Tables

DataBase Development

In its native form a table is a data grid with – Columns (fields) Rows (records) Fields have properties Records represent instances of the

entity

Page 7: IE 423 – Design of Decision Support Systems Database development – Building Tables

DataBase Development

Start Access Either open

an existing DB, or…

Create a new DB

Page 8: IE 423 – Design of Decision Support Systems Database development – Building Tables

DataBase DevelopmentCreate a new DB Select Blank

database Then define the

name and location for the DB file

Page 9: IE 423 – Design of Decision Support Systems Database development – Building Tables

DataBase Development

Four ways to create a table Create a table in Datasheet view Create a table in Design view Create a table with the Table Wizard Create a table while importing

external data

Page 10: IE 423 – Design of Decision Support Systems Database development – Building Tables

DataBase Development

Create a table in Datasheet view

Page 11: IE 423 – Design of Decision Support Systems Database development – Building Tables

DataBase DevelopmentCreate a new DB Next you should

see something like this….

Make the Table Object is selected, then

Select Create table by entering data

Page 12: IE 423 – Design of Decision Support Systems Database development – Building Tables

DataBase Development

Create a table in Datasheet view

Enter the field names at the top of the columns

Click close (X) when finished defining the fields

You will asked if you want to save the table definition…

If you click yes you will be prompted for a name for the table

Page 13: IE 423 – Design of Decision Support Systems Database development – Building Tables

DataBase Development

Create a table in Datasheet view

… you will also be told that the table has no primary key,…

And you will be asked if you want Access to create one for you

This is important – but click No for

now

Page 14: IE 423 – Design of Decision Support Systems Database development – Building Tables

DataBase Development

Create a table in Datasheet view Note: we

have a new Table object (People)

Page 15: IE 423 – Design of Decision Support Systems Database development – Building Tables

DataBase Development

Create a table in Design view Creating a table in datasheet view is

easy, but… It leaves a lot not done For example, each field has a set of

properties, and we have not defined them

Page 16: IE 423 – Design of Decision Support Systems Database development – Building Tables

DataBase DevelopmentCreate a table in Design view Lets create a table

to store data about houses

Click create table in Design view

…and you will see something like this

Page 17: IE 423 – Design of Decision Support Systems Database development – Building Tables

DataBase DevelopmentCreate a table in Design view Note our field

definition panel (top) needs three things – Field Name Data Type Field

Description

Page 18: IE 423 – Design of Decision Support Systems Database development – Building Tables

DataBase DevelopmentCreate a table in Design view

Naming rules Max 64 Characters long Any combination of Letters,numbers spaces, except

Control characters (ASCII 0-31) Period(.), Exclamation Point (!), Grave (`), Brackets ([]) Leading spaces Quote marks

Remember CamelBack notation

Leszynski Naming conventions ( from:http://www.acc-technology.com/namconv.htm )

Tables tblXxxxXxxx Queries qryXxxxXxxx Forms frmXxxxXxxx Reports rptXxxxXxxx Macros mcrXxxxXxxx Modules basXxxxXxxx

Page 19: IE 423 – Design of Decision Support Systems Database development – Building Tables

DataBase DevelopmentCreate a table in Design view Field Types

Text – max 255 characters (default) Number – storing numeric data – several

specific numeric types (field size*) – 1,2,4,or 8 max 16 bytes

Long Integer(4), Integer(2), Byte(1), Single(4), Double(8), ….

Autonumber – automatically adds a unique number to record

Incremental Random

Page 20: IE 423 – Design of Decision Support Systems Database development – Building Tables

DataBase DevelopmentCreate a table in Design view Field Types

Date/Time – to store date and time values Memo – similar to Text except allows very

long lengths (65,535 max) Yes/No – Boolean values Currency – values represent money OLE object Hyperlink – Internet address Lookup Wizard – we’ll come back to this

Page 21: IE 423 – Design of Decision Support Systems Database development – Building Tables

DataBase Development

Create a table in Design view So, let’s build a table for Houses By the way, try to make it a good design! ? House Survey

House ID Number:_______ Address Number:_______________ Apt. Number:___________________________ Street Name:________________________District:_____________________________ City:____________________________ State: _____ ZipCode:___________________ House Type:________________________ Approximate Sqft:_________________ Number of Rooms:___________________ Number of Bedrooms:_______________ Number of Baths:____________________ Yard in Sqft:_________________ Garage: Yes:___ No:___ Basement: Yes:__ No:___ Number of Floors:________

Page 22: IE 423 – Design of Decision Support Systems Database development – Building Tables

DataBase Development

And don’t forget – Define the table’s Primary Key

Page 23: IE 423 – Design of Decision Support Systems Database development – Building Tables

DataBase DevelopmentMS Access Table Limits

Property LimitDB Size 2 Gigabytes

Table name length 64 characters

Field name length 64 characters

Fields in a table 255

Table size 2 Gigabytes

Characters in a record 4000

Characters in Field description

255

Characters in Text field 255

Characters in memo field 65,535

Page 24: IE 423 – Design of Decision Support Systems Database development – Building Tables

DataBase DevelopmentMS Access Reference Card

From http://www.wcu.edu/it/edtech/handouts/access_2003_quick_refere

nce.pdf

Page 25: IE 423 – Design of Decision Support Systems Database development – Building Tables

DataBase DevelopmentMS Acess Help and Tutorial from Microsoft

http://office.microsoft.com/en-us/access/CH062526191033.aspx

Page 26: IE 423 – Design of Decision Support Systems Database development – Building Tables