260 likes | 420 Views
Data & Networks. Problem Solving with Computers. Data & Information. Data is facts and figures Information is presented data But, before we extract information from data … Data often needs to be organized. Questions & Queries. We often ask questions to obtain information
E N D
Data & Networks Problem Solving with Computers
Data & Information • Data is facts and figures • Information is presented data • But, before we extract information from data … • Data often needs to be organized
Questions & Queries • We often ask questions to obtain information • The data we receive is organized such that we can readily see it’s information content • What about computers?
Questions & Queries • Database • Data organized to facilitate information retrieval • Query • A question we ask of the database
Questions & Queries • What data would you need to answer the following questions? • What percentage of students at WCSU have at least a 3.0 GPA? • How many students graduated for each of the past five years?
Objects & Attributes • An object is a “thing” we wish to work with, such as … • Person • Sales receipt • Car • Music CD
Objects & Attributes • Objects in a collection share common attributes with each other • Example: • Objects: Cars • Attributes: Make, Model, Year, Color, Price, etc. • Attributes yield a method for describing an object, but are not the final object description
Objects & Attributes • Problem • Develop a set of six (6) attributes for describing college students • Remember, the actual set of values for these attributes should be unique for each student
Fields & Records • Each object in a collection is represented by a record in a database • Each attribute identified for the collection is represented by a one or more fields
Database Collection • A database is a collection of records Object • To be useful, there should be a one-to-one correspondence between objects and records Record Database
Models • Therefore … • A record is a model for an object • A database is a model for a collection of objects • A database can consist of one or more database files
Tables • Databases are often stored as tables • Each row in a table is a record • Each column in a table is a field • Each field has an associated datatype and perhaps a length • Hmmm … almost sounds like fields are variables, eh?
Field Record Tables Used Cars
Try this! • Problem: • Create a simple table design for college course sections • Select attributes that will yield a unique record for each course section • Work in pairs • You have 15 minutes to complete this exercise
Try this! • Primary key • One or fields that represent a unique set of data for each record • How did you insure that each record was unique? • Was there any duplicate data?
Database Management Software • Used to create and edit databases • Examples: • Microsoft Access • Filemaker Pro • Facilitates • Creation of tables • Data entry • Data retrieval
Microsoft Access Demo
Exercise • Use Microsoft Access to implement your database design for college course sections
Relationships • Associations between two tables • Based on common field(s) • Often used to reduce errors and/or duplication of data
Example:Car Dealership Database • Tables • Car Models • Cars Models Cars
Example:Car Dealership Database • Each car can be associated with one model • Each model can be associated with many cars • This is a one-to-many relationship Models 1 Cars n
Example:Car Dealership Database • Sometimes, a record in one related file cannot exist without a record in another file • Is that the case here? • Can you imagine a situation where this was true? Models 1 Cars n
Example:Car Dealership Database • A common field(s) is required to form the link between two related files Models Model ID : 1 Cars Model ID : n
Example:Car Dealership Database Models Cars Do this for homework!
Queries • A structured question “asked” of a database • Examples: • How many cars were sold in January? • What cars were sold in January? • Were any cars sold in March? • What is the data type for each answer?