Download presentation
Presentation is loading. Please wait.
Published byKyla Brim Modified over 9 years ago
1
Access Patterns we have seen
2
We review some of the common patterns we have used. IMPORTANT NOTE: SQL is given for informational purpose only. We have not covered SQL but used the Query Builder instead.
3
Table IDABC 1a1b15 2a1b18 3a1b27 4a1b22 5a1b21 6a2b17 7a2b18 8a3b20
4
What we want: summing for distinguished column of another column ASumOfC a123 a215 a30
5
SQL query SELECT Table1.A, Sum(Table1.C) AS SumOfC FROM Table1 GROUP BY Table1.A;
6
Query Builder Manipulation Create Query Choose Table1 Select column A Select column C Totals (GroupBy default) Sum for column C
7
Table IDABC 1a1b15 2a1b18 3a1b27 4a1b22 5a1b21 6a2b17 7a2b18 8a3b20
8
What we want: Counting for distinguished column BCountOfB b14 b24
9
SQL SELECT Table1.B, Count(Table1.B) AS CountOfB FROM Table1 GROUP BY Table1.B;
10
Query Builder Manipulation Create Query Select Table1 Select column B Totals (GroupBy) For second column B choose count
11
Table2 (DebateResults) IDwinnerloserforced 1121 2212 3133 4322 5414 6144 7150
12
What we want: count wins for each debater winnerCountOfwinner 14 21 31 41
13
SQL SELECT Table2.winner, Count(Table2.winner) AS CountOfwinner FROM Table2 GROUP BY Table2.winner;
14
Query Builder Manipulation Create Query Choose Table2 Select winner column twice Totals (GroupBy) For second winner column: Count
15
Table2 (DebateResults) IDwinnerloserforced 1121 2212 3133 4322 5414 6144 7150
16
What we want: count faults FaulterCountOfFaulter 12 21 51
17
Add calculated field for Faulters: subquery What do we want for the subquery?
18
Create Faulter column from Loser column Faulterforced 21 12 14 50
19
SQL SELECT Table2.loser AS Faulter, Table2.forced FROM Table2 WHERE (((Table2.loser)<>[forced]));
20
Query Builder Manipulation Create Query select loser column; rename to Faulter; condition <>[forced] select forced column (for checking result) name subquery: Faults
21
Reminder: What we want FaulterCountOfFaulter 12 21 51
22
SQL SELECT Faults.Faulter, Count(Faults.Faulter) AS CountOfFaulter FROM Faults GROUP BY Faults.Faulter;
23
Query Builder Manipulation Create Query Choose subquery Faults Select Faulter column twice Totals (GroupBy) select Count for second
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.