
Exploring Common Data Access Patterns and Query Manipulation Techniques
Discover the common data access patterns and query manipulation techniques utilized in various scenarios. Dive into SQL queries and Query Builder tools to efficiently analyze and manipulate data for better insights.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
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 not covered SQL but used the Query Builder instead.
Table ID 1 2 3 4 5 6 7 8 A a1 a1 a1 a1 a1 a2 a2 a3 B b1 b1 b2 b2 b2 b1 b1 b2 C 5 8 7 2 1 7 8 0
What we want: summing for distinguished column of another column A a1 a2 a3 SumOfC 23 15 0
SQL query SELECT Table1.A, Sum(Table1.C) AS SumOfC FROM Table1 GROUP BY Table1.A;
Query Builder Manipulation Create Query Choose Table1 Select column A Select column C Totals (GroupBy default) Sum for column C
Table ID 1 2 3 4 5 6 7 8 A a1 a1 a1 a1 a1 a2 a2 a3 B b1 b1 b2 b2 b2 b1 b1 b2 C 5 8 7 2 1 7 8 0
What we want: Counting for distinguished column B b1 4 b2 CountOfB 4
SQL SELECT Table1.B, Count(Table1.B) AS CountOfB FROM Table1 GROUP BY Table1.B;
Query Builder Manipulation Create Query Select Table1 Select column B Select column B Totals (GroupBy) For second column B choose count
Table2 (DebateResults) ID 1 2 3 4 5 6 7 winner 1 2 1 3 4 1 1 loser forced 2 1 1 2 3 3 2 2 1 4 4 4 5 0
What we want: count wins for each debater winner 1 2 3 4 CountOfwinner 4 1 1 1
SQL SELECT Table2.winner, Count(Table2.winner) AS CountOfwinner FROM Table2 GROUP BY Table2.winner;
Query Builder Manipulation Create Query Choose Table2 Select winner column twice Totals (GroupBy) For second winner column: Count
Table2 (DebateResults) ID 1 2 3 4 5 6 7 winner 1 2 1 3 4 1 1 loser forced 2 1 1 2 3 3 2 2 1 4 4 4 5 0
What we want: count faults Faulter 1 2 5 CountOfFaulter 2 1 1
Add calculated field for Faulters: subquery What do we want for the subquery?
Create Faulter column from Loser column Faulter 2 1 1 5 forced 1 2 4 0
SQL SELECT Table2.loser AS Faulter, Table2.forced FROM Table2 WHERE (((Table2.loser)<>[forced]));
Query Builder Manipulation Create Query select loser column; rename to Faulter; condition <>[forced] select forced column (for checking result) name subquery: Faults
Reminder: What we want Faulter 1 2 5 CountOfFaulter 2 1 1
SQL SELECT Faults.Faulter, Count(Faults.Faulter) AS CountOfFaulter FROM Faults GROUP BY Faults.Faulter;
Query Builder Manipulation Create Query Choose subquery Faults Select Faulter column twice Totals (GroupBy) select Count for second