INFO/CSE 100, Spring 2006 Fluency in Information Technology

Slides:



Advertisements
Similar presentations
Final Review Sunday March 13th. Databases –Entities/Rows –Attributes/Columns –Keys –Relationships –Schema –Instance.
Advertisements

1 The Information School of the University of Washington Nov 27fit databases © 2006 University of Washington Database Intro INFO/CSE 100, Fall 2006.
Chapter 14 Getting to First Base: Introduction to Database Concepts.
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.
1 The Information School of the University of Washington Nov 29fit forms © 2006 University of Washington More Forms INFO/CSE 100, Fall 2006 Fluency.
1 The Information School of the University of Washington Nov 20fit spreadsheets © 2006 University of Washington Structured Data INFO/CSE 100, Fall.
“DOK 322 DBMS” Y.T. Database Design Hacettepe University Department of Information Management DOK 322: Database Management Systems.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Mgt 20600: IT Management & Applications Databases Tuesday April 4, 2006.
Relational Databases What is a relational database? What would we use one for? What do they look like? How can we describe them? How can you create one?
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
Chapter 15 Introduction to Database Concepts. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Learning Objectives Explain.
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Akhila Kondai October 30, 2013.
Copyright © 2003 by Prentice Hall Module 4 Database Management Systems 1.What is a database? Data hierarchy and data organization Field, record, file,
DAY 15: ACCESS CHAPTER 2 Larry Reaves October 7,
Concepts of Database Management, Fifth Edition Chapter 1: Introduction to Database Management.
Concepts and Terminology Introduction to Database.
DBSQL 3-1 Copyright © Genetic Computer School 2009 Chapter 3 Relational Database Model.
Chapter 16 HAI! Adventure Database: Case Study in Database Design.
Chapter 2 Adapted from Silberschatz, et al. CHECK SLIDE 16.
Professor Michael J. Losacco CIS 1110 – Using Computers Database Management Chapter 9.
Introduction to Databases Trisha Cummings. What is a database? A database is a tool for collecting and organizing information. Databases can store information.
Information Systems & Databases 2.2) Organisation methods.
Chapter 17 Creating a Database.
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
3 1 Chapter 3 The Relational Database Model Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
1 The Information School of the University of Washington Dec 1fit advdatabases © 2006 University of Washington Advanced Database Concepts INFO/CSE.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Fluency with Information Technology Third Edition by Lawrence Snyder Chapter.
SQL John Nowobilski. What is SQL? Structured Query Language Manages Data in Database Management Systems based on the Relational Model Developed in 1970s.
CHAPTER 1 – INTRODUCTION TO ACCESS Aliya Farheen March 5, 2014.
3 1 Database Systems The Relational Database Model.
Fluency with Information Technology INFO100 and CSE100 Katherine Deibel Katherine Deibel, Fluency in Information Technology1.
CSCI 3327 Visual Basic Chapter 13: Databases and LINQ UTPA – Fall 2011.
Databases Databases are collections of information; our study repeats a theme: Tell the computer the structure, and it can help you! © 2004, Lawrence Snyder.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Relational Algebra Chapter 4, Part A.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
Databases That's no moon. It's a base of data... in space
Creating a database table
IST 220 – Intro to Databases
GO! with Microsoft Office 2016
Databases Chapter 16.
Chapter 2: Relational Model
Information Systems Today: Managing in the Digital World
GO! with Microsoft Access 2016
Information Systems Database Management
Chapter 4 Relational Databases
Relational Algebra Chapter 4, Part A
Databases and Information Management
Relational Algebra 461 The slides for this text are organized into chapters. This lecture covers relational algebra, from Chapter 4. The relational calculus.
INFO/CSE 100, Spring 2005 Fluency in Information Technology
ERD’s REVIEW DBS201.
Database Fundamentals
INFO/CSE 100, Spring 2006 Fluency in Information Technology
INFO/CSE 100, Spring 2005 Fluency in Information Technology
LECTURE 3: Relational Algebra
Announcements Project 2’s due date is moved to Tuesday 8/3/04
Relational Algebra Chapter 4, Sections 4.1 – 4.2
Databases and Information Management
INFO/CSE 100, Spring 2006 Fluency in Information Technology
The Relational Database Model
Test Your Tech Blogging is: Someone's online journal.
Getting to First Base: Introduction to Database Concepts
Database Design Hacettepe University
Advanced Database Concepts: Reports & Views
Spreadsheets, Modelling & Databases
DCT 2053 DATABASE CONCEPT Chapter 2.2 CONTINUE
Getting to First Base: Introduction to Database Concepts
Getting to First Base: Introduction to Database Concepts
INFO/CSE 100, Spring 2005 Fluency in Information Technology
Presentation transcript:

