<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nerdi.mind on Medium]]></title>
        <description><![CDATA[Stories by Nerdi.mind on Medium]]></description>
        <link>https://medium.com/@MKarpinska?source=rss-cdf903ac224------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*F9gIZRCDLkJPB6zdWSqzhA.jpeg</url>
            <title>Stories by Nerdi.mind on Medium</title>
            <link>https://medium.com/@MKarpinska?source=rss-cdf903ac224------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 07:30:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@MKarpinska/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Mastering Window Functions: How to Analyze Data Like a Pro with SQL]]></title>
            <link>https://towardsdev.com/mastering-window-functions-how-to-analyze-data-like-a-pro-with-sql-45c5d5e36387?source=rss-cdf903ac224------2</link>
            <guid isPermaLink="false">https://medium.com/p/45c5d5e36387</guid>
            <category><![CDATA[sql-queries]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[window-functions]]></category>
            <category><![CDATA[sql]]></category>
            <dc:creator><![CDATA[Nerdi.mind]]></dc:creator>
            <pubDate>Thu, 13 Apr 2023 17:08:51 GMT</pubDate>
            <atom:updated>2025-08-28T09:12:07.159Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*IFdUXJWDjfeebQYq9HTFEw.png" /><figcaption>Photo by <a href="https://unsplash.com/es/@antonjphotos?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Anton Jansson</a> on <a href="https://unsplash.com/photos/mTIer0UVf2k?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Window functions in SQL are a powerful tool that allows you to perform complex analysis on your data without having to create intermediate tables. In this article, we’ll explore the basics of window functions, how they work, and provide examples of SQL queries to help you understand how to use them.</p><p><strong>What are Window Functions?</strong></p><p>A window function is a way to perform a calculation across a set of rows that are related to the current row. The set of rows is called a “window,” and the calculation is performed on the window as a whole, rather than on each individual row. Window functions can be used to compute running totals, moving averages, and more.</p><p><strong>How do Window Functions Work?</strong></p><p>Window functions are used in conjunction with the OVER clause, which defines the window over which the calculation is performed. The window is defined by specifying the rows that should be included in the window. This can be done by using a range of rows, a specific set of rows, or by using a partition to group the rows.</p><p>Here are some examples of SQL queries that demonstrate how to use window functions:</p><p><strong><em>1. Calculate the running total of sales for each customer:</em></strong></p><p>Assuming we have a sales table with columns <em>customer_id</em>, <em>sale_date</em>, and <em>sale_amount</em>, we can use the following query to calculate the running total of sales for each customer:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*meo6OylKpmwi2yC1KPOA1g.png" /></figure><p>This query uses the OVER clause with the PARTITION BY and ORDER BY clauses to define the window over which the calculation is performed. The PARTITION BY clause partitions the data by <em>customer_id</em>, and the ORDER BY clause orders the data by <em>sale_date</em>. The SUM function then calculates the running total of sales for each customer.</p><p><strong><em>2. Calculate the moving average of sales for each month:</em></strong></p><p>Assuming we have a sales table with columns <em>month </em>and <em>sale_amount</em>, we can use the following query to calculate the moving average of sales for each month:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FiVZU5K8J1yhpLFDDv43NA.png" /></figure><p>This query uses the OVER clause with the ORDER BY clause to order the data by month. The ROWS BETWEEN clause defines the window over which the calculation is performed. In this case, we’re calculating the moving average of sales for each month, so we’re using the window of the current row and the two preceding rows.</p><p><strong><em>3. Rank customers based on their total sales:</em></strong></p><p>Assuming we have a sales table with columns <em>customer_id </em>and <em>sale_amount</em>, we can use the following query to rank customers based on their total sales:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*sFwBf7UtlBa4bS04MXRB2A.png" /></figure><p>This query uses the OVER clause with the ORDER BY clause to order the data by the sum of <em>sale_amount </em>in descending order. The RANK function then assigns a rank to each customer based on their total sales.</p><p><strong><em>4. Calculate the percentage of total sales for each customer:</em></strong></p><p>Assuming we have a sales table with columns <em>customer_id </em>and <em>sale_amount</em>, we can use the following query to calculate the percentage of total sales for each customer:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dqFbNhMm7RKZTrPxTOOA1g.png" /></figure><p>This query uses the OVER clause with the PARTITION BY clause to partition the data by <em>customer_id</em>. The SUM function then calculates the total sales for each customer, and the percentage of total sales is calculated by dividing the sale_amount by the total sales and multiplying by 100.</p><p>In conclusion, window functions are a powerful tool in SQL that can be used to perform complex analysis on your data. By using the OVER clause and defining the window, you can calculate running totals, moving averages, ranks, and percentages of total values. With these examples of SQL queries, you should be able to start using window functions in your own data analysis projects.</p><p>Follow me on @just.analyze.this, where I also share my passion for data analytics.</p><p>Thank you and have a nice day!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45c5d5e36387" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/mastering-window-functions-how-to-analyze-data-like-a-pro-with-sql-45c5d5e36387">Mastering Window Functions: How to Analyze Data Like a Pro with SQL</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Your Data Analyst Interview: How to Prepare for SQL Questions and More]]></title>
            <link>https://medium.com/@MKarpinska/mastering-your-data-analyst-interview-how-to-prepare-for-sql-questions-and-more-9b471561ad40?source=rss-cdf903ac224------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b471561ad40</guid>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[interview-tips]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-analyst]]></category>
            <dc:creator><![CDATA[Nerdi.mind]]></dc:creator>
            <pubDate>Thu, 13 Apr 2023 16:45:55 GMT</pubDate>
            <atom:updated>2023-04-15T21:09:55.503Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LvwI3k6clPGMw0hIzDLfCw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@elisa_ventur?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Elisa Ventur</a> on <a href="https://unsplash.com/photos/bmJAXAz6ads?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>As a data analyst, preparing for an interview can be daunting, especially if you’re not sure what to expect. To help you land your dream job, here are some tips on the best way to prepare for an interview as a data analyst.</p><p><strong>1. Know the job description and the company</strong></p><p>Before you go to an interview, make sure you read and understand the job description. Pay attention to the required skills, experience, and responsibilities. Research the company to learn more about their culture, products, and competitors. This will help you tailor your answers to show how your skills and experience fit the position and the company.</p><p><strong>2. Review your resume and portfolio</strong></p><p>Take the time to review your resume and portfolio, and be prepared to discuss your experience and projects in detail. Practice answering questions about your data analysis skills, data visualization techniques, and problem-solving approach. Highlight your achievements and how they can be applied to the position you’re interviewing for.</p><p><strong>3. Brush up on your SQL skills</strong></p><p>As a data analyst, SQL is likely a crucial skill for your role. Be sure to brush up on your SQL skills, including basic and advanced queries, subqueries, and joins. Practice writing SQL queries and optimizing them for performance. Be prepared to explain your SQL approach and show how you would use SQL to solve specific data problems.</p><p><strong>4. Prepare for behavioral questions</strong></p><p>Employers often ask behavioral questions to assess how you would react in specific situations. Prepare for these types of questions by thinking about times when you’ve faced challenges or solved problems. Be sure to show how you approached the situation, what actions you took, and the results you achieved.</p><p><strong>5. Practice, practice, practice</strong></p><p>The more you practice, the more confident you will feel during the interview. Practice answering common interview questions with friends, family, or a career counselor. Record yourself and watch your body language and tone. Use mock interview software to simulate a real interview experience.</p><p>In conclusion, preparing for an interview as a data analyst can be challenging, but with the right approach, you can increase your chances of landing the job. Be sure to know the job description and the company, review your resume and portfolio, brush up on your SQL skills, prepare for behavioral questions, and practice, practice, practice. With these tips, you’ll be ready to showcase your data analysis skills and land your dream job.</p><p>Follow me on @just.analyze.this, where I also share my passion for data analytics.</p><p>Thank you and have a nice day!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b471561ad40" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Start writing SQL queries — Part III]]></title>
            <link>https://towardsdev.com/start-writing-sql-queries-part-iii-a8e5bde0aff3?source=rss-cdf903ac224------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8e5bde0aff3</guid>
            <category><![CDATA[arithmetic-operations]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[operators]]></category>
            <dc:creator><![CDATA[Nerdi.mind]]></dc:creator>
            <pubDate>Sat, 23 Apr 2022 21:03:01 GMT</pubDate>
            <atom:updated>2023-04-15T21:08:29.740Z</atom:updated>
            <content:encoded><![CDATA[<h3>Start writing SQL queries — Part III</h3><h4>Essential for day-to-day work of a data analyst</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*Y_VS20KzjK_-qgUFJux3kA.png" /></figure><p>After reading the previous articles <a href="https://towardsdev.com/start-writing-sql-queries-part-ii-ea591330de0e"><em>“Start writing SQL queries”</em></a><em> </em>, you now know how to extract data from a table, filter the table output using comparison operators and other advanced operators such as AND, OR, IN, BETWEEN, LIKE, IS NULL, and filter using their negation. So, you know how to filter the results to only a few records that you really need. Great! In this article, we will focus on arithmetic operators which are essential tools for a data analyst (note: as a bonus, we will also cover aliases and the distinct expression).</p><p>The <strong>arithmetic operators</strong>. They are used to perform calculations and arithmetic operations such as subtraction, addition, division, multiplication, modulus (It is used to get the remainder when one data is divided by another), etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/193/1*RN97YFn48_YtKuf0-7OebA.png" /><figcaption>Arithmetic operators</figcaption></figure><p>To better understand the working of arithmetic operators, let us use an examples.</p><ul><li>The operator ‘<strong>+</strong>’ (<strong>addition </strong>operator) is used to perform addition operations on the operands.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*c3FLoOubRXHS3ueADagRCQ.png" /><figcaption>Example of <strong>addition operator</strong></figcaption></figure><p>In the above query, besides using the addition operator, we also used aliases (we add ‘result of addition’ and ‘total price’). <strong>Aliases </strong>are simply temporary names for field, column or table. A temporary name exists for the duration of a query. An alias is assigned using the AS keyword. Below is the same example but without using the alias. As you will see, the query result is same as previous one but the output column now has no name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*t7PrhtaZfGz06A8IRjCxPA.png" /><figcaption>Example of <strong>addition operator (no alias)</strong></figcaption></figure><ul><li>The operator ‘<strong>-</strong>’ (<strong>subtraction </strong>operator) is used to perform subtraction operations on operands. Result is the difference between the operands.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*gc3TVjrY6VCvx4K2VS8fuA.png" /><figcaption>Example of <strong>subtraction operator</strong></figcaption></figure><ul><li>The operator ‘<strong>/</strong>’ (<strong>division </strong>operator) is used to divide one expression or number by another.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*PMpp6aFqPzuXL04_EMXAKw.png" /><figcaption>Example of <strong>division operator</strong></figcaption></figure><p>As you may have noticed, there is an expression in the above query that we have not discussed in previous articles, to be specific: <strong>DISTINCT</strong>. The SELECT statement in SQL allows you to read all data from one or more columns. This command can potentially display duplicate rows. To avoid this, we can simply add DISTINCT after the SELECT word. The SELECT DISTINCT command selects unique rows from a database table. In the example discussed above, we refer to the order table. If we did not use the DISTINCT statement then duplicate product ids would be displayed. The product id would appear as many times as there were orders with this product. Below is an example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/499/1*20QGUThWXFHghb8v7srHgg.png" /><figcaption>Example of <strong>DISTINCT</strong></figcaption></figure><ul><li>Now we will look at the operator ‘<strong>*</strong>’ (<strong>multiplication </strong>operator). It is use to perform <strong>multiplication</strong> of data items.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*y1gDnMWHJ8_yxMu_UH_Fuw.png" /><figcaption>Example of <strong>multiplication operator</strong></figcaption></figure><ul><li>The operator ‘<strong>%</strong>’ (<strong>modulus </strong>operator) returns the remainder of one number divided by another. An example of using the modulus operator could be checking whether the selected number is even or odd. If a number when divided by 2 gives a remainder of 1, it is an odd number, and if when divided by 2 it gives a remainder of 0, it is an even number. Below is an example of such an implementation.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*crveXzI3HC2e84t-bN_c1A.png" /><figcaption>Example of <strong>modulus operator</strong></figcaption></figure><ul><li>Important comment! <strong>NULL </strong>value and arithmetic operators. If you perform any arithmetic operations with NULL, the entire expression will be evaluated as NULL (<a href="https://towardsdev.com/start-writing-sql-queries-part-ii-ea591330de0e">As a reminder</a>, a NULL value means that the value is unknown. A NULL value is different from a blank or null value).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*DNIn5fQxr4tk_CG7kj_wQg.png" /><figcaption>Example of <strong>NULL and arithmetic operators</strong></figcaption></figure><p><strong>Congratulations, you just learned about the most important arithmetic operators! </strong>Stay tuned to explore the aggregation functions in the upcoming article. This is an important subject because a common data analyst problem is summarizing data without actually retrieving it. The SQL language uses aggregate functions for this task. It allows you to simply create reports or data analysis. These functions can calculate the number of rows in a table, retrieve the sum of values, or find the largest, smallest, or average value in a column. See you around!</p><p>Follow me on @just.analyze.this, where I also share my passion for data analytics.</p><p>Thank you and have a nice day!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8e5bde0aff3" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/start-writing-sql-queries-part-iii-a8e5bde0aff3">Start writing SQL queries — Part III</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Start writing SQL queries — Part II]]></title>
            <link>https://towardsdev.com/start-writing-sql-queries-part-ii-ea591330de0e?source=rss-cdf903ac224------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea591330de0e</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[sql-queries]]></category>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Nerdi.mind]]></dc:creator>
            <pubDate>Thu, 07 Apr 2022 14:24:10 GMT</pubDate>
            <atom:updated>2023-04-15T21:07:20.231Z</atom:updated>
            <content:encoded><![CDATA[<h3>Start writing SQL queries — Part II</h3><h4>Essential for day-to-day work of a data analyst</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*qdWTOx9pl81GAHpKIXSCVg.png" /></figure><p>In the article <a href="https://medium.com/@MKarpinska/start-writing-sql-queries-part-i-b66b1cf23625"><em>“Start writing SQL queries”</em></a> , you learned about the world of data and the basics of working with SQL, which is an essential language for a data analyst to extract or aggregate data. You used comparison operators, AND operator, OR operator and understood the importance of adding parentheses to conditions in WHRE clause. It’s time to explore other elements of SQL. In this part, we will continue with the topic of operators.</p><ul><li>Let’s start with the <strong>IN</strong> operator. The IN operator is shorthand for many OR conditions. It accepts a list of values separated by commas and placed in parentheses. Allows you to retrieve records that satisfy the condition that at least one value in the list must be equal to the operand.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*Rw2m7KqXj0Sq5O0zmVk3cw.png" /><figcaption>Example of <strong>IN </strong>operator</figcaption></figure><p>The IN operator can also contain another SELECT statement inside the parentheses (Subquery), this is a more advanced topic which will be discussed in future articles.</p><ul><li>The <strong>BETWEEN</strong> operator allows you to define a range to which the given value belongs. The range is inclusive: end values and begin values are included.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*NWDSgrNrzEwInZc5BSuwIg.png" /><figcaption>Example of <strong>BETWEEN </strong>operator</figcaption></figure><ul><li>The <strong>LIKE </strong>operator checks whether the specified string matches a defined pattern. This operator is commonly used with two special characters: <strong><em>% </em></strong>and <strong><em>_</em></strong>. The <strong><em>%</em> </strong>wildcard represents any number of any character. The<strong><em> _</em> wildcard </strong>represents exactly one occurrence of any character. Here’s a practical application:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*DbcJL7tOdI86LyPYw_m-dg.png" /><figcaption>Example of <strong>LIKE </strong>operator</figcaption></figure><ul><li><strong>IS NULL</strong> operator</li></ul><p>Let’s start by specifying the <strong>NULL </strong>value. SQL NULL means that we do not have a value for the field. If the table column allows NULL to be used, it means that we can insert a new record or update an existing one without adding a value. Whether or not the selected column accepts NULL values is determined by the table definition. This function can be useful when we do not know what the value will be and we need a temporary placeholder. An example can be the customer’s address — maybe the customer has just created an online account and doesn’t want to give his address. In such case, we can replace the field value with NULL. When customer makes an order and submits address, we can update this field.</p><p>To be clear, NULL is not the same as empty text written as ‘’ (two apostrophes next to each other) or zero.</p><p>The standard comparison operators (=, &gt;, &lt;, &lt;&gt;, !=, &gt;=, &lt;=) will not work for NULL values. Because NULL value specifies no value, we cannot explicitly determine if e.g. NULL &gt; 3. In this case we need IS NULL operator. The IS NULL condition allows you to filter records for which the selected field has no value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*Bg9OOf0n-fgeZsJMplK9Dg.png" /><figcaption>Example of <strong>IS NULL</strong> operator</figcaption></figure><ul><li>The <strong>NOT </strong>operator can be added to a WHERE clause to negate the condition that is placed after it. Examples of the use of the NOT in combination with already learned operators, such as IN, LIKE, BETWEEN and IS NULL are given below.</li></ul><p><strong>NOT IN</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*aratCygdCbQTi3dlEB0CUw.png" /><figcaption>Example of <strong>NOT IN </strong>operator</figcaption></figure><p><strong>NOT BETWEEN</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*XnN6bGxvcRcM-J_jrjzq7Q.png" /><figcaption>Example of <strong>NOT BETWEEN</strong> operator</figcaption></figure><p><strong>NOT LIKE</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*gjRQTJS5sd7F6nIiQw591A.png" /><figcaption>Example of <strong>NOT LIKE</strong> operator</figcaption></figure><p><strong>IS NOT NULL</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*lpriLV23P3nxEJPZGYljwQ.png" /><figcaption>Example of <strong>IS NOT NULL</strong> operator</figcaption></figure><p><strong>Congratulations, you are now on your next step towards mastering the basics of writing SQL queries!</strong> You are now able to extract data from a table, filter table output using comparison operators and other advanced operators such as AND, OR, IN, BETWEEN, LIKE, IS NULL, and filter using their negation. You can be proud of yourself. I recommend you to read the next part of this article, which will contain information about arithmetic operators, aggregate functions, and the part of SQL syntax that you might not be familiar with GROUP BY.</p><p>Follow me on @just.analyze.this, where I also share my passion for data analytics.</p><p>Thank you and have a nice day!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea591330de0e" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/start-writing-sql-queries-part-ii-ea591330de0e">Start writing SQL queries — Part II</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Start writing SQL queries — Part I]]></title>
            <link>https://towardsdev.com/start-writing-sql-queries-part-i-b66b1cf23625?source=rss-cdf903ac224------2</link>
            <guid isPermaLink="false">https://medium.com/p/b66b1cf23625</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[sql-beginner]]></category>
            <dc:creator><![CDATA[Nerdi.mind]]></dc:creator>
            <pubDate>Sun, 03 Apr 2022 19:50:46 GMT</pubDate>
            <atom:updated>2022-04-06T10:43:48.578Z</atom:updated>
            <content:encoded><![CDATA[<h3>Start writing SQL queries — Part I</h3><h4>Essential for day-to-day work of a data analyst</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xNzs13NsoKRP-x45sqkjxw.png" /></figure><p>The business marketplace today is a data-driven environment. Any business can be successful only if it fully leverage data. The role of data is to enable leaders to make informed decisions based on statistics, trends and facts.</p><p>Data can be collected from a variety of sources. The questions you will ask will be different depending on your aims. Hence, the collected data will be of various kinds. The many types of data include demographics, customer engagement, interests and behaviors, as well as online and offline transactional data. Such a wide range of knowledge is combined with a huge volume of data that we have to deal with. The popular solution for data storage is the relational database. A standard industry tool for reliably storing important information.</p><p>As a data analyst, you typically need to solve business problems and answer questions by extracting the desired information from the database. To achieve this, you need <strong>SQL </strong><em>(Structured Query Language).</em></p><p>A complete understanding of database design theory is not necessary to master the technique of writing SQL queries. However, it is useful in writing queries more consciously and avoiding logical errors. Therefore I recommend learning the basics as a good introduction to a SQL course. Many interesting courses can be found on <a href="https://www.udemy.com/"><em>Udemy</em></a><em>, </em><a href="https://www.skillshare.com/"><em>Skill Share</em></a><em>, Y</em><a href="https://www.youtube.com/"><em>ouTube</em> </a>and other platforms. In this post, we will focus on learning the basics of writing SQL queries that are useful for a data analyst.</p><p>One function of SQL is to perform queries on the database to retrieve the desired data/information. Basic practical examples of using queries are shown below.</p><p><strong>Basic SQL Statement</strong></p><ol><li><strong>SELECT</strong></li></ol><p>The basic SQL statement is SELECT, it allows you to retrieve data from one or more tables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/294/1*qXG6l3v55S_unufWKjQTFg.png" /><figcaption>SQL query structure</figcaption></figure><p>First, in the SELECT clause, we specify the column name that we want to display, then in the FROM clause, we specify the table from which we want to retrieve data. An example of using SELECT to extract all rows and columns from the <em>Customers </em>table is given below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*b_aLT8Jg2iKcIIHzwcgi4Q.png" /><figcaption>Example of Select</figcaption></figure><p><strong>2. WHERE</strong></p><p>It allows us to define conditions to specify which part of the database we want to retrieve.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/229/1*L2FcBTYYga810paB97l09w.png" /><figcaption>SQL query structure</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*uYLlE6p5Ra_T1OwoC0Dhqg.png" /><figcaption>Example of Where</figcaption></figure><p><strong>3. OPERATORS</strong></p><p>A condition can be specified using comparison or logical operators. Above example shows <strong>equality operator</strong>. In practice, there are many other operators that we can use. The following table contains a list of <strong>comparison operators.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zej--cdBbkQd_Ew6B6moHQ.png" /></figure><p>Common operators are: <strong>AND, OR</strong>. Example of how to use it below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*V4HWtMbZF9_ZGmbCcSC5IQ.png" /><figcaption>Example of operators <strong>and/or</strong></figcaption></figure><p>We can use several operators in one query, e.g. AND, OR. Then, regardless of the order in which we set the operators, SQL will start reading the conditions for the AND operator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Hy33SaAdJJaxndC0IOr_A.png" /><figcaption>Example of operators <strong>and/or in one query</strong></figcaption></figure><p><strong>Congratulations, you’ve taken your first steps in the SQL query!</strong> You’ve learned why extracting information from a database is important, you’ve mastered the basics of SQL structure, using SELECT, WHERE with comparison operators, AND, OR. In the next section, we will discuss other operators, including: IN, NOT IN, LIKE, NOT LIKE, Between, IS NULL as well as the data analyst’s essential, aggregate functions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b66b1cf23625" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/start-writing-sql-queries-part-i-b66b1cf23625">Start writing SQL queries — Part I</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>