21
Databases Your Phone Bill is a database

Databases Your Phone Bill is a database …. [email protected] @mikecosgrave

Embed Size (px)

Citation preview

Page 1: Databases Your Phone Bill is a database …. m.cosgrave@ucc.ie  @mikecosgrave

Databases

Your Phone Bill is a database…

Page 2: Databases Your Phone Bill is a database …. m.cosgrave@ucc.ie  @mikecosgrave

[email protected] www.mikecosgrave.com @mikecosgrave

Page 3: Databases Your Phone Bill is a database …. m.cosgrave@ucc.ie  @mikecosgrave

[email protected] www.mikecosgrave.com @mikecosgrave

Date Time Number Calling Duration

08-02-12 14:15 5556453 5551234 2:20

Page 4: Databases Your Phone Bill is a database …. m.cosgrave@ucc.ie  @mikecosgrave

[email protected] www.mikecosgrave.com @mikecosgrave

Flat File

Date Time Number Calling Duration20-10-11 16:39 5556453 5551234 2:20

20-10-11 17:10 5556453 5553456 1:23

20-10-11 17:12 4443456 4356324 2:14

20-10-11 17:12 2345873 0044202345 1:43:15

21-10-11 02:12 4567432 5679876 2:14

21_10_11 02:15 4567432 5679876 3:45

21-10-11 08:43 4536857 189056789 3:10

Page 5: Databases Your Phone Bill is a database …. m.cosgrave@ucc.ie  @mikecosgrave

[email protected] www.mikecosgrave.com @mikecosgrave

Date Time Number Calling Duration20-10-11 16:39 5556453 5551234 2:20

20-10-11 17:10 5556453 5553456 1:23

20-10-11 17:12 4443456 4356324 2:14

20-10-11 17:12 2345873 0044202345 1:43:15

21-10-11 02:12 4567432 5679876 2:14

21_10_11 02:15 4567432 5679876 3:45

21-10-11 08:43 5556453 189056789 3:10

Name House Street Town County Number5556453

CALLS

CUSTOMERS

Page 6: Databases Your Phone Bill is a database …. m.cosgrave@ucc.ie  @mikecosgrave

[email protected] www.mikecosgrave.com @mikecosgrave

• Entities• Relationships• One to many• Records• Tables

Page 7: Databases Your Phone Bill is a database …. m.cosgrave@ucc.ie  @mikecosgrave

[email protected] www.mikecosgrave.com @mikecosgrave

Date Time Number Calling Duration20-10-11 16:39 5556453 5551234 2:20

20-10-11 17:10 5556453 5553456 1:23

20-10-11 17:12 4443456 4356324 2:14

20-10-11 17:12 2345873 0044202345 1:43:15

21-10-11 02:12 4567432 5679876 2:14

21_10_11 02:15 4567432 5679876 3:45

21-10-11 08:43 5556453 189056789 3:10

Name House Street Town County Number5556453

CALLS

CUSTOMERS

Page 8: Databases Your Phone Bill is a database …. m.cosgrave@ucc.ie  @mikecosgrave

[email protected] www.mikecosgrave.com @mikecosgrave

Date Time Number Calling Duration20-10-11 16:39 5556453 5551234 http://

www.census.nationalarchives.ie/reels/nai000888383/

20-10-11 17:10 5556453 5553456 1:23

20-10-11 17:12 4443456 4356324 2:14

20-10-11 17:12 2345873 0044202345 1:43:15

21-10-11 02:12 4567432 5679876 2:14

21_10_11 02:15 4567432 5679876 3:45

21-10-11 08:43 5556453 189056789 3:10

Name House Street Town County Number5556453

CALLS

CUSTOMERS

SELECT ALL from CUSTOMERS, CALLS where Customers.number = calls.number and call.number=5556453

Page 9: Databases Your Phone Bill is a database …. m.cosgrave@ucc.ie  @mikecosgrave

[email protected] www.mikecosgrave.com @mikecosgrave

Finding Entities and Relationships

1946 Foreign Office List – service historiesPeople, postings, etcWhat are the Entities? The relationships?Draw an ER Diagram

Page 10: Databases Your Phone Bill is a database …. m.cosgrave@ucc.ie  @mikecosgrave

[email protected] www.mikecosgrave.com @mikecosgrave

• Sample solutions to ER Diag exercise

Page 11: Databases Your Phone Bill is a database …. m.cosgrave@ucc.ie  @mikecosgrave

[email protected] www.mikecosgrave.com @mikecosgrave

1901 Census of Ireland

Page 12: Databases Your Phone Bill is a database …. m.cosgrave@ucc.ie  @mikecosgrave

[email protected] www.mikecosgrave.com @mikecosgrave

1901 Census Forms

Page 13: Databases Your Phone Bill is a database …. m.cosgrave@ucc.ie  @mikecosgrave

[email protected] www.mikecosgrave.com @mikecosgrave

1901 Census Forms

Page 14: Databases Your Phone Bill is a database …. m.cosgrave@ucc.ie  @mikecosgrave

[email protected] www.mikecosgrave.com @mikecosgrave

Here’s one I prepared earlier..1901 Census in LibreOffice BaseParts of Database• Tables• Queries• Forms• Reports

Page 15: Databases Your Phone Bill is a database …. m.cosgrave@ucc.ie  @mikecosgrave

[email protected] www.mikecosgrave.com @mikecosgrave

Query By Example

• Show QBE

Page 16: Databases Your Phone Bill is a database …. m.cosgrave@ucc.ie  @mikecosgrave

[email protected] www.mikecosgrave.com @mikecosgrave

Structured Query Language

Page 17: Databases Your Phone Bill is a database …. m.cosgrave@ucc.ie  @mikecosgrave

[email protected] www.mikecosgrave.com @mikecosgrave

Interrogating data• Individuals• Families• Buildings

– Landholder– Class of Building– List of specific out buildings

• So how would you dig out– Literacy by Age?– Literacy by occupation?– Literacy by homeownership?– Religion and home ownership?– Children not in school?– Live in servants?– Servants and class of house?

Page 18: Databases Your Phone Bill is a database …. m.cosgrave@ucc.ie  @mikecosgrave

[email protected] www.mikecosgrave.com @mikecosgrave

• SQL Exercise

Page 19: Databases Your Phone Bill is a database …. m.cosgrave@ucc.ie  @mikecosgrave

[email protected] www.mikecosgrave.com @mikecosgrave

Hollerith, 1890 Census, Hollerith Cards

Page 20: Databases Your Phone Bill is a database …. m.cosgrave@ucc.ie  @mikecosgrave

[email protected] www.mikecosgrave.com @mikecosgrave

Coding, Datatypes

Page 21: Databases Your Phone Bill is a database …. m.cosgrave@ucc.ie  @mikecosgrave

[email protected] www.mikecosgrave.com @mikecosgrave

• Coding exercise