As data analysts and data architects, we often understand that business decisions or human behavior arise from data processing in a cause-and-effect manner. However, in reality, most of our behaviors are driven by a ‘set of beliefs’ that we hold, which act as the most powerful filters in interpreting all data.
From a technical perspective, these beliefs are akin to conditions that we input into our SELECT commands. They determine what data we see and what data we ignore, regardless of whether the data is factually correct. Understanding this mechanism is crucial for analyzing both human behavior and database systems.
🧠 Beliefs as Cognitive Bias: Filtering Data with PostgreSQL
Deep-rooted beliefs (such as ‘I am not good enough’ or ‘This product must be expensive to be good’) are not just thoughts but cognitive structures that lead to ‘cognitive biases.’ In the world of databases, we can simulate this phenomenon by using WHERE conditions that severely limit our scope of data perception.
Let’s assume we have a transaction data table. However, our belief is that ‘Customers who buy product A will not buy product B.’ This belief will lead us to write a query that filters out conflicting data, causing us to miss genuine business opportunities.
💡 Example of Simulating Bias
Consider a table named sales with columns customer_id, product, and amount. Our belief is that customers who buy ‘Product A’ will not buy ‘Product B’. We can simulate this bias in PostgreSQL with the following query:
SQL
SELECT * FROM sales WHERE product = 'Product A' AND customer_id NOT IN (SELECT customer_id FROM sales WHERE product = 'Product B');
This query filters out any customers who have purchased ‘Product B’, which aligns with our belief. However, it may miss potential sales opportunities where customers might be interested in both products.
💡 Overcoming Cognitive Bias in Queries
To overcome cognitive bias in queries, we need to be aware of our beliefs and adjust our queries accordingly. For instance, we can modify the previous query to include customers who have shown interest in both products:
SQL
SELECT * FROM sales WHERE product IN ('Product A', 'Product B') GROUP BY customer_id HAVING COUNT(DISTINCT product) = 2;
This query groups customers by their purchases and selects those who have bought both ‘Product A’ and ‘Product B’, highlighting potential cross-selling opportunities.
Conclusion
Understanding the role of beliefs in shaping our decisions and behaviors is crucial for effective data analysis. By recognizing cognitive biases and adjusting our queries accordingly, we can make more informed decisions and uncover hidden opportunities in our data. Remember, the key is to be aware of our beliefs and ensure that they do not limit our perception of data.