One of the most common locations for storing data is in a relational database, and the most common way to access and update these databases is by using SQL (Structured Query Language). SQL can be a very frustrating tool. It's inflexible compared to other languages, and it permits only simple operations, which often leads to convoluted code to accomplish conceptually simple tasks. There is an SQL standard, but compliance with that standard is uneven at best. In practice, one must learn standard SQL plus the idiosyncrasies of particular implementations. Despite these issues, SQL is so commonly used and being able to access data is so important that most data scientists simply must learn SQL. The good news is that learning to write basic, standard SQL queries really isn't that hard.
Recommended Books
SQL Queries for Mere Mortals
John L. Viescas
Key Features
- In-text exercises
- Answers to exercises
Key Topics
- Aggregate Functions
- Conditional Expressions
- DELETE Statements
- Driver Tables
- Expressions
- Filtering
- GROUP BY Extensions
- Grouping Data
- Handling NULLs
- History of SQL
- INSERT Statements
- Inner Joins
- Outer Joins
- Relational Databases
- SELECT Statements
- Search Conditions
- Set Operations
- Subqueries
- UPDATE Statements
- Window Functions
Description
This is a great book to read if you really want to understand SQL querying. Viescas will teach you what relational databases are and how to organize them properly, as well as everything you could want to know about querying them with SQL. This book comes with several example databases and accompanying exercises for you to practice using SQL language features. The only real downsides of this book are that some of the exercises are ambiguously worded and the book is somewhat long. Despite these downsides, this is an excellent book for both learning and reference.
Learning SQL
Alan Beaulieu
Key Features
- In-text exercises
- Answers to exercises
Key Topics
- Aggregate Functions
- Conditional Expressions
- Filtering
- Grouping Data
- Indexes and Constraints
- Joins
- Metadata
- Queries
- Set Operations
- Subqueries
- Transactions
- Views
Description
If you need to get up to speed on SQL quickly, this book is a great option. It's not as comprehensive as the top pick, and all the exercises concern the same database. However, you'll know enough SQL to be productive after reading it and it is much shorter than Viescas.