INFO/CSE 100, Spring 2006 Fluency in Information Technology Database Intro INFO/CSE 100, Spring 2006 Fluency in Information Technology http://www.cs.washington.edu/100 4/7/2019 fit100-23-databases © 2006 University of Washington

Readings and References Fluency with Information Technology Chapter 13, Introduction to Database Concepts References Access Database: Design and Programming by Steve Roman, published by O'Reilly 4/7/2019 fit100-23-databases © 2006 University of Washington

fit100-23-databases © 2006 University of Washington Why Study Databases? Some of us want to compute, but all of us want information … Much of the archived information is in tables Databases enhance applications, e.g. Web Once you know how to create databases, you can use them to personal advantage Databases introduce interesting ideas 4/7/2019 fit100-23-databases © 2006 University of Washington

fit100-23-databases © 2006 University of Washington Relational Databases Information is stored in tables Tables store information about entities Entities have characteristics called attributes Each row in a table represents a single entity Each row is a set of attribute values Every row must be unique, identified by a key Relationships -- associations among the data values are stored Table structure = schema Table contents = instance 4/7/2019 fit100-23-databases © 2006 University of Washington

fit100-23-databases © 2006 University of Washington A Table in a Database Tables have names, attributes {fields}, entities {rows} Schema for Example table: ID number unique number(Key) Last text person’s last name First text person’s first name JobCode number current position Hire date first day on job ... instance Attributes are sometimes referred to as fields, represented by the columns. Entities are sometimes referred to as rows or tuples. The schema is the structure of the table. schema 4/7/2019 fit100-23-databases © 2006 University of Washington

Two tables in a database Tables: Example, JobCodes Example: 6 rows or entities and 9 fields or attributes, ID is key JobCodes: 3 rows and 3 fields, JobID is key 4/7/2019 fit100-23-databases © 2006 University of Washington

Redundancy in a database is Very Bad Not every assembly of tables is a good database Repeating data is a bad idea Replicated data can differ in its different locations, e.g. multiple addresses can differ Inconsistent data is worse than no data Cut down on the typos and mis-keyed entries Keep a single copy of any data Reduces memory and data processing costs if it is needed in multiple places, associate it with a key and store key rather than the data Effort to update is high 4/7/2019 fit100-23-databases © 2006 University of Washington

Relationships between tables Relationship between the Perms table and JobCodes table, They share field JobID. 4/7/2019 fit100-23-databases © 2006 University of Washington

fit100-23-databases © 2006 University of Washington “You can look it up” When looking for information, a single item might be the answer, but a table is more likely Which employees live in Kirkland? Table of employees Who is taking INFO/CSE 100? Table of students Whose mile run time  4:00? Table of runners A query to a table produces a new table as a result! Query to a database (set of tables) produces a new table 4/7/2019 fit100-23-databases © 2006 University of Washington

Relational Algebra: Tables From Tables There are five basic “algebraic” operations on tables: Select -- pick rows from a table Project -- pick columns from a table Union/Join -- combine two tables w/like columns Difference -- remove one table from another Product -- create “all pairs” from two tables From this basis, many more complicated operations can be built up 4/7/2019 fit100-23-databases © 2006 University of Washington

fit100-23-databases © 2006 University of Washington Select Operation Select creates a table from the rows of another table meeting a criterion Select_from Example On Hire < 1993 Structured Query Language (SQL) in red Table in green Condition {test} in blue 4/7/2019 fit100-23-databases © 2006 University of Washington

Project Project creates a table from the columns of another table Project Last, First From Example This is a projection from 9 dimensions to 2 dimensions 4/7/2019 fit100-23-databases © 2006 University of Washington

fit100-23-databases © 2006 University of Washington Union Union combines two tables with same attributes All employees = perms UNION temps 4/7/2019 fit100-23-databases © 2006 University of Washington

