Top Banner
1 Dr. Tom Hicks Computer Science Department Database Design 1 University Library Software Engineering CSCI-3321
85

Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

Jul 19, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

1

Dr. Tom HicksComputer Science Department

Database Design 1

University Library

Software EngineeringCSCI-3321

Page 2: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

2

Student-Database-Design-1.xlsx

RenameTomH-Database-Design-1.xlsx

Using Your First & Initial

Part Of Today's In-Class Lab Will Be To Submit This SpreadSheet

Page 3: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

3

Student-Database-Design-1.docx

RenameTomH-Database-Design-1.docx

Using Your First & Initial

Part Of Today's In-Class Lab Will Be To Submit This Completed Pledge

Form

Page 4: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

4

Import UniversityA

use universitya

Page 5: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

5

Import UniversityA1 - How Many Tables In Our University Library?

2 - How Many Records In Table Book?

Page 6: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

6

Book Two Major Design

Flaws

Not Looking For Additon Data Members Yet

Page 7: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

7

Form Small Group 2 (if possible 2 - else 3)

Work In Class Today As A Team!

Page 8: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

8

Two Major Design Flaws Show The Book Table Layout!

4 - List The Two Major Design Flaws With Books?

Page 9: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

9

Import universitya

1 - A Book May Have More Than One Genre

4 - List The Two Major Design Flaws With Books?

2 - A Book May Have More Than One Author

Page 10: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

10

Table Genre

1 - We Now Need A Relationship/Table To Tie These Together!

Page 11: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

11

Add Tables BookGenre & Genre

1 - We Use Arrows To Represent The Relationships

Good Design Is Good Design This Is The Best Approach For Direct Access Files, Text Files, ISAM Files, etc.

Page 12: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

12

Small Group 2 (Answer As Many As You Can In 90 Sec)

Lots Of Design Advantages Let's Work At Organizing & Extracting The Data Properly

Page 13: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

13

Attack First Problem:

A Book May Be Associated With More

Than One Genre

Page 14: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

14

Import UniversityB

use universityb

Page 15: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

15

Import Database UniversityB 6 Tables

1 - Before We Join Small Tables, I Have Found It Beneficial To Join Some Tiny Tables.

Page 16: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

16

Table A

1 - Show All The Data Members In Table A

Page 17: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

17

Table B

1 - Show All The Data Members In Table B

Page 18: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

18

Table C

1 - Show All The Data Members In Table C

Page 19: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

19

Execute This Query

A B

SELECT * FROM A,B;

Page 20: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

20

SELECT * FROM A, B B, A

SELECT * FROM A,B; SELECT * FROM B,A;

A B

NOT COMMUTATIVE!

Page 21: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

21

Small Group 2 (Answer As Many As You Can In 60 Sec)

Page 22: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

22

DatabaseJoins

Relationship Spans

Page 23: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

23

Database Joins Relationship Spans

Databases Have Support A Number Of Different Joins.

Cross JoinsNatural JoinsInner JoinsOuter JoinsEtc.

Not All Databases Support All Of The Joins

We Are Not Going To Do These Joins I Hope You Take The Database Class I Have Been Told That Many Of Our Database

Optimizers Will Replace Your Relationship Spans

We Are Going To Concentrate On Some Basic Relationship Spans

Page 24: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

24

"C++" Relationship Spans

Page 25: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

25

Book, BookGenre

Page 26: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

26

Suppose We Have A Query FROM Book, BookGenre

Page 27: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

27

BookGenre, Genre

Page 28: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

28

Suppose We Have A Query FROM BookGenre, Genre

Page 29: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

29

Book, BookGenre, Genre

Page 30: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

30

Suppose We Have A Query FROM Book, BookGenre, Genre

Page 31: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

31

Potential ProblemWith

Relationship Spans

Page 32: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

32

The Relationship Span, Without The Relationship Link, Generates A Lot Of Meaningless Records

Execute The Following Query:

SELECT Title, Price, Book.ID AS "Book.ID", BookID As "BookGenre.ID"

FROM Book, BookGenre;

The First 4 Records Are Meaningless:Book.ID != BookID

Page 33: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

33

The Relationship Link

SELECT Title, Price, Book.ID AS "Book.ID", BookID As "BookGenre.ID"

FROM Book, BookGenreWHERE Book.ID = BookID;

Execute :

Page 34: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

34

Filter Out The Duplicate Records

Execute :

SELECT Distinct Title, Price, Book.ID AS "Book.ID", BookID As "BookGenre.ID"

FROM Book, BookGenreWHERE Book.ID = BookID;

Page 35: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

35

Why Did We Get The Duplicate Records?

SELECT Title, Price, Book.ID AS "Book.ID", BookID As "BookGenre.ID", GenreID

