Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Data Wrangling with SQL

You're reading from  Data Wrangling with SQL

Product type Book
Published in Jul 2023
Publisher Packt
ISBN-13 9781837630028
Pages 350 pages
Edition 1st Edition
Languages
Authors (2):
Raghav Kandarpa Raghav Kandarpa
Profile icon Raghav Kandarpa
Shivangi Saxena Shivangi Saxena
Profile icon Shivangi Saxena
View More author details

Table of Contents (21) Chapters

Preface 1. Part 1:Data Wrangling Introduction
2. Chapter 1: Database Introduction 3. Chapter 2: Data Profiling and Preparation before Data Wrangling 4. Part 2:Data Wrangling Techniques Using SQL
5. Chapter 3: Data Wrangling on String Data Types 6. Chapter 4: Data Wrangling on the DATE Data Type 7. Chapter 5: Handling NULL Values 8. Chapter 6: Pivoting Data Using SQL 9. Part 3:SQL Subqueries, Aggregate And Window Functions
10. Chapter 7: Subqueries and CTEs 11. Chapter 8: Aggregate Functions 12. Chapter 9: SQL Window Functions 13. Part 4:Optimizing Query Performance
14. Chapter 10: Optimizing Query Performance 15. Part 5:Data Science And Wrangling
16. Chapter 11: Descriptive Statistics with SQL 17. Chapter 12: Time Series with SQL 18. Chapter 13: Outlier Detection 19. Index 20. Other Books You May Enjoy

Practical exercises

Before you start with the following exercises, please ensure that you have successfully completed the database setup mentioned in the Technical requirements section.

Practical exercise 1

Create a database with the name Packt_database and then verify whether the database is created correctly:

CREATE DATABASE Packt_database;SHOW DATABASE;

Practical exercise 2

Create two tables within Packt_database, one customer and one product table, with the following columns and data types:

  • Customer table: Customer_ID, Customer_name, Customer_country, and Customer_gender
  • Product table: Product_ID, product_description, and Customer_ID
Create table packt_database.customer(
Customer_ID int primary key identity (1,1),
Customer_name varchar (255),
Customer_country varchar (255),
Customer_gender varchar (2)
);
Create table packt_database.product
(
Product_ID int primary key identity (1,1),
Product_description varchar (255),
Foreign key (Customer_ID) REFERENCES customer(Customer_ID)
);

Practical exercise 3

Add an additional column named product_cost to the product table created in the previous exercise:

ALTER TABLE packt_database.product ADD product_cost varchar(255);

Practical exercise 4

You can continue practicing the learned concepts from SQL zoo link below:

https://sqlzoo.net/wiki/SQL_Tutorial

You have been reading a chapter from
Data Wrangling with SQL
Published in: Jul 2023 Publisher: Packt ISBN-13: 9781837630028
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}