Download presentation
Presentation is loading. Please wait.
Published byAlexis Chambers Modified over 9 years ago
1
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities
2
Copyright © 2003 Pearson Education, Inc. Slide 1-2 Figure 13.3. The constituents of a database table: (a) the table structure, (b) unordered entities with their unordered attributes, (c) the rows of the whale table.
3
Copyright © 2003 Pearson Education, Inc. Slide 1-3 The Key to it All > A key is one or more fields which uniquely identify one row in a table. > A key is like a handle that we use to randomly access one entity’s information. > A key can also be used to tie two tables together. > Another term for key is primary key.
4
Copyright © 2003 Pearson Education, Inc. Slide 1-4 Queries > Queries provide us with different ways to view the database. > Customize the view to our specific needs. > Physical database – The tables and all of the fields. > Logical database – The views provided by the queries and forms. > Must have a physical database before we can make the logical.
5
Copyright © 2003 Pearson Education, Inc. Slide 1-5 DESIGNING THE PHYSICAL DATABASE > Redundancy Is Bad, Very, Very, Very Bad > Keep Only One Copy of Information > Keep a Separate Table and a Key to link > If two tables have the same primary key, should they be the same table? — yes if they also contain the same population — no if one table is a sub-population of the other — Student and Student Employee — Look for redundancy between data.
6
Copyright © 2003 Pearson Education, Inc. Slide 1-6 Figure 14.6. Another form of an ER diagram typical of database software.
7
Copyright © 2003 Pearson Education, Inc. Slide 1-7 Figure 14.1. Fields of the Master_Record table. See page 378/79
8
Copyright © 2003 Pearson Education, Inc. Slide 1-8 THE DATABASE SCHEMA > Connecting Database Tables by Relationship > Using the Join Operation > Designing a Database Schema > Physical vs. Logical Database
9
Copyright © 2003 Pearson Education, Inc. Slide 1-9 Figure 14.4. A diagram showing the Lives_At relationship.
10
Copyright © 2003 Pearson Education, Inc. Slide 1-10 QUERIES: CREATING VIEWS > Creating a Dean’s View > Creating a Sport’s Center View
11
Copyright © 2003 Pearson Education, Inc. Slide 1-11 Figure 14.2. The Dean’s View; information from several tables.
12
Copyright © 2003 Pearson Education, Inc. Slide 1-12 Figure 14.3. The fields and sources for the sports center’s view; information drawn from three physical tables.
13
Copyright © 2003 Pearson Education, Inc. Slide 1-13 Physical database > The physical database provides — All of the data — Protection of the data — type — reference — validation — defaults — Relationship of the tables to one another
14
Copyright © 2003 Pearson Education, Inc. Slide 1-14 Creating a database > Think in terms of the entities in your “world” > Simulate those entities by defining the data > For example, if you had a database of library books, what would the entities be? > Each entity becomes a table and we need to find out how they are related.
15
Copyright © 2003 Pearson Education, Inc. Slide 1-15 Let’s look at the database of movies > Field > Attributes of fields — type — size — format — default value — validity rules — required
16
Copyright © 2003 Pearson Education, Inc. Slide 1-16 How do you decide what fields > Data should not be derived > Birthdate is good; age is not > Think about how you will use the data you are collecting downstream. > Do you need a key, or will one or more fields serve as the key?
17
Copyright © 2003 Pearson Education, Inc. Slide 1-17 Foreign key > The relationship between two tables is accomplished through common elements. > You can choose how to implement the relationship. > Referential integrity is the validation of one table against the contents of another. > Requires that only values that have already been established in one table (where the primary key is) are used in another.
18
Copyright © 2003 Pearson Education, Inc. Slide 1-18 Example > Movies and directors > If referential integrity is established only directors on the director table can be attached to a movie.
19
Copyright © 2003 Pearson Education, Inc. Slide 1-19 Joins can be used for other purposes as well. > We will look at operations on tables.
20
Copyright © 2003 Pearson Education, Inc. Slide 1-20 OPERATIONS ON TABLES > Select Operation > Project Operation > Union Operation > Difference Operation > Product Operation > Join Operation
21
Copyright © 2003 Pearson Education, Inc. Slide 1-21 Figure 13.4. The Nations table definition and sample entries. pg 361
22
Copyright © 2003 Pearson Education, Inc. Slide 1-22 Structured Query Language > SQL – abbreviation > Standard way of communicating with a database.
23
Copyright © 2003 Pearson Education, Inc. Slide 1-23 Select OPERATION > A selection is performed to choose to view only certain entities from a table. > A selection uses “selection criteria” to choose which rows. > Let’s look at another example…movies. > where clause
24
Copyright © 2003 Pearson Education, Inc. Slide 1-24 Figure 13.5. Part of the table created by selecting countries with the Test that the one-word description equals Beach.
25
Copyright © 2003 Pearson Education, Inc. Slide 1-25 Project – Pronounced project’. > Choose to display only certain columns from the table. > Usually, you use both selection to limit the rows and projection to limit the fields displayed. > Select clause.
26
Copyright © 2003 Pearson Education, Inc. Slide 1-26 Figure 13.6. Sample entries for a Project operation on Nations.
27
Copyright © 2003 Pearson Education, Inc. Slide 1-27 Figure 13.7. Northland, the table of countries with northern capitals.
28
Copyright © 2003 Pearson Education, Inc. Slide 1-28 How do these relate to Access? > Select = criteria (where clause in SQL) > Project = field choices (select clause in SQL) > sort is not an operation, but it is used to create a result set in the right format. Sort is a Order by clause in SQL
29
Copyright © 2003 Pearson Education, Inc. Slide 1-29 Union – another operation > Combines into a result set the combination of two or more tables. The columns are the same, but the records are the all unique rows of both tables.
30
Copyright © 2003 Pearson Education, Inc. Slide 1-30 Difference – another operation > Return a result set with is the difference between two tables. In other words, which records exist in one but not the other.
31
Copyright © 2003 Pearson Education, Inc. Slide 1-31 Product aka cross product > Combines two tables based on a common element. Includes the columns from both tables. > Is this useful? > Cohort of students taking a program. All students in Fall 2005 take the same 3 courses. A cross product of a student table and the 3 courses table would produce a table for all students taking these courses.
32
Copyright © 2003 Pearson Education, Inc. Slide 1-32 Figure 13.9. The definition of the Travelers table (a), and its values (b).
33
Copyright © 2003 Pearson Education, Inc. Slide 1-33 Figure 13.10. Some rows from the Super table, the product of Nations and Travelers ; for each row in Nations and each row in Travelers, there is a row in the product table that combines them.
34
Copyright © 2003 Pearson Education, Inc. Slide 1-34 Join > Allows two related tables to be “hooked together” based on a common element. > Equi-join – the joined table will have only those rows where there is at least one row from one table with a matching value on one row from the second table.
35
Copyright © 2003 Pearson Education, Inc. Slide 1-35 Figure 13.12. The Join operation: Master Northland.
36
Copyright © 2003 Pearson Education, Inc. Slide 1-36 Figure 14.5. ER diagram for the entities and relationships involving Home_Base.
37
Copyright © 2003 Pearson Education, Inc. Slide 1-37 Figure 14.6. Another form of an ER diagram typical of database software.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.