Beginning SQL

Beginning SQL Beginning SQL

marjan.fesb.hr
from marjan.fesb.hr More from this publisher
20.07.2013 Views

LocationId 2 2 2 2 1 1 1 Figure 3-6 SELECT * FROM Attendance WHERE MemberAttended = 'Y' MeetingDate 2004-01-01 2004-01-01 2004-01-01 2004-01-01 2004-03-01 2004-03-01 2004-03-01 MemberAttended Y Y Y Y Y Y Y MemberId 1 3 5 6 1 3 4 SELECT * FROM MemberDetails MemberId 1 10 3 4 5 Start by linking the Location and Attendance tables: 13 FirstName Katie Susie Sandra Steve John William LastName Smith Simons Tell Gee Jones Doors SELECT * FROM Location LocationId 1 2 3 Street Main Street Winding Road Tiny Terrace SELECT Attendance.MeetingDate, Location.City FROM Attendance INNER JOIN Location ON Location.LocationId = Attendance.LocationId Extracting Information Email katie@mail.com susie@mailme.com sandra@her_mail.com steve@gee.com jj@jonesmail.org knockon@thedoors.com City Big Apple City Windy Village Big City State New State Golden State Mega State 111

LocationId<br />

2<br />

2<br />

2<br />

2<br />

1<br />

1<br />

1<br />

Figure 3-6<br />

SELECT * FROM Attendance<br />

WHERE MemberAttended = 'Y'<br />

MeetingDate<br />

2004-01-01<br />

2004-01-01<br />

2004-01-01<br />

2004-01-01<br />

2004-03-01<br />

2004-03-01<br />

2004-03-01<br />

MemberAttended<br />

Y<br />

Y<br />

Y<br />

Y<br />

Y<br />

Y<br />

Y<br />

MemberId<br />

1<br />

3<br />

5<br />

6<br />

1<br />

3<br />

4<br />

SELECT * FROM MemberDetails<br />

MemberId<br />

1<br />

10<br />

3<br />

4<br />

5<br />

Start by linking the Location and Attendance tables:<br />

13<br />

FirstName<br />

Katie<br />

Susie<br />

Sandra<br />

Steve<br />

John<br />

William<br />

LastName<br />

Smith<br />

Simons<br />

Tell<br />

Gee<br />

Jones<br />

Doors<br />

SELECT * FROM Location<br />

LocationId<br />

1<br />

2<br />

3<br />

Street<br />

Main Street<br />

Winding Road<br />

Tiny Terrace<br />

SELECT<br />

Attendance.MeetingDate,<br />

Location.City<br />

FROM Attendance<br />

INNER JOIN Location ON Location.LocationId = Attendance.LocationId<br />

Extracting Information<br />

Email<br />

katie@mail.com<br />

susie@mailme.com<br />

sandra@her_mail.com<br />

steve@gee.com<br />

jj@jonesmail.org<br />

knockon@thedoors.com<br />

City<br />

Big Apple City<br />

Windy Village<br />

Big City<br />

State<br />

New State<br />

Golden State<br />

Mega State<br />

111

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!