Computer Science & Engineering 2111

14
Computer Science & Engineering 2111 Introduction to Database Systems 1 CSE 2111 Introduction to Database Systems

description

Computer Science & Engineering 2111. Introduction to Database Systems. Database Terms. Data A collection of numbers and text 273459368 Information Meaning derived from the data SSN: 273-45-9368. What is a database?. A large collection of data stored in a well-defined structure - PowerPoint PPT Presentation

Transcript of Computer Science & Engineering 2111

Page 1: Computer Science & Engineering 2111

1

Computer Science & Engineering 2111

Computer Science & Engineering 2111

Introduction to Database Systems

CSE 2111 Introduction to Database Systems

Page 2: Computer Science & Engineering 2111

2

Database Terms

– Data• A collection of numbers and text

– 273459368

– Information• Meaning derived from the data

– SSN: 273-45-9368

CSE 2111 Introduction to Database Systems

Page 3: Computer Science & Engineering 2111

3

What is a database?• A large collection of data stored in a well-defined structure

– You can think of a database as• An electronic filing system• A repository for large amounts of information

– Example of a paper database• Telephone book

• Examples of computer databases– Ohio State stores student information in a database– Insurance companies store policy holder information in a

database– Your employer stores your information in a database

CSE 2111 Introduction to Database Systems

Page 4: Computer Science & Engineering 2111

4

Database Software• How do I create a database?– Purchase the software

• We will use MS Access 2010, but there are many database software products– Oracle– Sybase– SQL Server

• How do I access information in the database?– Purchase a Database Management System (DBMS)

• A DBMS is a collection of programs that enable you to enter, organize, and select data in a database.– We will use MS Access 2010, but there are many database

management software products

CSE 2111 Introduction to Database Systems

Page 5: Computer Science & Engineering 2111

5

• The design should be initially created schematically, and then the database should be created using the chosen database software

Steps when setting up a Database

CSE 2111 Introduction to Database Systems

Page 6: Computer Science & Engineering 2111

6

1. Decide what information you will store in the database

Research Papers databaseFirst Name Charge Amount

Last Name Charge Date

Address Payment Amount

City Payment Type

State Payment Date

Zip Code

Home Phone

This database is a very simplistic one. Most databases you create will be much more complex.

CSE 2111 Introduction to Database Systems

Page 7: Computer Science & Engineering 2111

7

2. Create the layout of the database

• What tables do you need in your database?

• What is a table?– An entity used to organize information by categories of like

information

CSE 2111 Introduction to Database Systems

Page 8: Computer Science & Engineering 2111

8

Research Papers Database Tables

CSE 2111 Introduction to Database Systems

• ClientStores client information

• ChargesStores client charges information

• PaymentsStores client payment information

• PaymentMethodStores the payment method

Credit CardCashCheck

Page 9: Computer Science & Engineering 2111

9

2. Create the layout of the database

• What fields do you need in your database?• What is a field?– An attribute (piece of information) of the table/entity.

• How will you set them up?– Divide Tables into Inseparable Fields•Address as 1 field – • 17 Main St. New York, New York 10002

•Address as 4 fields• Street Address - 17 Main St. • City - New York• State - New York • Zip code – 10002

CSE 2111 Introduction to Database Systems

Page 10: Computer Science & Engineering 2111

10

Research Papers DatabaseTable Name: Client

Fields: Client ID

First Name

Last Name

Address

City

State

Zip Code

Home Phone

Table Name: Charges

Fields: Client ID

Charge Amount

Charge Date

Table Name: Payments

Fields: Client ID

Payment Amount

Payment Type

Payment Date

Table Name: PaymentMethod

Fields: MethodID

MethodType

CSE 2111 Introduction to Database Systems

Page 11: Computer Science & Engineering 2111

11

2. Create the layout of the database

• Fields contain field types/data types and field properties• What is a field Type/Data Type?– Defines the type of information that can be stored. i.e. text,

numbers, dates, etc.

• What is a field Property?– Field size– Input Mask– Validity– Default Value

CSE 2111 Introduction to Database Systems

Page 12: Computer Science & Engineering 2111

12

Research Papers DatabaseTable Name: Client Field Type/

Data TypeProperties

Fields: Client ID Text 5 Characters long Primary Key

First Name Text 25 Characters long

Last Name Text 50 Characters long

Address Text 60 Characters long

City Text 25 Characters long

State Text 2 Characters long Default Value

Zip Code Text 5 Characters long

Home Phone Text 10 Characters long Input Mask

Table Name: Charges Field Type Properties

Fields: Client ID Text 5 Characters long

Charge Amount Currency None

Charge Date Date Input Mast

Table Name: Payments Field Type Properties

Fields: Client ID Text 5 Characters long

Payment Amount Currency None

Payment Type Text 2 Characters long

Payment Date Date Input Mask

Table Name: PaymentMethod Field Type Properties

Fields: MethodID Text 2 Characters long

MethodType Text 20 Characters long

CSE 2111 Introduction to Database Systems

Page 13: Computer Science & Engineering 2111

13

2. Create the layout of the database

• What will be the primary key for each table?• A field, or a collection of fields, whose values uniquely

identify each record in a table

CSE 2111 Introduction to Database Systems

Page 14: Computer Science & Engineering 2111

14

Research Papers DatabaseTable Name: Client Field Type/

Data TypeProperties

Fields: Client ID Text 5 Characters long Primary Key

First Name Text 25 Characters long

Last Name Text 50 Characters long

Address Text 60 Characters long

City Text 25 Characters long

State Text 2 Characters long Default Value

Zip Code Text 5 Characters long

Home Phone Text 10 Characters long Input Mask

Table Name: Charges Field Type Properties

Fields: Client ID Text 5 Characters long

Charge Amount Currency None

Charge Date Date Input Mast

Table Name: Payments Field Type Properties

Fields: Client ID Text 5 Characters long

Payment Amount Currency None

Payment Type Text 2 Characters long

Payment Date Date Input Mask

Table Name: PaymentMethod Field Type Properties

Fields: MethodID Text 2 Characters long

MethodType Text 20 Characters long

CSE 2111 Introduction to Database Systems