
{"id":15177,"date":"2022-09-06T17:44:02","date_gmt":"2022-09-06T15:44:02","guid":{"rendered":"https:\/\/careerfoundry.inbearbeitung.de\/en\/?p=15177"},"modified":"2023-10-04T18:12:32","modified_gmt":"2023-10-04T16:12:32","slug":"what-is-sql","status":"publish","type":"post","link":"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/data-analytics\/what-is-sql\/","title":{"rendered":"What is SQL? The Complete Guide"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">Although it was created in the 1970s, SQL remains one of the most popular languages today, given its proximity to how massive datasets are managed, stored, and then retrieved. Learning SQL is also an excellent entry point into more advanced programming in data science and machine learning, too. So, what is SQL exactly?<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In this article, we\u2019ll cover the basics of SQL and help you understand why being able to write SQL queries, even basic ones, is an incredibly useful and marketable skill to have in the field of data analytics. Feel free to use the clickable menu to skip to any section:<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"#what-is-sql\"><strong>What is SQL?<\/strong><\/a><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"#what-is-sql-used-for\"><strong>What is SQL used for?<\/strong><\/a><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"#benefits-of-sql\"><strong>What are the benefits of using SQL?<\/strong><\/a><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"#learn-sql\"><strong>How can I learn SQL?<\/strong><\/a><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"#best-sql-courses\"><strong>What are the best courses for learning SQL?<\/strong><\/a><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><a href=\"#takeaways\"><strong>Key takeaways<\/strong><\/a><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400;\">Let\u2019s get started!<\/span><\/p>\n<h2 id=\"what-is-sql\"><span style=\"font-weight: 400;\">1. What is SQL?<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Before we dive into the world of SQL, let\u2019s first understand how it fits into the lifecycle of data. When data is generated, it needs to be stored somewhere. Most companies use databases such as Oracle, MySQL or Microsoft Access. But raw data in a database does not lend itself easily to analysis without first being transformed. Enter SQL (pronounced \u201csequel\u201d), which stands for structured query language, a language created in 1974 by IBM to query data in <a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/data-analytics\/relational-database\/\">relational database management systems (RDBMS)<\/a>. At its simplest, this means enabling users in retrieving subsets of data, running aggregations, cleaning it, and more.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">You can also use SQL to write data to a database, but the most common use case by data analysts is to read and retrieve the specific data they need for their analysis.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In the decades since, it has become the standard for data queries: you might have encountered slightly different types of SQL syntax depending on the database you used, whether it\u2019s MySQL or <a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/data-analytics\/what-is-postgresql\/\" target=\"_blank\" rel=\"noopener\">PostgreSQL<\/a>. Most tutorials cover SQL commands such as \u201cSelect\u201d, \u201cWhere\u201d, \u201cOrder By\u201d, \u201cInsert To\u201d, as they are universally used across databases.\u00a0<\/span><\/p>\n<h2 id=\"what-is-sql-used-for\"><span style=\"font-weight: 400;\">2. What is SQL used for?<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Compared with other programming languages, SQL is much easier to learn, but difficult to master. The syntax is incredibly distinct and structured, a simple one looks like this:<\/span><\/p>\n<pre><code>SELECT column_name(s)\r\n\r\nFROM table_name\r\n\r\nWHERE condition\r\n\r\nGROUP BY column_name(s)\r\n\r\nORDER BY column_name(s)<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">But it can quickly incorporate much more complex logic through window functions. This snippet depicts how you can integrate aggregation functions within a database query:<\/span><\/p>\n<pre><code>SELECT column_name(s),\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0duration_seconds,\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0SUM(duration_seconds) OVER\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0(PARTITION BY column_name(s) ORDER BY start_time)\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0AS running_total,\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0COUNT(duration_seconds) OVER\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0(PARTITION BY column_name(s) ORDER BY start_time)\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0AS running_count,\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0AVG(duration_seconds) OVER\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0(PARTITION BY column_name(s) ORDER BY start_time)\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0AS running_avg\r\n\r\n\u00a0\u00a0FROM table\r\n\r\n\u00a0WHERE start_time &lt; 'date'<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">Some queries can run into more than a thousand lines of code! These examples demonstrate why SQL is so essential to the data analytics profession. If you are already familiar with performing data transformations and aggregations from knowledge of DataFrames in Python or in R, the logic behind SQL will come easily to you.\u00a0\u00a0<\/span><\/p>\n<p><strong>Related reading: <\/strong><a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/data-analytics\/isnull-sql\/\" target=\"_blank\" rel=\"noopener\">Exploring the ISNULL() SQL Function<\/a><\/p>\n<h2 id=\"benefits-of-sql\"><span style=\"font-weight: 400;\">3. What are the benefits of using SQL?<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">On a technical level, SQL is a language designed to let you query the data directly. This has important implications: you will experience much better performance than using other languages to achieve the same outcome. Oftentimes, you can write one line in SQL that would take many more lines of code in another language like Python. This saves analysts a lot of time to focus more on the aggregations instead of learning the ins-and-outs of a specific language.<\/span><\/p>\n<p><strong>Related watching:\u00a0<\/strong><a href=\"https:\/\/www.youtube.com\/watch?v=4fM_a_WENr4\" target=\"_blank\" rel=\"noopener\">SQL vs. Python vs. R<\/a><\/p>\n<p><span style=\"font-weight: 400;\">Having SQL in your back pocket is also beneficial for practical reasons. The vast majority of companies use it to access their massive relational databases. It is a highly portable, analytical skill relative to learning other enterprise BI tools or languages. It doesn\u2019t matter if your company uses Python or R, PowerBI or Tableau. The odds are high that they use SQL and are hiring for basic knowledge in that. Hence, learning SQL tremendously increases your competitiveness in the market. Even if SQL doesn\u2019t feature highly in the job description, many companies often choose to screen candidates with a SQL coding challenge as it is a useful way to test for coding ability.\u00a0<\/span><\/p>\n<h2 id=\"learn-sql\"><span style=\"font-weight: 400;\">4. How can I learn SQL?<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">As a beginner, the quickest way to start learning is through online programming question banks. There is little to no developer environment setup when you try coding puzzles on platforms like LeetCode, Codewars, or HackerRank. You can select questions by difficulty and work your way up to writing increasingly advanced queries. If you\u2019re stuck, you can find answers online and reverse engineer these solutions to understand the query logic better before trying again.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The added benefit of practicing through question banks is that you\u2019re likely to <a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/data-analytics\/sql-interview-questions\/\" target=\"_blank\" rel=\"noopener\">see questions that will appear in an interview\u2019s coding screen<\/a> too, so you\u2019ll gain familiarity with what to expect, both in style and difficulty level, well before you start applying for roles that require SQL.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If you are a complete beginner to programming and would like a gentler approach to learning the basics of SQL, check out <a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/data-analytics\/how-to-use-sql\/\">our guide to SQL<\/a> to learn some beginner queries. You could also check out some popular tutorials such as <\/span><a href=\"https:\/\/sqlzoo.net\/wiki\/SQL_Tutorial\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">SQL Zoo<\/span><\/a><span style=\"font-weight: 400;\"> and <\/span><a href=\"https:\/\/www.w3schools.com\/sql\/default.asp\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">W3 Schools<\/span><\/a><span style=\"font-weight: 400;\">. These interactive tutorials invite you to write SQL queries in a guided walkthrough of the basics.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If you want more direct guidance with learning SQL, there&#8217;s a bevy of <a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/data-analytics\/sql-certifications\/\">SQL certifications<\/a> out there to really deep-dive into the world of this extremely useful programming language.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The bottom line is that the best way to learn SQL is by writing it and becoming familiar with conceptualizing queries. Interacting directly with databases will help you improve both the query logic and query optimisation, which are increasingly important things to know when you need to retrieve very large datasets.<\/span><span style=\"font-weight: 400;\">\u00a0<\/span><\/p>\n<h2 id=\"best-sql-courses\"><span style=\"font-weight: 400;\">5. What are the best courses for learning SQL?<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">A quick Google search will lead you to many SQL courses and tutorials online, with free and paid options. We recommend that you take a look at this short list of courses that we have taken a closer look at for quality and depth of coverage:<\/span><\/p>\n<h3><a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/data-analytics\/best-data-analytics-bootcamps\/#careerfoundry\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">The CareerFoundry Data Analytics Program<\/span><\/a><\/h3>\n<p><span style=\"font-weight: 400;\">Our flagship 8 month data analytics course features a strong focus on databases and SQL. Check out the curriculum on <\/span><a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/courses\/become-a-data-analyst\/course-details\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">this page<\/span><\/a><span style=\"font-weight: 400;\"> (scroll down and click on \u201cData Immersion\u201d then click on \u201cAchievement 3\u201d) to see how it quickly covers the basics (filtering, summarizing, cleaning, table joins) before moving on to more complex, industry-level commands such as subqueries and common table expressions (CTEs). It finishes with a section on how to best present your SQL results to colleagues and stakeholders. This comprehensive overview enables you to be interview ready when the time comes to job search.\u00a0<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-15179 size-full\" src=\"http:\/\/careerfoundry.inbearbeitung.de\/en\/wp-content\/uploads\/2022\/08\/what-is-sql-2.jpeg\" alt=\"What is SQL? A data analyst writes code on his computer.\" width=\"1200\" height=\"600\" title=\"\" srcset=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-content\/uploads\/2022\/08\/what-is-sql-2.jpeg 1200w, https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-content\/uploads\/2022\/08\/what-is-sql-2-300x150.jpeg 300w, https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-content\/uploads\/2022\/08\/what-is-sql-2-1024x512.jpeg 1024w, https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-content\/uploads\/2022\/08\/what-is-sql-2-768x384.jpeg 768w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/p>\n<h3><a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/data-analytics\/best-data-analytics-bootcamps\/#springboard\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">The Springboard Data Analytics Bootcamp<\/span><\/a><\/h3>\n<p><span style=\"font-weight: 400;\">This 6 month online bootcamp is for professionals with prior experience working with programming tools, and best for those looking to switch roles or dive into more advanced material more quickly. The SQL component here covers the basics: best practices, database tools, the differences between structured and unstructured databases, and includes more advanced material with Mode SQL.\u00a0<\/span><\/p>\n<h3><a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/data-analytics\/best-data-analytics-bootcamps\/#general-assembly\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">The General Assembly Data Analytics Course<\/span><\/a><\/h3>\n<p><span style=\"font-weight: 400;\">This shorter one week course (or ten weeks part-time) provides a lighter introduction to data analytics. Its beginner-friendly curriculum provides hands-on experience with the popular BI tool Tableau as well as some SQL knowledge. Students work to integrate their newfound knowledge into creating a capstone project that can be added to their analytics portfolio. As this program is relatively short, it\u2019s best for students who are curious about data analytics, or for professionals looking to upskill and learn new tools to apply to their work.\u00a0<\/span><\/p>\n<h2 id=\"takeaways\"><span style=\"font-weight: 400;\">6. Key takeaways<\/span><\/h2>\n<p><i><span style=\"font-weight: 400;\">What is SQL? <\/span><\/i><span style=\"font-weight: 400;\">We\u2019ve taken a look at the history behind SQL and how its important role in querying relational databases has led to its immense popularity in the decades since. The best way to learn SQL is through hands-on experience, but it can be overwhelming to know where to get started given the wide range of resources online. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">We hope the resources suggested here can kickstart your journey into the world of SQL, whether your interest stems from a career change into analytics, or if you would like to use your newfound skills to add more value at work.\u00a0<\/span><\/p>\n<p>Has this piqued your interest in learning more about analytics roles and the field of data analytics in general? Why not try out this <a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/short-courses\/become-a-data-analyst\/?popup-tracking=WYSDN-short-course-DAT\" target=\"_blank\" rel=\"noopener\">free, self-paced data analytics course<\/a>? You may also be interested in the following articles:<\/p>\n<ul>\n<li><a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/data-analytics\/freelance-data-analyst\/\">How to Become a Freelance Data Analyst<\/a><\/li>\n<li><a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/data-analytics\/google-data-analytics-certification-vs-careerfoundry-data-analytics-program\/\">Google Data Analytics Certification vs. CareerFoundry Data Analytics Program: Comparison Guide<\/a><\/li>\n<li><a href=\"https:\/\/careerfoundry.inbearbeitung.de\/en\/blog\/data-analytics\/business-systems-analyst\/\">What is a Business Systems Analyst?<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we\u2019ll cover the basics of SQL and help you understand why being able to write SQL queries, even basic ones, is an incredibly useful and marketable skill to have in analytics.<\/p>\n","protected":false},"author":168,"featured_media":15178,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_lmt_disableupdate":"yes","_lmt_disable":"","footnotes":""},"categories":[3],"tags":[],"class_list":["post-15177","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-analytics"],"acf":{"homepage_category_featured":false},"modified_by":"Matthew Deery","_links":{"self":[{"href":"https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-json\/wp\/v2\/posts\/15177","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-json\/wp\/v2\/users\/168"}],"replies":[{"embeddable":true,"href":"https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-json\/wp\/v2\/comments?post=15177"}],"version-history":[{"count":5,"href":"https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-json\/wp\/v2\/posts\/15177\/revisions"}],"predecessor-version":[{"id":29325,"href":"https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-json\/wp\/v2\/posts\/15177\/revisions\/29325"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-json\/wp\/v2\/media\/15178"}],"wp:attachment":[{"href":"https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-json\/wp\/v2\/media?parent=15177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-json\/wp\/v2\/categories?post=15177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerfoundry.inbearbeitung.de\/en\/wp-json\/wp\/v2\/tags?post=15177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}