CSE 103 Day 15: Database Design

Slides:



Advertisements
Similar presentations
Database Basics. What is Access? Database management system Computer-based equivalent of a manual database Makes it easy to organize and update information.
Advertisements

Database A collection of related information stored on a computer and organized in a manner that allows access, retrieval, and use of that data.
1 CSE Students: Please do not log in yet. Check-in with Brian in the back. Review Days 3 and 4 in the book. Others: Please save your work and logout.
Introduction to Databases CIS 5.2. Where would you find info about yourself stored in a computer? College Physician’s office Library Grocery Store Dentist’s.
U:/msu/course/cse/103 Day 16, Slide 1 CSE 103 Day 16 Students: Read Day 10. If you are logged in, add records to your contacts.
U:/msu/course/cse/103 Day 23, Slide 1 Review of Day 22 What query did you use to search for an actor by name? –Return matches.
MS Access: Database Concepts Instructor: Vicki Weidler.
DATA, DATABASES, AND QUERIES Managing Data in Relational Databases CS1100Microsoft Access - Introduction1.
DATA, DATABASES, AND QUERIES Managing Data in Relational Databases CS1100Microsoft Access - Introduction1 Created By Martin Schedlbauer
U:/msu/course/cse/103 Day 25, Slide 1 Back-up PHP Files If you have not yet passed the 3.0 BT, make back-up copies of ALL.
ACCESS CHAPTER 1. OBJECTIVES Tables Queries Forms Reports Primary and Foreign Keys Relationship.
MICROSOFT ACCESS Pn. Jamilah Binti Yusof. DEFINITION A database is the computer equivalent of an organized list of information. Typically, this information.
Access 2007 Database Application Managing Business Information Effectively BCIS 1 and 2.
DAY 15: ACCESS CHAPTER 2 Larry Reaves October 7,
Chapter 4 The Relational Model 3: Advanced Topics Concepts of Database Management Seventh Edition.
U:/msu/course/cse/103 Day 04, Slide 1 CSE students: Do not log in yet. Computers are SLOW today! Review days 13.
Microsoft ® Office Access ® 2007 Training Build a database I: Design tables for a new Access database ICT Staff Development presents:
U:/msu/course/cse/103 Day 07, Slide 1 Day 15 Review What datatype would be an appropriate choice for: –A cell phone number.
U:/msu/course/cse/103 Day 06, Slide 1 CSE students: Do not log in yet. Review Day 6 in your textbook. Think about.
Datafaces Data Base Management Software (DBMS) is a tool used to transform Data into Information. What is Data…? What is Information…? What is a Database…?
Day 13, Slide 1 U:/msu/course/cse/103 CSE 103 Students: Review INNER and OUTER JOINs, Subqueries. Others: Please save your.
DATABASE What exactly is a database How do databases work? What's the difference between a spreadsheet database and a "real" database?
Database collection of related information stored in an organized form Database program software tool for storage & retrieval of that information.
1 CSE 2337 Introduction to Data Management Access Book – Ch 1.
INFORMATION TECHNOLOGY DATABASE MANAGEMENT. Adding a new field 1Right click the table name and select design view 2Type the field information at the end.
Relational Database. I. Relational Database 1. Introduction 2. Database Models 3. Relational Database 4. Entity-Relationship Models 5. RDB Design Principles.
Introduction to a Database Defining a database Database window in Access The six items in window: Tables, Queries Forms, Reports, Macros, Modules.
U:/msu/course/cse/103 Day 18, Slide 1 CSE 103 Day 18 If you are not enrolled in CSE 103, please save and log out by 10:10.
Database Objective Demonstrate basic database concepts and functions.
Database Basics BCIS 3680 Enterprise Programming.
U:/msu/course/cse/103 Day 03, Slide 1 CSE 103 Day 15: Database Design Students: –Read Day 2 in your textbook –Your BT feedback.
U:/msu/course/cse/103 Day 21, Slide 1 CSE 103 Makeups –If you didn’t take one over the weekend, take one TUESDAY or WEDNESDAY!
U:/msu/course/cse/103 Day 17, Slide 1 CSE 103 Housekeeping: –Take a makeup BT this week if not passed the 2.0 yet –Next.
Introduction to Databases CISC Where would you find info about yourself stored in a computer? College Physician’s office Library Grocery Store Dentist’s.
U:/msu/course/cse/103 Day 08, Slide 1 CSE 103 Students: –Review days 7 and 8 if you need to go over relationships and INNER.
Constraints Advanced Database Systems Dr. AlaaEddin Almabhouh.
Database (Microsoft Access). Database A database is an organized collection of related data about a specific topic or purpose. Examples of databases include:
Databases: What they are and how they work
Access Tutorial 2 Building a Database and Defining Table Relationships
New Perspectives on Microsoft Access 2016
Microsoft Office Access 2010 Lab 1
Microsoft Visual Basic 2010: Reloaded Fourth Edition
Creating a database table
Prepared By: Bobby Wan Microsoft Access Prepared By: Bobby Wan
Databases Key Revision Points.
GO! with Microsoft Office 2016
Microsoft Access 2007 – Level 1
Databases Chapter 16.
Practical Office 2007 Chapter 10
 2012 Pearson Education, Inc. All rights reserved.