FROM Book, BookGenreWHERE Book.ID = BookID;

7 Different Genre Associated With Data Communications Text

Page 36: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

36

Small Group 2 (Answer As Many As You Can In 45 Sec)

Page 37: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

37

Small Group 2 (Answer Now)

Meaningless

SELECT … FROM TableA, TableB

Page 38: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

38

Query Practice I

use universityb

Page 39: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

39

Create TomH-Database-Design-1-Queries.txt

We are going to do several Queries Open Notepad ++

You Will Probably Not Be Able To Get All Of The Queries, But Do As Many As You Can.

Page 40: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

40

SELECT Title, PriceFROM BookWHERE

SELECT Title, Price, GenreIDFROM Book, BookGenreWHERE (GenreID = 180)

Query 1

Display The Title, Price & GenreID Of All The Books Whose GenreID = 180

SELECT Title, Price, GenreIDFROM Book, BookGenreWHERE (GenreID = 180) AND (BookID = Book.ID);

Page 41: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

41

Small Group 2 (Answer Now)

Page 42: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

42

Small Group 2 (thoughts)

Placing your queries in NotePad ++ May Well Prove Helpful!

Page 43: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

43

SELECT COUNT(*)FROM BookGenreWHERE GenreID = 62;

Query 2

Display The No Books Whose GenreID = 62

Combine Only Enough Tables To

Solve The Problem!

Page 44: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

44

SELECT Book.ID, Title, GenreIDFROM Book, BookGenreWHERE (GenreID = 62) AND (BookID = Book.ID);

Query 3

Display The Book ID, Titles & GenreID WhoseGenreID = 62

Page 45: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

45

SELECT Genre.ID, Description, BookIDFROM Genre, BookGenreWHERE (BookID = 86) AND (GenreID = Genre.ID);

Query 4

Display The Genre ID, Description, & Book ID Whose Book ID =86

Page 46: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

46

SELECT Title, Book.ID, BookID, GenreID, Genre.ID, Description

FROM Book, BookGenre, GenreWHERE (BookID = Book.ID) AND

(GenreID = Genre.ID);

Execute Query 5

Page 47: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

47

SELECT Description AS GenreFROM Book, BookGenre, GenreWHERE (BookID = Book.ID) AND

(GenreID = Genre.ID) AND (Title = "Vector Calculus");

Query 6

Display All of the Descriptions, called "Genre", that are associated with Vector Calculus.

Page 48: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

48

SELECT Title AS "Technology Titles"FROM Book, BookGenre, GenreWHERE (BookID = Book.ID) AND

(GenreID = Genre.ID) AND(Description = "Technology");

Query 7 Display All of The Titles, called "Technology

Titles", that are associated with Technology.

Page 49: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

49

Attack Second Problem:

A Book May Be Associated With More

Than One Author

Page 50: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

50

Modify The Class Diagram 1 Minute More Than One Author.

Page 51: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

51

Class Diagram Add Tables BookAuthor & Author More Than One Author.

Page 52: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

52

Import UniversityC

use universityc

Page 53: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

53

Examine Database UniversityC

Author Has How Many Data Members …….._____ Author Has How Many Records …………… _____

Book Has How Many Data Members........... _____ Book Has How Many Records …………….. _____

BookAuthor Has How Many Data Members _____ BookAuthor Has How Many Records …….. _____

85

54

84

SELECT *FROM Book, BookAuthor, Author

Data Members = ________Records ….…. = ________

13320

No Pieces Of Info = _____________4,160

Page 54: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

54

DatabaseRelationship Spans

Page 55: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

55

"Physics Volume 1" Relationship Spans

Page 56: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

56

Query Practice II

use universityc

Page 57: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

57

Query 8

Display The Number Of Authors That Are Associated With Physics Volume I

SELECT COUNT(*)FROM Book, BookAuthorWHERE (Title = "Physics Volume 1") AND

(BookID = Book.ID);

Page 58: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

58

Query 9

Display All Of The Author & BookAuthorInformation About Book ID 86.

SELECT *FROM Author, BookAuthorWHERE (BookID = 86 ) AND

(AuthorID = Author.ID);

Page 59: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

59

Query 10

Display The Author's full name and Author ID For The Authors Of Book ID 86.

SELECT Author.ID, FullNameFROM Author, BookAuthorWHERE (BookID = 86 ) AND

(AuthorID = Author.ID);

Page 60: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

60

Query 11

Display Book ID, Titie, FullName (alpha order), Author ID Of "Beginning Software Engineering"

SELECT Book.ID, Title, FullName, Author.IDFROM Author, BookAuthor, BookWHERE (BookID = Book.ID) AND

(Title = "Beginning Software Engineering" )AND (AuthorID = Author.ID)

ORDER BY FullName;

