Chapter 12: Manipulating data

In all previous chapters we’ve been writing SELECT queries. We queried nicely structured data to gether insights, but how this data end up in a database?


In real life, you might not always have a nicely structured dataset to work with. Time constraints, new research idea – it means you’ll have to take care of structuring the data yourself.

We’ve already been doing this – every CTE (Common Table Expression aka subquery) is an attempt to structure the data for our research. In the case of a giant unstructured dataset (for example, raw server logs) it’s better to cache a CTE – to save a subquery result set as a proper table.

What you’ll learn

There’re 4 major commands in SQL – SELECT, UPDATE, DELETE and INSERT.

I guess it’s straightforward what each command does. If you already have a nicely structured Data Warehouse at your company, you’ll be writing SELECT queries 99% of the time (the number varies depending on your role, of course).

There’s still this 1% where you need to insert, update or delete records from the database. That’s exactly what you’ll learn in this chapter. Let’s go! 🚀

Anatoli Makarevich, author of SQL Habit About SQL Habit

Hi, it’s Anatoli, the author of SQL Habit. 👋

SQL Habit is a course (or, as some of the students say, “business simulator”). It’s based on a story of a fictional startup called Bindle. You’ll play a role of their Data Analyst 📊 and solve real-life challenges from Business, Marketing, and Product Management.

SQL Habit course is made of 13 chapters (you’re looking at one atm) that contain 271 bite-sized lessons and exercises. All of them have a real-life setting and detailed explanations. You can immediately apply everything you’ve learned at work. 🚀

The 2nd part of the course is called Practice. It’s made of standalone exercises based on multiple datasets – E-commerce, Finance and Meditation app a-la Headspace or Calm. Practice exercises are harder than in the main course. They’ll get you ready for any challenge at work or an interview. 💪


4.98 54 reviews
Miles Tomlinson
Egor, Key Data Solutions Director @, former Consultant @ BCG
Ksenia, Customer Experience Practice Manager @ Bain
“well worth the money”

Fluent in SQL in a month

Master Data Analysis with SQL with real life examples from Product Management, Marketing, Finance and more.