fit100-23-databases © 2006 University of Washington Difference Difference (written like subtraction) removes 1 table’s rows from another Eastern = States - WestCoast 4/7/2019 fit100-23-databases © 2006 University of Washington

fit100-23-databases © 2006 University of Washington Product Product (written like multiplication) combines columns and pairs all rows Colors = Blues x Reds  = Column Rule: If A has x columns, B has y columns, A x B has x+y columns Row Rule: If A has m rows, B has n rows A x B has mn rows 4/7/2019 fit100-23-databases © 2006 University of Washington

Join Join (written like a bow tie) combines rows if common field matches Employee List = Perms JobCodes >< Join is kind of like a Product,, except only combine rows if common fields match!

fit100-23-databases © 2006 University of Washington DB Operations The five DB Operations can create any table from a given set of tables All modern database systems are built on these relational operations Join is not primitive, but can be built from 5 Join, select and project are used most often The operations are not usually used directly, but are used indirectly from other languages Structured Query Language (SQL) is the language that we talk to the database in SQL, the DB language we learn, is built on basic 5 4/7/2019 fit100-23-databases © 2006 University of Washington

fit100-23-databases © 2006 University of Washington Database Structure A database contains one or more tables Tables include entities with attributes There are relationships defined between the entities in the various tables Retrieve information from the tables using queries Create GUI front ends (forms and reports) for users First, design the database or create the schema What are the entities? What are the attributes of each entity? What are the relationships between tables? Creating a database… Lets consider all of the details about the database schema first!!! 4/7/2019 fit100-23-databases © 2006 University of Washington

entity-relationship diagram for Library database Price Name ISBN Title ID Phone ∞ WrittenBy ∞ Books Authors ∞ PublisherOf 1 Publishers entity-relationship diagram for Library database Books, Publishers, Authors are tables Price, ISBN, Title are attributes of the table Books There is a relationship between Books and Publishers 1 Publisher can have many Books ID Phone Name

fit100-23-databases © 2006 University of Washington Create a new database We are going to be using MS Access. Its available on the Lab machines and in MS Office if you have that installed on your home computer already. Step 1: create a new database , with a .mdb file extension 4/7/2019 fit100-23-databases © 2006 University of Washington

Create a new table in the database MS Access tries to be friendly and offer you some choices! Select "Create table in Design View". Do not use the Wizard! 4/7/2019 fit100-23-databases © 2006 University of Washington

Creating a table in Design view Aha! Now you've got to enter in the attributes {fields} of the table. Attributes have a field name, data type, and a description. In this example, three fields are being created: ISBN, Title, and Price. ISBN field is specified as the key (see key icon). Remember that the key field must be unique! 4/7/2019 fit100-23-databases © 2006 University of Washington

fit100-23-databases © 2006 University of Washington Entering Table Data Once the table has been added you must view leave the Design View to enter data into the table. 4/7/2019 fit100-23-databases © 2006 University of Washington

fit100-23-databases © 2006 University of Washington Build another table 4/7/2019 fit100-23-databases © 2006 University of Washington

Add publisher ID to books Field properties allow you to add more details about each attribute {field}, including things like size, format (for dates), number of decimal places, required, etc… 4/7/2019 fit100-23-databases © 2006 University of Washington

Create the link between the tables From the Relationships view. We can create a link by dragging a line between a field from one table to a field on another table. 4/7/2019 fit100-23-databases © 2006 University of Washington

Hey presto, we have a database! Price Name ISBN Title ID Phone ∞ WrittenBy ∞ Books Authors ∞ PublisherOf 1 Publishers Hey presto, we have a database! ID Phone Name

Two tables with a relationship 4/7/2019 fit100-23-databases © 2006 University of Washington

fit100-23-databases © 2006 University of Washington Create a query Create a query in Design View. Step 1: select query from the object lists. Step 2: select the tables you want to query from. Step 3: select the fields you want to query from. 4/7/2019 fit100-23-databases © 2006 University of Washington

The query produces a new (virtual) table A query produces a new table, of which we see the results. 4/7/2019 fit100-23-databases © 2006 University of Washington

Project (select particular columns) 4/7/2019 fit100-23-databases © 2006 University of Washington

Select particular rows 4/7/2019 fit100-23-databases © 2006 University of Washington

fit100-23-databases © 2006 University of Washington SQL behind the scenes 4/7/2019 fit100-23-databases © 2006 University of Washington