and Defining Table Relationships
CIS 155 Table Relationship
GO! with Microsoft Access 2016
Database Management  .
What is a Database and Why Use One?
INFO/CSE 100, Spring 2005 Fluency in Information Technology
Introduction to Access 2003
Database Applications – Microsoft Access
More about Databases.
Databases & Consistency
Normalization Normalization theory is based on the observation that relations with certain properties are more effective in inserting, updating and deleting.
Database Fundamentals
Test Your Tech Blogging is: Someone's online journal.
Debrief Homework Import data from the text file CanadianUniversities06.txt into a temporary table. What is the primary key for this table? Construct an.
Advanced Database Concepts: Reports & Views
Spreadsheets, Modelling & Databases
Topic 12 Lesson 1 – Data and databases
Microsoft Office Illustrated Introductory, Windows XP Edition
Microsoft Access Date.
Presentation transcript:

CSE 103 Day 15: Database Design Students: Do NOT log in Read Day 2 in your textbook Your BT feedback is up—check after class, save questions for then. Others: Please save your work and log out by 10:10. http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103

Day 13/14 Review Day 13: Nested queries in MySQL Write subqueries to find data needed before we can answer the overall problem Compare a field to a subquery returning exactly one record & field by using =, >, <, etc. In a FROM clause, subqueries can be used as virtual tables we name via AS Day 14 BT: Comments/feedback on your BT? "It was too hard" doesn't count How long were queries taking to run? http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103

Database terminology review Entity A particular type of object about which data is stored Tables are used to represent entities Record A group of data about a specific object, usually represented by one row in one of the tables Tables contain records about specific objects of that same type Field/Attribute An individual type of information about an object Stored in columns in the tables http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103

Database Design What questions do I want the database to answer? What data do I need to answer these questions? How are these data related to one another? http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103

Guiding Principles Control data Redundancy Maintain data Consistency Don't (redundantly) store data in two places (twice) Maintain data Consistency Don't store conflicting data Provide data Integrity Only allow legal values; all records must have primary keys Maintain data Independence Changing data in one place does not “break” the DB in other places http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103

Database Example: Electronic Rolodex What information about your friends would you like a rolodex to provide? What data is in the SBC phone book white pages? What data isn't available in the SBC phone book that you would like to have in your personal phone book? How would you arrange this data in a database table?  http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103

Database Example: Electronic Rolodex, cont’d What questions do you want to be able to answer about your friends? What items of data do we need in our contact directory in order to answer such questions? What should you do when you can't get some of the data? For example, you don't know all of your friends' addresses. What should you do with people who have more than one phone number: a cell phone number, a pager number, a fax number? http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103

Data types Examine the list of data types on page 2-5 of the text Within your group, reach a consensus on the datatype assigned to each piece of data in your design Note: this data will be made available in the Day 15 AFS space after we have agreed on types as a class http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103

Design View for a Table Start Access and create a new database called contacts.mdb Create a new table in design view, and enter the field names and data types (as agreed) Use descriptive field names close to those discussed in class so that you don't need any additional information in the Description box NEVER USE SPACES IN FIELD NAMES! Try to follow a consistent convention, e.g., all lower-case, first capital, underscores between words, etc. Pick your own but BE CONSISTENT! Don't save the table yet http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103

Saving the Table Use a naming convention: To tell the difference between tables and queries, we use tbl_ and qry_ Not required—some people don't use any convention, but we recommend you use one Following the naming convention, call the table tbl_People Access will prompt you about a primary key. Answer NO for now and continue to the next slide. http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103

Primary Keys What does the primary key do? What is a reasonable primary key for this table? (see next slide) http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103

Types of Primary Keys Existing data: Multiple cell: Autonumber: e.g., Social Security #, PID, filename, etc. One item that uniquely identifies an object Multiple cell: e.g., ActorID + MovieID = Role (list of Actors in Movies); TextbookID + AuthorID = BookAuthor (books’ authors) The combination of all fields uniquely identifies an object: same actor can’t be in same movie, but one actor can be in multiple movies, and one movie may have multiple actors Autonumber: Last resort, used when nothing else works well The DBMS assigns a new unique # when you insert a row Wastes space if you could find a key among existing data Doesn't help prevent duplicate entries (can always insert; get new key every time, even if all other data is the same) http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103

Closing & data entry Set the primary key, save, and close the table Open it in datasheet view and add information about yourself Remember that we don't ever save the database itself All data changes are live Changes to table or query designs have to be saved http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103

Better design, first steps: Properties of data What pieces of information does every person have: Exactly one of Exactly zero or one of Any number between zero and two (or more) What pieces of information might be shared between multiple people? http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103

Homework Check the Homework link Enter 15 records into your contact directory (Suggest you use classmates right after class!) Practice identifying primary keys Read Day 10 in the textbook on the design of multiple-table databases Think about how we could improve the design of the contacts database (see questions on previous slide) http://www.cse.msu.edu/~cse103 U:/msu/course/cse/103