{"id":718,"date":"2018-06-06T03:24:44","date_gmt":"2018-06-06T00:24:44","guid":{"rendered":"http:\/\/kusuaks7\/?p=323"},"modified":"2026-05-22T12:40:48","modified_gmt":"2026-05-22T12:40:48","slug":"know-sql-in-2018","status":"publish","type":"post","link":"https:\/\/www.experfy.com\/blog\/bigdata-cloud\/know-sql-in-2018\/","title":{"rendered":"know-sql-in-2018"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"718\" class=\"elementor elementor-718\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-2b5cca31 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-eae-slider=\"93994\" data-id=\"2b5cca31\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-1a6fa161\" data-eae-slider=\"26913\" data-id=\"1a6fa161\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-450ffe1e elementor-widget elementor-widget-text-editor\" data-id=\"450ffe1e\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<strong><em>Ready to learn SQL? <a href=\"https:\/\/www.experfy.com\/training\/courses\">Browse courses<\/a> like \u00a0<a href=\"https:\/\/www.experfy.com\/training\/courses\/apache-spark-sql\">Apache Spark SQL<\/a> developed by industry thought leaders and Experfy in Harvard Innovation Lab<\/em><\/strong>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-edfa6a4 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-eae-slider=\"97444\" data-id=\"edfa6a4\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-9568a7d\" data-eae-slider=\"88673\" data-id=\"9568a7d\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-24d9e8e elementor-widget elementor-widget-image\" data-id=\"24d9e8e\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"666\" height=\"205\" src=\"https:\/\/www.experfy.com\/blog\/wp-content\/uploads\/2018\/06\/1_P4nj9fJjSeJ9-c0rwSZqlg.png\" class=\"attachment-large size-large wp-image-38389\" alt=\"\" srcset=\"https:\/\/www.experfy.com\/blog\/wp-content\/uploads\/2018\/06\/1_P4nj9fJjSeJ9-c0rwSZqlg.png 666w, https:\/\/www.experfy.com\/blog\/wp-content\/uploads\/2018\/06\/1_P4nj9fJjSeJ9-c0rwSZqlg-300x92.png 300w, https:\/\/www.experfy.com\/blog\/wp-content\/uploads\/2018\/06\/1_P4nj9fJjSeJ9-c0rwSZqlg-610x188.png 610w\" sizes=\"(max-width: 666px) 100vw, 666px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-deed5e9 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-eae-slider=\"99987\" data-id=\"deed5e9\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-5347799\" data-eae-slider=\"6224\" data-id=\"5347799\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-e733b5d elementor-widget elementor-widget-text-editor\" data-id=\"e733b5d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p id=\"f223\">As a technical recruiter I came across many positions where SQL was a critical skill. To be a Business Analyst, Data Scientist, Backend Developer, Marketing professional or UX Design Researcher understanding SQL queries can be fundamental to your work.<\/p>\n<p id=\"b913\">Let me back up.<strong>\u00a0What is SQL anyway?\u00a0<\/strong>SQL is a query language for talking to structured databases. Pretty much all databases that have tables and rows will accept SQL based queries. SQL has many flavors but the fundamentals stay the same. Professionals and amateurs alike use SQL to find, create, update and delete information from their sources of record. It can be used with a ton of different databases like MySQL, Postgres, SQL Server and Oracle. It powers the logic behind popular server-side frameworks like\u00a0<a href=\"https:\/\/medium.com\/@connorleech\/php-laravel-ruby-on-rails-and-web-frameworks-32c1e50cea2d\" target=\"_blank\" rel=\"noopener noreferrer\" data-href=\"https:\/\/medium.com\/@connorleech\/php-laravel-ruby-on-rails-and-web-frameworks-32c1e50cea2d\" data->Ruby On Rails and Laravel<\/a>. If you want to find information associated with a particular account or query what buttons users click in your app there is a good chance SQL can help you out!<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-a03aa22 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-eae-slider=\"92253\" data-id=\"a03aa22\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-f1a8874\" data-eae-slider=\"5608\" data-id=\"f1a8874\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-a3eaf93 elementor-widget elementor-widget-text-editor\" data-id=\"a3eaf93\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<blockquote id=\"c575\"><span style=\"font-size: 16px;\"><strong>SQL: Pronounced \u201cS-Q-L\u201d or \u201cSequel\u201d\u200a\u2014\u200ayou\u00a0choose.<\/strong><\/span><\/blockquote>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-7b7935f elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-eae-slider=\"44123\" data-id=\"7b7935f\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-0a0ed3a\" data-eae-slider=\"81804\" data-id=\"0a0ed3a\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-c833b08 elementor-widget elementor-widget-heading\" data-id=\"c833b08\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><h4 id=\"0fde\"><strong>SQL alternatives<\/strong><\/h4><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-4230579 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-eae-slider=\"66438\" data-id=\"4230579\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-c045633\" data-eae-slider=\"90046\" data-id=\"c045633\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-5fa1c1a elementor-widget elementor-widget-text-editor\" data-id=\"5fa1c1a\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p id=\"0fa0\">Before we hop on the SQL train to Database Town I\u2019d like to acknowledge some alternatives. You can use ORMs to query databases. ORM stands for\u00a0<strong>Object Relational Mapper<\/strong>, which is a fancy way of saying that you can write code in a programming language like PHP or Node.js that translates to SQL queries. Popular ORMs are Active Record for\u00a0<strong>Ruby On Rails<\/strong>, Eloquent for\u00a0<strong>Laravel<\/strong>\u00a0and Sequelize for\u00a0<strong>Node.js<\/strong>. All of these services allow you to write code that translates to SQL under the hood. SQL is important for building applications with these technologies.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-1f594fd elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-eae-slider=\"14531\" data-id=\"1f594fd\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-24cfe90\" data-eae-slider=\"70087\" data-id=\"24cfe90\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-499b0d2 elementor-widget elementor-widget-text-editor\" data-id=\"499b0d2\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p id=\"950f\">There are many databases that do not use SQL, such as MongoDB and GraphQL. These are newer technologies and not as widely adopted as relational databases. Relational databases have been around a very long time and power the majority of data storage on the internet. To fully appreciate\u00a0<strong>NoSQL technologies<\/strong>\u00a0and the reasons they came about it\u2019s helpful to know how relational databases and SQL work.<\/p>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-11a0f04 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-eae-slider=\"48167\" data-id=\"11a0f04\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-7e477b9\" data-eae-slider=\"19105\" data-id=\"7e477b9\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-b82aa39 elementor-widget elementor-widget-heading\" data-id=\"b82aa39\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h4 class=\"elementor-heading-title elementor-size-default\"><h4 id=\"2b16\"><strong>Create a\u00a0table<\/strong><\/h4><\/h4>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-ab9337c elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-eae-slider=\"31489\" data-id=\"ab9337c\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-e9fe469\" data-eae-slider=\"60728\" data-id=\"e9fe469\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-4b1231d elementor-widget elementor-widget-text-editor\" data-id=\"4b1231d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p id=\"1071\">The first thing to know is that relational databases (such as MySQL, SQLite or PostgreSQL) are made up of tables. One database can hold many tables and each table consists of a particular category of record. For example, in an eCommerce site we might have tables for orders, users, transactions and products. In many web applications you\u2019ll create tables through\u00a0<a href=\"https:\/\/laravel.com\/docs\/5.5\/migrations\" target=\"_blank\" rel=\"noopener nofollow noreferrer\" data-href=\"https:\/\/laravel.com\/docs\/5.5\/migrations\" data->migrations<\/a>, but it\u2019s still helpful to be able to read and write SQL create statements.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-1c08706 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-eae-slider=\"35045\" data-id=\"1c08706\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-c7934ef\" data-eae-slider=\"29805\" data-id=\"c7934ef\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-cb0be6e elementor-widget elementor-widget-text-editor\" data-id=\"cb0be6e\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div id=\"19de\"><span style=\"font-family: courier new,courier,monospace;\"><span style=\"background-color: #e6e6fa;\">create table exercise_logs ( <\/span>\n<span style=\"background-color: #e6e6fa;\">\u00a0 id integer primary key autoincrement,\u00a0 <\/span>\n<span style=\"background-color: #e6e6fa;\">\u00a0 type text, <\/span>\n<span style=\"background-color: #e6e6fa;\">\u00a0 minutes integer,\u00a0 <\/span>\n<span style=\"background-color: #e6e6fa;\">\u00a0 calories integer,\u00a0 <\/span>\n<span style=\"background-color: #e6e6fa;\">\u00a0 heart_rate integer<\/span>\n<span style=\"background-color: #e6e6fa;\">);<\/span><\/span><\/div>\n&nbsp;\n<p id=\"7409\">The above SQL statement creates a table called exercise_logs with five columns (id, type, minutes, calories and heart_rate). Each column has a specific\u00a0<a href=\"http:\/\/www.cs.toronto.edu\/~nn\/csc309-20085\/guide\/pointbase\/docs\/html\/htmlfiles\/dev_datatypesandconversionsFIN.html\" target=\"_blank\" rel=\"noopener nofollow noreferrer\" data-href=\"http:\/\/www.cs.toronto.edu\/~nn\/csc309-20085\/guide\/pointbase\/docs\/html\/htmlfiles\/dev_datatypesandconversionsFIN.html\" data->data type<\/a>, such as integer or text.<\/p>\n<p id=\"a057\">On the second line of our create statement we specify that each new record will have a unique id, known as the table\u2019s primary key.<\/p>\n<p id=\"e0aa\">The structure and definition of a database\u2019s tables is known as the database\u2019s\u00a0<strong>schema<\/strong>.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-253c499 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-eae-slider=\"85892\" data-id=\"253c499\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-89e55bc\" data-eae-slider=\"86363\" data-id=\"89e55bc\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-6640a95 elementor-widget elementor-widget-heading\" data-id=\"6640a95\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h4 class=\"elementor-heading-title elementor-size-default\"><h4 id=\"bc27\"><strong>Insert data into a\u00a0table<\/strong><\/h4><\/h4>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-d3a96ae elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-eae-slider=\"74174\" data-id=\"d3a96ae\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-07d00a6\" data-eae-slider=\"15879\" data-id=\"07d00a6\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-ab59584 elementor-widget elementor-widget-text-editor\" data-id=\"ab59584\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p id=\"8821\">To add an exercise log to our table we can write a SQL insert statement.<\/p>\n\n<div id=\"43e3\"><span style=\"font-family: courier new,courier,monospace;\"><span style=\"background-color: #e6e6fa;\">insert into exercise_logs(type, minutes, calories, heart_rate) <\/span>\n<span style=\"background-color: #e6e6fa;\">values (&#8216;biking&#8217;, 30, 100, 110);<\/span><\/span><\/div>\n&nbsp;\n<p id=\"802e\">In this example we specify the table name, exercise_logs and the columns for which we\u2019d like to insert data. After the values keyword we include the data to be inserted into the database.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-5c2b322 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-eae-slider=\"25564\" data-id=\"5c2b322\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-36c56ae\" data-eae-slider=\"24047\" data-id=\"36c56ae\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-054f8cd elementor-widget elementor-widget-heading\" data-id=\"054f8cd\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\"><h3 id=\"65d4\"><strong>Select statements<\/strong><\/h3>\n<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-57a90c6 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-eae-slider=\"94520\" data-id=\"57a90c6\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-aab3ed0\" data-eae-slider=\"72865\" data-id=\"aab3ed0\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-92fc0cb elementor-widget elementor-widget-text-editor\" data-id=\"92fc0cb\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p id=\"305c\">For many professions, querying data using SQL select statements is their primary\u00a0<strong>bread and butter.<\/strong><\/p>\n<p id=\"ae4d\">To select\u00a0<em>all records<\/em>\u00a0from a database:<\/p>\n\n<div id=\"416b\"><span style=\"font-family: courier new,courier,monospace;\"><span style=\"background-color: #e6e6fa;\">select * from exercise_logs;<\/span><\/span><\/div>\n<p id=\"e542\">To find all the activities a user engaged in and the total amount of calories they burned doing that activity you could write:<\/p>\n\n<div id=\"a709\"><span style=\"font-family: courier new,courier,monospace;\"><span style=\"background-color: #e6e6fa;\">select type, sum(calories) as total_calories <\/span>\n<span style=\"background-color: #e6e6fa;\">from exercise_logs <\/span>\n<span style=\"background-color: #e6e6fa;\">group by type;<\/span><\/span><\/div>\n&nbsp;\n<p id=\"1ed3\">You can do all kinds of funky stuff like determine the number of students had which letter grade.<\/p>\n<p id=\"e244\">You could group each of the exercises by heart rate zones.<\/p>\n\n<div id=\"1475\"><span style=\"font-family: courier new,courier,monospace;\"><span style=\"background-color: #e6e6fa;\">\/* Group the count of exercises by each heart rate zone *\/<\/span>\n<span style=\"background-color: #e6e6fa;\">select count(*),\u00a0\u00a0\u00a0 <\/span>\n<span style=\"background-color: #e6e6fa;\">\u00a0 case\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>\n<span style=\"background-color: #e6e6fa;\">\u00a0\u00a0\u00a0 when heart_rate &gt; 220 &#8211; 30 then &#8216;above max&#8217;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span>\n<span style=\"background-color: #e6e6fa;\">\u00a0\u00a0\u00a0 when heart_rate &gt; round(.9 * (220 &#8211; 30)) then &#8216;above target&#8217;<\/span>\n<span style=\"background-color: #e6e6fa;\">\u00a0\u00a0\u00a0 when heart_rate &gt; round(.5 * (220 &#8211; 30)) then &#8216;within target&#8217;<\/span>\n<span style=\"background-color: #e6e6fa;\">\u00a0\u00a0\u00a0 else &#8216;below target&#8217;\u00a0\u00a0\u00a0 <\/span>\n<span style=\"background-color: #e6e6fa;\">end as &#8216;heart_rate_zone&#8217;<\/span>\n<span style=\"background-color: #e6e6fa;\">from exercise_logs<\/span>\n<span style=\"background-color: #e6e6fa;\">group by heart_rate_zone;<\/span><\/span><\/div>\n&nbsp;\n<p id=\"7627\">SQL is very helpful for reporting purposes. It can be used to filter marketing results, find customer information, search server logs or create reporting dashboards.<\/p>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-86d95e9 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-eae-slider=\"73831\" data-id=\"86d95e9\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-f06ac57\" data-eae-slider=\"79190\" data-id=\"f06ac57\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-d6594dc elementor-widget elementor-widget-heading\" data-id=\"d6594dc\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h4 class=\"elementor-heading-title elementor-size-default\"><h4 id=\"0243\"><strong>Subqueries and\u00a0Like<\/strong><\/h4>\n<\/h4>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-83bf37c elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-eae-slider=\"28325\" data-id=\"83bf37c\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-99371cd\" data-eae-slider=\"99805\" data-id=\"99371cd\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-aa2e4d3 elementor-widget elementor-widget-text-editor\" data-id=\"aa2e4d3\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p id=\"15de\">Sometimes you\u2019d like to dynamically grab data with a query and use that result in another query. For this case we have subqueries. For example, we could have a table called\u00a0<strong>drs_favorites\u00a0<\/strong>that holds doctor recommended activities:<\/p>\n\n<div id=\"656a\"><span style=\"font-family: courier new,courier,monospace;\"><span style=\"background-color: #e6e6fa;\">\/* This is a comment *\/<\/span>\n<span style=\"background-color: #e6e6fa;\">create table drs_favorites ( <\/span>\n<span style=\"background-color: #e6e6fa;\">\u00a0 id integer primary key,\u00a0\u00a0\u00a0 \/* Unique identifier *\/<\/span>\n<span style=\"background-color: #e6e6fa;\">\u00a0 type text,\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/* Type of activity *\/<\/span>\n<span style=\"background-color: #e6e6fa;\">\u00a0 reason text\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/* Why the doctor recommends it *\/<\/span>\n<span style=\"background-color: #e6e6fa;\">);<\/span><\/span><\/div>\n<div><span style=\"font-family: courier new,courier,monospace;\"><span style=\"background-color: #e6e6fa;\">insert into drs_favorites<\/span>\n<span style=\"background-color: #e6e6fa;\">\u00a0 (type, reason) <\/span>\n<span style=\"background-color: #e6e6fa;\">\u00a0 values (&#8216;running&#8217;, &#8216;improves cardiovascular health.&#8217;);<\/span><\/span><\/div>\n&nbsp;\n<p id=\"0c7a\">For our main query we would like to find all the activities in the activity_log table that doctors recommended for improving cardiovascular health.<\/p>\n\n<div id=\"15f9\"><span style=\"font-family: courier new,courier,monospace;\"><span style=\"background-color: #e6e6fa;\">SELECT * FROM exercise_logs WHERE type IN (SELECT type FROM <\/span>\n<span style=\"background-color: #e6e6fa;\">drs_favorites WHERE reason LIKE &#8220;%cardiovascular%&#8221;);<\/span><\/span><\/div>\n&nbsp;\n<p id=\"979b\">In between the parenthesis we have a subquery that selects all the records where the word \u201ccardiovascular\u201d is included somewhere in the reason the doctor recommends it. Read more about the\u00a0<a href=\"https:\/\/www.w3schools.com\/sql\/sql_like.asp\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" data-href=\"https:\/\/www.w3schools.com\/sql\/sql_like.asp\" data->LIKE operator<\/a>. Note that SQL can use capital or lowercase letters.<\/p>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-403129d elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-eae-slider=\"18725\" data-id=\"403129d\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-6e4e41f\" data-eae-slider=\"17077\" data-id=\"6e4e41f\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-5c733e9 elementor-widget elementor-widget-heading\" data-id=\"5c733e9\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h4 class=\"elementor-heading-title elementor-size-default\"><h4 id=\"5fa8\"><strong>Conclusion<\/strong><\/h4>\n<\/h4>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-3e03cb7 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-eae-slider=\"27146\" data-id=\"3e03cb7\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-ea2b037\" data-eae-slider=\"17256\" data-id=\"ea2b037\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-427c749 elementor-widget elementor-widget-text-editor\" data-id=\"427c749\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p id=\"16d1\">That\u2019s the tip of the iceberg! The exercise code, including joins and SQL statements to talk to multiple databases are available on\u00a0<a href=\"https:\/\/github.com\/connor11528\/coding-interviews\/tree\/master\/sql\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" data-href=\"https:\/\/github.com\/connor11528\/coding-interviews\/tree\/master\/sql\" data->this Github repository<\/a>.<\/p>\n<p id=\"7a2a\">If you\u2019d like to play around with a test database and write some queries, W3schools has a SQL editor available here:<\/p>\n<a title=\"https:\/\/www.w3schools.com\/sql\/trysql.asp?filename=trysql_op_in\" href=\"https:\/\/www.w3schools.com\/sql\/trysql.asp?filename=trysql_op_in\" rel=\"nofollow noopener\" data-href=\"https:\/\/www.w3schools.com\/sql\/trysql.asp?filename=trysql_op_in\" data-><strong>SQL Tryit Editor v1.5<\/strong>\n<em>Edit description<\/em>www.w3schools.com<\/a>\n<p id=\"61ee\">Happy coding!<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>SQL is a critical skill. What is SQL anyway?&nbsp;SQL is a query language for talking to structured databases. Pretty much all databases that have tables and rows will accept SQL based queries. SQL has many flavors but the fundamentals stay the same. Professionals and amateurs alike use SQL to find, create, update and delete information from their sources of record. Understanding SQL queries can be fundamental to your work. Professionals and amateurs alike use SQL to find, create, update and delete information from their sources of record.<\/p>\n","protected":false},"author":288,"featured_media":3840,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[187],"tags":[94],"ppma_author":[1899],"class_list":["post-718","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bigdata-cloud","tag-data-science"],"authors":[{"term_id":1899,"user_id":288,"is_guest":0,"slug":"connor-leech","display_name":"Connor Leech","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","author_category":"","user_url":"","last_name":"Leech","first_name":"Connor","job_title":"","description":"Connor Leech is a Technical Master Stitcher at Stitch Labs, developing with Laravel, Javascript, and PHP. He is passionate about enabling developer productivity."}],"_links":{"self":[{"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/posts\/718","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/users\/288"}],"replies":[{"embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/comments?post=718"}],"version-history":[{"count":0,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/posts\/718\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/media\/3840"}],"wp:attachment":[{"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/media?parent=718"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/categories?post=718"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/tags?post=718"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.experfy.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=718"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}