Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 101 – Nov. 11 Finish Database concepts –1-1 relationship –1-many relationship –Many-to-many relationship Review.

Similar presentations


Presentation on theme: "CS 101 – Nov. 11 Finish Database concepts –1-1 relationship –1-many relationship –Many-to-many relationship Review."— Presentation transcript:

1 CS 101 – Nov. 11 Finish Database concepts –1-1 relationship –1-many relationship –Many-to-many relationship Review

2 Relationships When you have 2+ tables, there is almost always a relationship They share one field in common. –Can you tell what it is? Ex. Customers & Orders Ex. Publishers & books

3 One-to-One Can be useful if some information is confidential. What if we didn’t have any relationship? Empl #NamePosition 101SmithWelder 102Jonescarpenter Empl #Salary 10218,000 10117,000

4 1-1 Query When you combine tables that have a 1-1 relationship: Access will look for fields that are the same, and use this as a filter. –In previous example, we’ll have 2 results instead of 4. Employee 101’s information Employee 102’s information –Let’s look at another example.

5 What happens when we “join” these 1-1 tables? First nameLast namePositionCity BobFulleraccountantChicago BobDanielscashierGreenville BobDanielsaccountantIndianapolis AliceAndrewsgardenerGreenville First nameLast nameSalaryBirthday BobDaniels51,0007/1/67 ElenaCarlson21,0009/1/89 AliceAndrews81,0008/1/78

6 FirstLastPositionCitySalaryBirthday BobDanielscashierGreenville51,0007/1/67 BobDanielsaccountantIndianapolis51,0007/1/67 AliceAndrewsgardenerGreenville81,0008/1/78 First nameLast namePositionCity BobFulleraccountantChicago BobDanielscashierGreenville BobDanielsaccountantIndianapolis AliceAndrewsgardenerGreenville First nameLast nameSalaryBirthday BobDaniels51,0007/1/67 ElenaCarlson21,0009/1/89 AliceAndrews81,0008/1/78

7 Example

8 One-many Relationships Referential integrity –Keep related records consistent –Cascade delete: allow deletion of “one” –Cascade update: allow update of “one” For example, changing someone’s CustomerID.

9 Many-to-many Ex. Customers to products Implement as 2 one-to-one “Order details” table Think of possible queries based on the 5 tables given in handout.

10 Outline for test Excel –text functions, scenarios, solver, goal seek (Chapter 5) Problem solving / software –Look at contents of Python folder Text software Database –Tables, relationships, queries, reports

11 Problem solving/software –Steps in solving problems –Types of languages & statements –Variables –Example algorithms & programs: search, sum, sort –Kinds of bugs & how to fix them Operating systems –Various responsibilities –Scheduling –File system issues –4 ways to search for data


Download ppt "CS 101 – Nov. 11 Finish Database concepts –1-1 relationship –1-many relationship –Many-to-many relationship Review."

Similar presentations


Ads by Google