As the amount of the data grows exponentially and terms such as big data become mainstream, the need to handle all this data has increased. Database skills have become some of the most sought-after in the job market today. SQL, which stands for Structured Query Language and is used for relational databases (RDBMS), is one of those skills. In fact, according to Indeed, SQL is mentioned in more job postings than Python, Java, C++, or PHP.

Let’s take a look at the basics of SQL and its abilities. I used MySQL Workbench, which can be found here, and some NFL salary data to make it more understandable. If you want to practice online without installing software, you can use W3Schools.

SQL serves the four main functions of relational databases: create, read, update, and delete. First of all, we let’s make two tables: one for player information and another for salary information, using the “create” statement. We do this by specifying the column name, its data type (integer, variable character, etc), and its definition (i.e. null means the field can be empty).

Now that we have our tables, we need to add records to work with. Using the “insert” statement, I added some players to the player table, and some player salaries to the salary table. Notice how I specified the table, fields, and values we are inserting.

Let’s take a look at what our data looks like, finding this using the “select” statement. I combined two queries into one image for simplicity.

Sometimes we need to pull data from multiple tables, like matching players and their salaries; this is where joins come in handy. A left join returns all the rows in the left table, and matches it with corresponding values in the right table. In contrast, an inner join only returns rows where there is a match in both tables, meaning it will only return rows that are present in both the players and salary table.

Notice the difference: our left join returned all players, even though Chris Borland and Brett Favre are retired and do not have a matching salary. In contrast, they did not show up in our inner join.

Now let’s say we want to view the average salary by position. We can use the AVG function to average the salary, then “group by” position. And if we want to be able to reference this query later on, we can create a view, which saves the query as a virtual table.

Last but not least, if you must destroy everything, drop is the command for you.

Go forth and have no fear.

*About: Divya Parmar is a recent college graduate working in IT consulting. For more posts every week, and to subscribe to his blog, please click here.*

© 2019 Data Science Central ® Powered by

Badges | Report an Issue | Privacy Policy | Terms of Service

**Most Popular Content on DSC**

To not miss this type of content in the future, subscribe to our newsletter.

- Book: Statistics -- New Foundations, Toolbox, and Machine Learning Recipes
- Book: Classification and Regression In a Weekend - With Python
- Book: Applied Stochastic Processes
- Long-range Correlations in Time Series: Modeling, Testing, Case Study
- How to Automatically Determine the Number of Clusters in your Data
- New Machine Learning Cheat Sheet | Old one
- Confidence Intervals Without Pain - With Resampling
- Advanced Machine Learning with Basic Excel
- New Perspectives on Statistical Distributions and Deep Learning
- Fascinating New Results in the Theory of Randomness
- Fast Combinatorial Feature Selection

**Other popular resources**

- Comprehensive Repository of Data Science and ML Resources
- Statistical Concepts Explained in Simple English
- Machine Learning Concepts Explained in One Picture
- 100 Data Science Interview Questions and Answers
- Cheat Sheets | Curated Articles | Search | Jobs | Courses
- Post a Blog | Forum Questions | Books | Salaries | News

**Archives:** 2008-2014 |
2015-2016 |
2017-2019 |
Book 1 |
Book 2 |
More

**Most popular articles**

- Free Book and Resources for DSC Members
- New Perspectives on Statistical Distributions and Deep Learning
- Time series, Growth Modeling and Data Science Wizardy
- Statistical Concepts Explained in Simple English
- Machine Learning Concepts Explained in One Picture
- Comprehensive Repository of Data Science and ML Resources
- Advanced Machine Learning with Basic Excel
- Difference between ML, Data Science, AI, Deep Learning, and Statistics
- Selected Business Analytics, Data Science and ML articles
- How to Automatically Determine the Number of Clusters in your Data
- Fascinating New Results in the Theory of Randomness
- Hire a Data Scientist | Search DSC | Find a Job
- Post a Blog | Forum Questions

## You need to be a member of Data Science Central to add comments!

Join Data Science Central