Page 61: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

61

Import UniversityD

use universityd

Page 62: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

62

Examine Database UniversityD Tiny To Small ANSWER #25

Genre Has How Many Data Members …….._____ Genre Has How Many Records …………… _____

Book Has How Many Data Members........... _____ Book Has How Many Records …………….. _____

BookGenre Has How Many Data Members _____ BookGenre Has How Many Records …….. _____

2023

1005

2564

SELECT *FROM Book, BookGenre, Genre

Data Members = ________Records ….…. = ________

125,171,200

No Pieces Of Info = _____________62,054,400

Page 63: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

63

SELECT Title AS "Engineering Titles"FROM Book, BookGenre, GenreWHERE (BookID = Book.ID) AND

(GenreID = Genre.ID) AND(Description = "Engineering");

Query 12 - 1 Display All of The Titles, called "Engineering

Titles", that are associated with Engineering Order By Title,.

Page 64: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

64

Query 12 - 2 Pulled Data From 62,054,400 Info "Engineering Titles"

Page 65: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

65

Examine Database UniversityD Tiny To Small ANSWER #26

Author Has How Many Data Members …….._____ Author Has How Many Records …………… _____

Book Has How Many Data Members........... _____ Book Has How Many Records …………….. _____

BookAuthor Has How Many Data Members _____ BookAuthor Has How Many Records …….. _____

1665

1005

1624

SELECT *FROM Book, BookAuthor, Author

Data Members = ________Records ….…. = ________

142,689,200

No Pieces Of Info = _____________37,648,800

Page 66: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

66

Query 13

Display Book ID, Titie, FullName, Author ID Of " Automated Software Testing: Introduction, Management, and Performance " Order ByFullName

SELECT Book.ID, Title, FullName, Author.IDFROM Author, BookAuthor, BookWHERE (Title = "Automated Software Testing:

Introduction, Management, and Performance" ) AND (BookID = Book.ID) AND (AuthorID = Author.ID)

ORDER BY FullName;

Page 67: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

67

Query 13 - 2 Pulled Data From 37,648,800 Info

Page 68: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

68

User Four Major Design

Flaws

Not Looking For Additon Data Members Yet

Page 69: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

69

Four Major Design Flaws Select First In Order From Top

Page 70: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

70

Design Flaw One DeptName

Page 71: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

71

Why DeptID 1 (2 min)

A new dept might be Added Changed, or Deleted This can be accomplished by providing the administrative users with an interface to Add, Edit, Delete departments. This can be done without revising the code.

The choices can be placed in a combobox control The use would not have to Know all of the Choices.

The choices can be placed in a combobox control The use would not have to know how to Properly Spell all of the Choices.

Page 72: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

72

Why DeptID 2

The Dept might become a User Sub-System Filter Doing this with numerical values would prove faster in the selection.

The Dept might become a User Sub-System Order ByDoing this with numerical values would prove faster in the selection.

Some E-Mails, Texts, & Reports Might Be Done For A Single Dept Doing this with numerical values would prove faster in the selection.

Page 73: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

73

Why DeptID 3

The Dept might become a User Sub-System Filter Doing this with numerical values would prove faster in the selection.

The Dept might become a User Sub-System Order ByDoing this with numerical values would prove faster in the selection.

Some E-Mails, Texts, & Reports Might Be Done For A Single Dept Doing this with numerical values would prove faster in the selection.

Some E-Mails, Texts, & Reports Might Be Done For ALL Depts Doing this with numerical values would prove faster in the selection.

Page 74: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

74

Why DeptID 4

If you used both Dept & UserDept then folks could be associated with multiple depts they should not ever place two depts in the one text box.

When we get to indexing, we will find several real speed advantages of either partition.

I am sure there are other advantages!

Page 75: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

75

28

Page 76: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

76

Four Major Design Flaws Select Second In Order From Top

Page 77: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

77

Four Major Design Flaws Select Second In Order From Top

Page 78: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

78

Four Major Design Flaws Select Third In Order From Top

Page 79: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

79

Four Major Design Flaws Select Third In Order From Top

Page 80: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

80

Four Major Design Flaws Select Fourth In Order From Top

Page 81: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

81

Four Major Design Flaws Select Fourth In Order From Top

Page 82: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

82

Update User & BookClass Diagrams

TomH-Database-Design-1.xlsx

Page 83: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

83

Complete TomH-Database-Design-1.xlsx - 36

Page 84: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

84

Update User & BookClass Diagrams

TomH-Database-Design-1.xlsx

Page 85: Database Design 1 - Trinity Universitycarme.cs.trinity.edu/thicks/3321/Lecture-PDF/Database-Design-1.pdf · 3 Student-Database-Design-1.docx Rename TomH-Database-Design-1.docx Using

85