Presentation is loading. Please wait.

Presentation is loading. Please wait.

Access Patterns we have seen. We review some of the common patterns we have used. IMPORTANT NOTE: SQL is given for informational purpose only. We have.

Similar presentations


Presentation on theme: "Access Patterns we have seen. We review some of the common patterns we have used. IMPORTANT NOTE: SQL is given for informational purpose only. We have."— Presentation transcript:

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

12 What we want: count wins for each debater winnerCountOfwinner

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

16 What we want: count faults FaulterCountOfFaulter

17 Add calculated field for Faulters: subquery What do we want for the subquery?

18 Create Faulter column from Loser column Faulterforced

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

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


Download ppt "Access Patterns we have seen. We review some of the common patterns we have used. IMPORTANT NOTE: SQL is given for informational purpose only. We have."

Similar presentations


Ads by Google