{"id":3284,"date":"2018-10-26T14:08:36","date_gmt":"2018-10-26T14:08:36","guid":{"rendered":"https:\/\/solutionstreet.com\/blog\/?p=3284"},"modified":"2018-10-26T14:08:36","modified_gmt":"2018-10-26T14:08:36","slug":"sql-exploration","status":"publish","type":"post","link":"https:\/\/www.solutionstreet.com\/blog\/2018\/10\/26\/sql-exploration\/","title":{"rendered":"SQL Exploration"},"content":{"rendered":"<p><a href=\"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/explorerAtitle-copy.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-3285\" src=\"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/explorerAtitle-copy-300x225.png\" alt=\"explorerAtitle copy\" width=\"600\" height=\"450\" srcset=\"https:\/\/www.solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/explorerAtitle-copy-300x225.png 300w, https:\/\/www.solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/explorerAtitle-copy.png 768w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>I\u2019m currently working in a primarily front-end role and I haven\u2019t needed to use much SQL other than an occasional basic SELECT statement. That said, having a baseline level of competency in SQL is important for any developer. To continue my growth, I decided to take a dive back into <strong>S<\/strong>tructured <strong>Q<\/strong>uery <strong>L<\/strong>anguage. My goal was to get a better grip on the basics and begin to explore some more advanced concepts. This article chronicles my exploration and provides explanations and examples for utilizing some aggregate functions as well as joins and groupings.<\/p>\n<p>&nbsp;<\/p>\n<p>Quick note before we begin: All of the SQL written in this article is \u201cstandard ANSI\u201d SQL and should work on any ANSI-compliant database. Different database engines (i.e., MySQL, PostgreSQL, Oracle) come with their own custom SQL functions, syntax, etc., that build on the ANSI standard, but it is usually best to stick to the standard unless you need some database-specific feature or function.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Getting Started<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>First, I needed sample data. Some searching led me to <a href=\"https:\/\/github.com\/datacharmer\/test_db\" target=\"_blank\" rel=\"noopener\">this database<\/a> of fake employee data. It has several tables filled with information including names, birth dates, hire dates, salaries, departments, and titles &#8211; an ideal data set to play around with.<\/p>\n<p>&nbsp;<\/p>\n<p>Next, I needed a simple way to write SQL statements and view the results. This is achieved by setting up a simple MySQL or PostgreSQL database, and using one of many free apps available for either Mac or Windows to view the schema and run queries. If you don\u2019t feel like taking the time to set up your own database but would like to follow along, you can view the schema <a href=\"https:\/\/dev.mysql.com\/doc\/employee\/en\/sakila-structure.html\" target=\"_blank\" rel=\"noopener\">here<\/a> and skip to the next section.<\/p>\n<p>&nbsp;<\/p>\n<p>If you\u2019d like to test out some SQL using this database, I would recommend starting with MySQL simply because it\u2019s easiest to set up. If you don\u2019t already have MySQL installed on your machine, follow <a href=\"https:\/\/dev.mysql.com\/doc\/mysql-getting-started\/en\/\" target=\"_blank\" rel=\"noopener\">these instructions<\/a> to get started. Once MySQL has been installed, open up a terminal (OS X) or command prompt (Windows) and clone the sample database using the following command:<\/p>\n<pre lang=\"javascript\" line=\"1\"> > git clone https:\/\/github.com\/datacharmer\/test_db\/\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Then run:<\/p>\n<pre lang=\"javascript\" line=\"1\"> > mysql < employees.sql\n<\/pre>\n<p>&nbsp;<\/p>\n<p>If the above command doesn\u2019t work, you may need to run it as the root user:<\/p>\n<pre lang=\"javascript\" line=\"1\"> > mysql < employees.sql -u root -p\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Then enter your root password. (The default is \u201cpassword\u201d.)<\/p>\n<p>&nbsp;<\/p>\n<p>You can test the installation by running:<\/p>\n<pre lang=\"javascript\" line=\"1\"> > mysql -t < test_employees_md5.sql\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Once your database is set up, you\u2019ll need a way to run some queries. <a href=\"https:\/\/www.mysql.com\/products\/workbench\/\" target=\"_blank\" rel=\"noopener\">MySQL Workbench<\/a> is the official graphical user interface (GUI) tool for MySQL and will be perfect for our purposes. After it\u2019s installed, open it up and you should see a local instance under the <em>MySQL Connections<\/em> header. Click on the instance. If prompted, enter your password. Now you should be taken to the main screen of the app. On the left sidebar, look for the <em>SCHEMAS<\/em> section, where you\u2019ll find a list of databases (or just one database). Double click <em>employees<\/em>, and the text should turn bold. Our sample database is now ready for SQL querying! You can type your queries in the Query window. Click the lightning bolt icon to execute.<\/p>\n<p>&nbsp;<\/p>\n<p>Next, I\u2019m going to go ahead and jump into some technical explanations beginning with aggregate functions. If you haven\u2019t gotten the hang of simple SELECT \/ WHERE statements yet, it might make sense to get a feel for how a basic SQL query is formatted, then come back. (<a href=\"https:\/\/www.w3schools.com\/sql\/default.asp\" target=\"_blank\" rel=\"noopener\">W3Schools<\/a> is a great place to start!) Otherwise, let\u2019s get into it.<\/p>\n<p>&nbsp;<\/p>\n<div style=\"padding: 12px; background-color: #eee9e9; line-height: 1.2; margin: 40px; border: 1px solid #ccc; border-radius: 6px; box-shadow: 1px #ccc; border-left: 5px solid #61963D;\"><span style=\"font-size: x-large; color: #61963d;\">\u201c<\/span><em>[H]aving a baseline level of competency in SQL is important for any developer.<\/em><span style=\"font-size: x-large; color: #61963d; line-height: 1.0;\">\u201d<\/span><\/div>\n<p>&nbsp;<\/p>\n<p><strong>Aggregate Functions<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>An aggregate function performs a calculation on a set of values and returns a single value. In the following section, we\u2019ll walk through some of the most commonly used SQL aggregate functions: <strong>COUNT<\/strong>, <strong>SUM<\/strong>, <strong>MAX\/MIN<\/strong>, and <strong>AVG<\/strong>. We\u2019ll also make use of <strong>ROUND<\/strong>, which, although it\u2019s not an aggregate function, will be particularly useful in conjunction with AVG.<\/p>\n<p>&nbsp;<\/p>\n<p>It is generally good practice to add <strong>AS [name]<\/strong> to the SELECT line of aggregate queries. AS is used to assign variable names to the result columns.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>COUNT()<\/strong> will return a number with the amount of rows that fit the specified criteria. It takes in an argument, but because COUNT simply returns a number of rows, that argument will often be a simple asterisk (*) which, in SQL terms, means \u201call columns\u201d. If you instead choose to pass in a specific column, any rows that have a NULL value for that column will not be counted. Here is an example from the <em>employee<\/em> database using asterisk as the argument:<\/p>\n<pre lang=\"javascript\" line=\"1\">SELECT COUNT(*) AS employee_count\nFROM employees\nWHERE birth_date > '1960-01-01';\n\nemployee_count\n117075\n<\/pre>\n<p>&nbsp;<\/p>\n<p>The query above shows us that a total of 117,075 employees were born after (but not including) January 1st, 1960.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>SUM()<\/strong>\u200a will -\u200aas you\u2019d expect\u200a - \u200areturn the sum of a numeric column. If we want to see the sum of all salaries, we would write the following query:<\/p>\n<pre lang=\"javascript\" line=\"1\">SELECT SUM(salary) AS 'salaries_totalled'\nFROM salaries;\n\nsalaries_totalled\n181480757419\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Once we add joins and grouping to the mix, SUM will become more useful. Let\u2019s come back to this one a bit later.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>MAX() \/ MIN()<\/strong> will return the maximum or minimum value of a numeric column. Let\u2019s query the salaries table once again and use MAX() to find the highest salary:<\/p>\n<pre lang=\"javascript\" line=\"1\">SELECT MAX(salary) AS 'highest_salary'\nFROM salaries;\n\nhighest_salary\n158220\n<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>AVG()<\/strong> also takes in a numeric column and returns\u200a - \u200ayou guessed it\u200a - \u200athe average of the values for that column.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>ROUND()<\/strong> is slightly different in that it takes two arguments\u200a - \u200aa column and the number of desired decimal places. It can be useful in conjunction with AVG like:<\/p>\n<pre lang=\"javascript\" line=\"1\">SELECT ROUND(AVG(salary), 2) AS 'avg_salary'\nFROM salaries;\n\navg_salary\n63810.74\n<\/pre>\n<p>&nbsp;<\/p>\n<p>which will return the average salary rounded to the nearest cent; $63,810.74 in our case.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Joins and Grouping<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>The JOIN command allows us to access data from more than one table. The syntax of a JOIN line is as follows:<\/p>\n<pre lang=\"javascript\" line=\"1\">JOIN <table_name>\nON <original_table>.<primary_key> = <table_name>.<foreign_key>\n<\/pre>\n<p>&nbsp;<\/p>\n<p>The <strong>primary key<\/strong> serves as a unique identifier for each row. It is good practice to have a primary key column on every table.<\/p>\n<p>&nbsp;<\/p>\n<p>The <strong>foreign key<\/strong> is a reference to the primary key of another table. In our case, we have an emp_no column on the <em>titles<\/em> table. This allows us to join the <em>employees<\/em> and <em>titles<\/em> tables together by matching the primary key of <em>employees<\/em> to the foreign key on <em>titles<\/em>. This key-matching occurs after the keyword, <strong>ON<\/strong>. Once a JOIN is introduced to a query, column names must be prefaced by their respective table names followed by a period.<\/p>\n<p>&nbsp;<\/p>\n<p>Generally, aggregate functions can become a lot more useful when <strong>GROUP BY<\/strong> is added to the mix. Instead of simply finding an aggregate of <em>all<\/em> values in a particular column, it allows us to be more specific. For example, using JOIN and GROUP BY we can find the number of employees with each title:<\/p>\n<pre lang=\"javascript\" line=\"1\">SELECT COUNT(*) AS 'num_of_employees', titles.title AS 'title'\nFROM employees\nJOIN titles ON titles.emp_no = employees.emp_no\nGROUP BY titles.title;\n\nnum_of_employees\ttitle\n15128\t \t\tAssistant Engineer\n115003\t \t        Engineer\n24\t \t\tManager\n97750\t \t\tSenior Engineer\n92853\t \t\tSenior Staff\n107391 \t\t        Staff\n15159\t \t\tTechnique Leader\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Now, instead of counting employees, what if we wanted to find the average salary by title?<\/p>\n<pre lang=\"javascript\" line=\"1\">SELECT AVG(salaries.salary) AS 'avg_salary', titles.title AS 'title'\nFROM salaries\nJOIN employees ON employees.emp_no = salaries.emp_no\nJOIN titles ON titles.emp_no = employees.emp_no\nGROUP BY titles.title;\n\navg_salary\ttitle\n59304.9863\tAssistant Engineer\n59508.0397\tEngineer\n66924.2706\tManager\n60543.2191\tSenior Engineer\n70470.8353\tSenior Staff\n69309.1023\tStaff\n59294.3742\tTechnique Leader\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Looks like the average salaries for each title are pretty similar at this company. (Likely a result of the randomly generated data we are using.)<\/p>\n<p>&nbsp;<\/p>\n<p>Because salaries are on their own table, we had to use another JOIN. We took the average FROM <em>salaries<\/em>, joined <em>employees<\/em> ON the <em>salaries<\/em> table, then joined <em>titles<\/em> by matching up keys with <em>employees<\/em>. Finally, we grouped by the <em>titles.title<\/em> column once again. Due to the large number of decimals in those averages, we probably could have benefited from using the ROUND function.<\/p>\n<p>&nbsp;<\/p>\n<p>For our next example, we\u2019ll count the number of employees in each department:<\/p>\n<pre lang=\"javascript\" line=\"1\">SELECT COUNT(*) AS 'employee_count', departments.dept_name AS 'dept_name'\nFROM employees\nJOIN dept_emp ON dept_emp.emp_no = employees.emp_no\nJOIN departments ON dept_emp.dept_no = departments.dept_no\nGROUP BY departments.dept_name;\n\nemployee_count\t        dept_name\n23580\t\t\tCustomer Service\n85707\t\t\tDevelopment\n17346\t\t\tFinance\n17786\t\t\tHuman Resources\n20211\t\t\tMarketing\n73485\t\t\tProduction\n20117\t\t\tQuality Management\n21126\t\t\tResearch\n52245\t\t\tSales\n<\/pre>\n<p>&nbsp;<\/p>\n<p>This one is a bit more complicated than you might expect because the <em>departments<\/em> table cannot be joined on <em>employees<\/em> as they share a <strong>many-to-many relationship<\/strong>. An employee can belong to several departments, and each department can have many employees. With a many-to-many relationship, neither table contains a foreign key for the other.<\/p>\n<p>&nbsp;<\/p>\n<p>Instead, a <strong>join table<\/strong> is used. In our case, that is <em>dept_emp<\/em>. The <em>dept_emp<\/em> table does not contain any data other than emp_no, dept_no, and the start and end dates:<\/p>\n<p><a href=\"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/image5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-3297\" src=\"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/image5-300x236.png\" alt=\"\" width=\"600\" height=\"472\" srcset=\"https:\/\/www.solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/image5-300x236.png 300w, https:\/\/www.solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/image5-1024x805.png 1024w, https:\/\/www.solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/image5-768x604.png 768w, https:\/\/www.solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/image5.png 1382w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Let\u2019s add one more piece to our previous query. If we want to only return the departments that have more than 125 employees, we would use a <strong>HAVING<\/strong> clause:<\/p>\n<pre lang=\"javascript\" line=\"1\">SELECT COUNT(*) AS 'employee_count', departments.dept_name AS 'dept_name'\nFROM employees\nJOIN dept_emp ON dept_emp.emp_no = employees.emp_no\nJOIN departments ON dept_emp.dept_no = departments.dept_no\nGROUP BY departments.dept_name\nHAVING COUNT(*) > 50000;\n\nemployee_count\t        dept_name\n85707\t\t\tDevelopment\n73485\t\t\tProduction\n52245\t\t\tSales\n<\/pre>\n<p>&nbsp;<\/p>\n<p>The way I think of HAVING is\u200a - \u200ait works just like WHERE, but it can only be used in conjunction with GROUP BY.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Types of Joins<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Until this point, every JOIN in the examples we have used has been an <strong>INNER JOIN<\/strong>. (Also known as a simple join.) This is the most common type of JOIN. It returns only the rows that have matching values in both tables.<\/p>\n<p>&nbsp;<\/p>\n<p>There are three additional types of joins, and they could all be generally characterized as OUTER joins. In each case, the keyword OUTER is optional.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>LEFT OUTER JOIN<\/strong> returns <em>all<\/em> rows from the table mentioned first (the \u201cleft\u201d table) along with the rows from the other table whose values match up with the first. The following example would return all employees, even if they don\u2019t have a title. Using an inner join would have omitted those titleless employees. (Unfortunately our sample data doesn\u2019t have any employees who are missing titles.):<\/p>\n<pre lang=\"javascript\" line=\"1\">SELECT employees.last_name, titles.title\nFROM employees\nLEFT JOIN titles ON employees.emp_no = titles.emp_no;\n<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>RIGHT OUTER JOIN<\/strong> does almost exactly the same thing, but it returns all rows from the second (\u201cright\u201d) table mentioned instead. For the visual learners, let\u2019s take the above example and flip it around using RIGHT JOIN to achieve the same result:<\/p>\n<pre lang=\"javascript\" line=\"1\">SELECT employees.first_name, titles.title\nFROM titles\nRIGHT JOIN employees ON employees.emp_no = titles.emp_no;\n<\/pre>\n<p>&nbsp;<\/p>\n<p>The third type of outer join is a FULL OUTER JOIN. This can be written like the two above examples and simply returns all rows from both tables mentioned. Matching rows will be represented as a single row, and for rows that do not have a match, the result set will have NULL for all columns of the table without a matching row.<\/p>\n<p>&nbsp;<\/p>\n<p>I found these diagrams from <a href=\"https:\/\/www.w3schools.com\/sql\/sql_join.asp\" target=\"_blank\" rel=\"noopener\">W3Schools<\/a> to be a helpful way to visualize the different types of joins:<\/p>\n<p><a href=\"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/image1.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3302\" src=\"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/image1.gif\" alt=\"\" width=\"200\" height=\"145\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/image-2.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3304\" src=\"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/image-2.gif\" alt=\"\" width=\"200\" height=\"145\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/image3.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3307\" src=\"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/image3.gif\" alt=\"\" width=\"200\" height=\"145\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/image-4.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3308\" src=\"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/image-4.gif\" alt=\"\" width=\"200\" height=\"145\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>To dig a bit deeper into joins, check out the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Join_(SQL)\" target=\"_blank\" rel=\"noopener\">Join_SQL Wikipedia<\/a> page. It contains more thorough explanations, examples, and information on less common types of joins. (This includes the <strong>CROSS JOIN<\/strong> which returns the Cartesian product of rows from the tables in the join; in other words, all possible combinations of rows.)<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Conclusion<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Going through these examples helped me gain a better understanding of SQL principles, and I hope this has been helpful for you as well. If you haven\u2019t already done so, I would encourage you to <a href=\"https:\/\/github.com\/datacharmer\/test_db\" target=\"_blank\" rel=\"noopener\">download the sample data<\/a> and set it up with a GUI tool so you can practice running queries of your own.<\/p>\n<p>&nbsp;<\/p>\n<p>Now that I feel I have a decent grasp on some of the most common SQL functions, I plan to learn about performance tuning. I see that topic come up quite a bit on my current project, and I can imagine it being incredibly useful for future endeavors.<\/p>\n<p>&nbsp;<\/p>\n<p>Happy Sequeling!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; I\u2019m currently working in a primarily front-end role and I haven\u2019t needed to use much SQL other than an occasional basic SELECT statement. That said, having a baseline level of competency in SQL is important for any developer. To continue my growth, I decided to take a dive back into Structured Query Language. My [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3284","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>SQL Exploration - Solution Street Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.solutionstreet.com\/blog\/2018\/10\/26\/sql-exploration\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Exploration - Solution Street Blog\" \/>\n<meta property=\"og:description\" content=\"&nbsp; I\u2019m currently working in a primarily front-end role and I haven\u2019t needed to use much SQL other than an occasional basic SELECT statement. That said, having a baseline level of competency in SQL is important for any developer. To continue my growth, I decided to take a dive back into Structured Query Language. My [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.solutionstreet.com\/blog\/2018\/10\/26\/sql-exploration\/\" \/>\n<meta property=\"og:site_name\" content=\"Solution Street Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-10-26T14:08:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/explorerAtitle-copy-300x225.png\" \/>\n<meta name=\"author\" content=\"Peggy Frankel\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Peggy Frankel\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2018\\\/10\\\/26\\\/sql-exploration\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2018\\\/10\\\/26\\\/sql-exploration\\\/\"},\"author\":{\"name\":\"Peggy Frankel\",\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/#\\\/schema\\\/person\\\/c4846451eff30e9514b534b2a2e01696\"},\"headline\":\"SQL Exploration\",\"datePublished\":\"2018-10-26T14:08:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2018\\\/10\\\/26\\\/sql-exploration\\\/\"},\"wordCount\":1849,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2018\\\/10\\\/26\\\/sql-exploration\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/solutionstreet.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/10\\\/explorerAtitle-copy-300x225.png\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2018\\\/10\\\/26\\\/sql-exploration\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2018\\\/10\\\/26\\\/sql-exploration\\\/\",\"url\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2018\\\/10\\\/26\\\/sql-exploration\\\/\",\"name\":\"SQL Exploration - Solution Street Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2018\\\/10\\\/26\\\/sql-exploration\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2018\\\/10\\\/26\\\/sql-exploration\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/solutionstreet.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/10\\\/explorerAtitle-copy-300x225.png\",\"datePublished\":\"2018-10-26T14:08:36+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/#\\\/schema\\\/person\\\/c4846451eff30e9514b534b2a2e01696\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2018\\\/10\\\/26\\\/sql-exploration\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2018\\\/10\\\/26\\\/sql-exploration\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2018\\\/10\\\/26\\\/sql-exploration\\\/#primaryimage\",\"url\":\"https:\\\/\\\/solutionstreet.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/10\\\/explorerAtitle-copy-300x225.png\",\"contentUrl\":\"https:\\\/\\\/solutionstreet.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/10\\\/explorerAtitle-copy-300x225.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/2018\\\/10\\\/26\\\/sql-exploration\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Exploration\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/\",\"name\":\"Solution Street Blog\",\"description\":\"Quality Software Engineering - Technology and Consulting Articles\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/#\\\/schema\\\/person\\\/c4846451eff30e9514b534b2a2e01696\",\"name\":\"Peggy Frankel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/af71ceb16f89d32c9bb825a47f8057da9283b4a27a934bf0c47cdef65ad0eb5d?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/af71ceb16f89d32c9bb825a47f8057da9283b4a27a934bf0c47cdef65ad0eb5d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/af71ceb16f89d32c9bb825a47f8057da9283b4a27a934bf0c47cdef65ad0eb5d?s=96&d=mm&r=g\",\"caption\":\"Peggy Frankel\"},\"url\":\"https:\\\/\\\/www.solutionstreet.com\\\/blog\\\/author\\\/pfrankel\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SQL Exploration - Solution Street Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.solutionstreet.com\/blog\/2018\/10\/26\/sql-exploration\/","og_locale":"en_US","og_type":"article","og_title":"SQL Exploration - Solution Street Blog","og_description":"&nbsp; I\u2019m currently working in a primarily front-end role and I haven\u2019t needed to use much SQL other than an occasional basic SELECT statement. That said, having a baseline level of competency in SQL is important for any developer. To continue my growth, I decided to take a dive back into Structured Query Language. My [&hellip;]","og_url":"https:\/\/www.solutionstreet.com\/blog\/2018\/10\/26\/sql-exploration\/","og_site_name":"Solution Street Blog","article_published_time":"2018-10-26T14:08:36+00:00","og_image":[{"url":"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/explorerAtitle-copy-300x225.png","type":"","width":"","height":""}],"author":"Peggy Frankel","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Peggy Frankel","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.solutionstreet.com\/blog\/2018\/10\/26\/sql-exploration\/#article","isPartOf":{"@id":"https:\/\/www.solutionstreet.com\/blog\/2018\/10\/26\/sql-exploration\/"},"author":{"name":"Peggy Frankel","@id":"https:\/\/www.solutionstreet.com\/blog\/#\/schema\/person\/c4846451eff30e9514b534b2a2e01696"},"headline":"SQL Exploration","datePublished":"2018-10-26T14:08:36+00:00","mainEntityOfPage":{"@id":"https:\/\/www.solutionstreet.com\/blog\/2018\/10\/26\/sql-exploration\/"},"wordCount":1849,"commentCount":0,"image":{"@id":"https:\/\/www.solutionstreet.com\/blog\/2018\/10\/26\/sql-exploration\/#primaryimage"},"thumbnailUrl":"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/explorerAtitle-copy-300x225.png","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.solutionstreet.com\/blog\/2018\/10\/26\/sql-exploration\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.solutionstreet.com\/blog\/2018\/10\/26\/sql-exploration\/","url":"https:\/\/www.solutionstreet.com\/blog\/2018\/10\/26\/sql-exploration\/","name":"SQL Exploration - Solution Street Blog","isPartOf":{"@id":"https:\/\/www.solutionstreet.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.solutionstreet.com\/blog\/2018\/10\/26\/sql-exploration\/#primaryimage"},"image":{"@id":"https:\/\/www.solutionstreet.com\/blog\/2018\/10\/26\/sql-exploration\/#primaryimage"},"thumbnailUrl":"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/explorerAtitle-copy-300x225.png","datePublished":"2018-10-26T14:08:36+00:00","author":{"@id":"https:\/\/www.solutionstreet.com\/blog\/#\/schema\/person\/c4846451eff30e9514b534b2a2e01696"},"breadcrumb":{"@id":"https:\/\/www.solutionstreet.com\/blog\/2018\/10\/26\/sql-exploration\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.solutionstreet.com\/blog\/2018\/10\/26\/sql-exploration\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.solutionstreet.com\/blog\/2018\/10\/26\/sql-exploration\/#primaryimage","url":"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/explorerAtitle-copy-300x225.png","contentUrl":"https:\/\/solutionstreet.com\/blog\/wp-content\/uploads\/2018\/10\/explorerAtitle-copy-300x225.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.solutionstreet.com\/blog\/2018\/10\/26\/sql-exploration\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.solutionstreet.com\/blog\/"},{"@type":"ListItem","position":2,"name":"SQL Exploration"}]},{"@type":"WebSite","@id":"https:\/\/www.solutionstreet.com\/blog\/#website","url":"https:\/\/www.solutionstreet.com\/blog\/","name":"Solution Street Blog","description":"Quality Software Engineering - Technology and Consulting Articles","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.solutionstreet.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.solutionstreet.com\/blog\/#\/schema\/person\/c4846451eff30e9514b534b2a2e01696","name":"Peggy Frankel","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/af71ceb16f89d32c9bb825a47f8057da9283b4a27a934bf0c47cdef65ad0eb5d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/af71ceb16f89d32c9bb825a47f8057da9283b4a27a934bf0c47cdef65ad0eb5d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/af71ceb16f89d32c9bb825a47f8057da9283b4a27a934bf0c47cdef65ad0eb5d?s=96&d=mm&r=g","caption":"Peggy Frankel"},"url":"https:\/\/www.solutionstreet.com\/blog\/author\/pfrankel\/"}]}},"_links":{"self":[{"href":"https:\/\/www.solutionstreet.com\/blog\/wp-json\/wp\/v2\/posts\/3284","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.solutionstreet.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.solutionstreet.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.solutionstreet.com\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.solutionstreet.com\/blog\/wp-json\/wp\/v2\/comments?post=3284"}],"version-history":[{"count":0,"href":"https:\/\/www.solutionstreet.com\/blog\/wp-json\/wp\/v2\/posts\/3284\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.solutionstreet.com\/blog\/wp-json\/wp\/v2\/media?parent=3284"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.solutionstreet.com\/blog\/wp-json\/wp\/v2\/categories?post=3284"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.solutionstreet.com\/blog\/wp-json\/wp\/v2\/tags?post=3284"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}