
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
Meet your instructor Nikolai Schuler and start the 15 days of sql course, drawing on his data engineering, data science, and business intelligence background to help you reach career goals.
Maximize your SQL learning by using the Udemy tools, following a daily, hands-on, self-paced path from basics to advanced, with notes, challenges, and active q&a.
Guide beginners to pro SQL through daily topics, practical labs, and projects, covering setup, querying, grouping, joins, subqueries, views, and data manipulation.
Discover how sql interacts with databases to query, join, and update data, and why sql is a foundational, easy-to-learn skill that boosts careers in data analysis and for business analysts.
Define a database by its tables, columns, and rows, and describe how schemas organize data. Demonstrate using PostgreSQL and PgAdmin to manage databases and practice SQL.
Understand how SQL dialects differ across database systems and why PostgreSQL, closest to standard SQL, is ideal to start learning. Install PostgreSQL and PgAdmin to begin hands-on practice.
Install PostgreSQL and PgAdmin together on Windows from the official downloads, run the installer, and connect to the default server using PgAdmin to explore databases and the public schema.
Install PostgreSQL and pgAdmin on macOS, configure the database user and port, launch pgAdmin, and explore databases, schemas, and the public schema in preparation for SQL.
Set up a new database named greencycles in pgadmin, load a CQL file to create tables, and run a first query like select * from public.actor to verify the schema.
Step into the role of a data analyst for GreenCYCLES, an online movie rental shop, and learn to operate the database by writing queries and extracting insights to drive decisions.
learn the sql select keyword to query data by listing columns after select and from the table; use star to view all columns and practice executing queries in pg admin.
apply your sql knowledge by writing a select query to list customers from the rental shop database, including first name, last name, and email.
Learn to query the customer table using select, view first name, last name, and email address, fix trailing comma syntax errors, and export results to a CSV.
Learn how the order by clause sorts results by a column, with ascending or descending order. See how multiple columns provide tie-breakers, like ordering by customer id then amount.
Learn how to order a customer list by last name and then by first name in descending order using SQL, for marketing teams.
Learn to sort sql query results with order by on last_name and first_name, choose ascending or descending, and recognize using column numbers while prioritizing readability with column names.
Learn how to use select distinct to return unique values from one or more columns, remove duplicates, and view distinct rating and rental duration combinations in films.
Practice select distinct to retrieve unique prices and order them from high to low; this challenge demonstrates writing a SQL query, viewing the expected result, and learning SQL in practice.
Learn to implement select distinct to retrieve distinct payment amounts from the payment table, sort them by amount in descending order, and apply limit to cap the results.
Use the limit command at the end of your query to view a subset of rows. Pair with order by to see the latest rentals or the first four rows.
Explore the count function in SQL, using COUNT(*), COUNT(column), and DISTINCT to count rows, handle nulls, and compare results with a customer table example.
Tackle sql challenges by listing distinct districts, finding the latest rental date, and counting films and distinct customer last names. Practice using select distinct, order by, and count.
Learn SQL basics for retrieving and updating data in a database, using select from, order by, distinct, limit, and count.
Apply the where clause to filter query results by amount and text fields, using conditions after the from statement, with examples filtering zero amounts and searching names like Adam.
Apply the where clause to count payments for customer id 100 and find Erica's last name; then review results and a pgAdmin trick to run multiple queries at once.
Explore how to filter data with where operators in SQL, using greater than, less than, equals, not equals, and is null, then order results by amount in ascending or descending.
Practice applying where operators to filter rentals not returned yet, with return_date now. Write a query to list payment_id and amount for records with amount <= 2, and verify results.
Use where operators to count rentals with return_date is null using count(*), and to list payment_id and amount where amount <= 2 from payments table, ordering and combining conditions.
Master filtering by combining and or in a where clause for conditions like customer id and amount. Understand precedence and parentheses to see how results change and practice with examples.
Apply complex where clauses using and/or to fetch payments for customers 322, 346, and 354, with amounts under 2 or over 10, then order by customer ascending and amount descending.
Learn to build where clauses with and/or and parentheses to filter by customer IDs and amount ranges, then apply order by for clear results. Learn about the between keyword.
Learn to filter data with the between keyword in SQL, including endpoints, and apply to numeric and date ranges, with practical examples using payments and rentals tables.
Practice a secure SQL query to count payments on January 26 and 27, 2020 with amounts between 1.99 and 3.99, aiming to verify the expected result of 104.
Apply between to filter records by amount between 199 and 399 and by payment date, using 23:59 end times to include the full day, and count results to validate.
Master the SQL IN operator to filter by a list of values. See examples for numeric IDs and text values with quotes and not in.
Write a SQL query using an in clause to retrieve seven payments for six customers, with amounts 4.99, 7.99, and 9.99, in January 2020, to verify results.
Filter the payments table by customer ID with the in operator, narrow by amounts 4.99, 7.99, and 9.99, then use between on date for January 1 to February 1, 2020.
Master the SQL like operator for pattern matching in descriptions using _ and % wildcards, covering case sensitivity and ILIKE for case-insensitive searches in WHERE clauses.
Practice the like operator in a sql query to find movies with 'documentary' in description, and/or parentheses to count three-letter first names whose last names end with x or y.
Master the like operator to filter three-letter first names and last names ending with x or y, use parentheses for correct and/or logic, and count results.
Learn to use SQL comments and aliases to improve query readability and output clarity. Use single and multi-line comments to deactivate code, and aliases like description_of_movie for clearer results.
Master filtering data with the where clause after from, using and/or conditions, between and like patterns, null checks, and aliases for query output.
tackle the final challenges for today in the 15 days of sql masterclass, applying learned queries to three tasks. compute movie counts with saga in description and title constraints, a filtered and ordered customer list, and payments on June 1, 2020 with amount criteria.
Master data grouping in SQL by counting payments per amount, computing total amounts per customer, and applying sum and other aggregation functions to organize results.
Master sql aggregate functions to turn multiple values into a single result using sum, average, count, min, and max; apply rounding, aliases, and group by on payments.
Master aggregate functions in SQL by computing the minimum, maximum, average (rounded to two decimals), and sum of film replacement costs from the film table, with grouping insights.
Learn how to group data with the group by clause, sum amounts by customer_id, and order results using from, where, and order by in SQL.
Explore a two-query challenge using group by to identify which staff_id handles more payments and has the higher total amount, with and without zero payments, and verify results.
Group by staff id to sum amounts and count payments. Place where amount is not zero before grouping; optionally order by staff id or by the sum amount.
Group data by multiple columns to aggregate payments, using staff_id and customer_id in the select and group by, and order by count.
Explore the date function to extract dates from timestamps and master group by multiple columns to identify, for two employees, daily top sales and daily sales counts, excluding zero amounts.
Group by the payment_date and staff_id to compute sum(amount) and count(*) per day. Filter nonzero amounts and order by sum descending; aggregate filtering appears in the next lecture.
Learn to filter grouped data with the having clause after a group by, using aggregations. See examples like count(*) > 400 and sum(amount) > 200.
Tackle a having challenge that filters April 28–30, 2020 and computes the average payment by customer and date, for groups with more than one payment, ordered by average amount.
Group by customer id and payment date, filter three dates, apply date functions, round the average amount to two decimals, and use having with count(*) to filter results.
Set up a second database by downloading and importing the flight database, then practice with the bookings schema, exploring the flights and seats tables using pg admin and psql.
Master grouping and aggregating data with sum and other aggregate functions, apply group by to organize totals by customer, and use having to filter after aggregation.
Master SQL text functions to transform strings and extract data, including email providers, then learn date operations to extract month, year, and timestamps, and apply mathematical functions to numbers.
Master string functions in PostgreSQL by applying upper, lower, and length to query outputs, aliasing results, and understanding output-only changes versus database changes.
Identify customers with first or last names longer than ten characters and include their email in lowercase. Write a sql query using length and lower, then compare to the solution.
Lowercase names and emails from the customer table, filter for first or last names longer than 10 characters using length, and prepare to extract substrings with left and right.
Learn how to use the left and right string functions to extract specific letters from names, including nesting them to obtain the second or third letter, and to concatenate initials.
Extract the last five characters of email addresses and isolate the dot in the .org ending using nested left and right functions in SQL.
Learn to use SQL left and right functions to extract the last five characters of an email, isolate the dot by nesting left with right, and begin forming initials.
Extract initials from first and last names with left functions, then concatenate them using the double pipes to form the initials string, optionally adding dots and an alias.
Anonymize each email by taking the first character, adding three asterisks, and then the email provider starting with @sakilacustomer.org, and write a secure query to generate and verify the list.
Learn to anonymize emails by using left and right to extract parts, concatenate with asterisks, alias the result as anonymized email, and test lengths across providers.
Use the position function to locate the at sign in the email address, then left to extract characters and substring to isolate the first name.
Practice using position and concatenation to form name from email and last name. Write a sql query to extract first name from the email and output 'last name, first name'.
Learn to extract a first name from an email using position and left, then format with the last name via concatenation and a comma, and preview substring next.
Master the substring function to extract a middle portion from a string, using start position and optional length, with email examples and dynamic position techniques.
Practice anonymizing emails in SQL with two formats: an anonymized list, and a version using last character of first name, dot, first character of last name, three asterisks, and provider.
Explore using left and substring functions to extract and obfuscate email addresses from the customer table, combining with asterisks and position-based logic to reveal dots and last-name initials.
Explore dates and timestamps with the extract function to analyze rentals, extracting day, hour, and month from rental dates, then group, count, and sort results.
Apply the extract function to the payments table to find the month total, day-of-week total, and weekly maximum amount spent by one customer, with descriptive aliases.
Apply the extract function to derive month and day_of_week from payment dates, group by these aliases to find top month and top day of week.
Learn how to_char converts dates, timestamps, and numbers into custom text formats, enabling patterns like year-month or day-weekday. Practice applying formats in pg admin and select patterns to avoid padding.
Analyze and sum up payment amounts by grouping by day format, month-year, weekday, and time formats per company guidelines to reveal insights.
Learn to format dates with TO_CHAR, using abbreviated weekdays, day, month with leading zeros, year, and compute totals with total_payment, grouping by day, month and year, and ordering.
Discover how to use current_date and current_timestamp in sql, create and subtract intervals from dates like rental_date, and extract or format results with to_char and arithmetic.
Execute a SQL query to list all rental durations for customer_id 35 and determine the customer with the longest average rental duration, then review the solution on intervals and timestamps.
Compute rental duration as return date minus rental date for customer 35, then group by customer to average durations and order by value to find the top customer, 315.
Learn SQL's numerical operators and basic functions, from division truncation to ceiling, floor, rounding, and absolute value, via examples that adjust rental rates and label old and new values.
Use mathematical functions and operators to calculate the rental rate as a two-decimal percentage of replacement costs. List films under 4% of costs, in ascending order; solution explained next lecture.
Learn how to compute the relationship between rental rate and replacement cost by calculating a percentage, multiplying by 100 first, then rounding, while handling aliases and the where clause.
Explore the case statement in sql, mastering when-then logic, end, else handling, and condition priority to produce precise outputs like low, medium, or high amounts.
Learn to use the case statement on a flight database to bucket delays (on time if less than five minutes), handle nulls, and group results by is_late for insights.
Practice three escalating case when challenges to classify data by price tiers, seasons, and movie tiers, counting high price tickets, departures by season, and tiered movie lists.
Learn to implement case when in sql to categorize ticket prices, count results, and group by price and season, while applying filters with explicit columns.
Learn to use case when with sum to count PG and G ratings in a film table, turning matches into 1s and others into 0s, then pivot results.
Master the coalesce function to fill nulls by returning the first non-null value among actual_arrival and scheduled_arrival, including more than two values and fixed values with data types alignment.
Explore the CAST function to change a value's data type, enabling text, date, and numeric casts, with cautions like whitespace that block casting, and a preview of REPLACE.
Apply coalesce and cast to replace null rental return dates with the message not returned in the GreenCycles rental table, and practice combining coalesce with cast on timestamp fields.
Learn to replace nulls with coalesce, cast values to date or varchar to resolve data type mismatches, and manage results when ordering by rental date; prepare for the replace function.
Learn to use the replace function to clean and reshape data by replacing strings or removing characters, and cast results to integers or bigints for processing.
Discover how joins merge data from multiple tables, linking payments to customers via customer_id to reveal names. Master inner, outer, left, and right joins with practical examples.
Explore inner join theory by combining sales and bonus tables using a common reference column. Learn aliases and symmetry that keep details intact in the final result.
apply inner join to combine payments with customer names, using customer_id as the join key, then refine results by selecting specific columns, optional staff joins, and a where filter.
Explore how the full outer join returns all rows from both tables, with nulls for unmatched data. See pgAdmin example using tickets and boarding_passes to illustrate on conditions and coalesce.
Filter tickets to find those with no boarding pass by checking null boarding pass columns in an outer join, and count results to verify about 128,000 rows.
Master the left outer join by using the left table to include all rows, while nonmatching right-table rows are excluded; see aircrafts with and without flights.
Use a left outer join to find the most popular seats, ensuring all seats appear—even those never booked. Count how many times each line is chosen using functions.
Learn left outer joins by counting seat bookings from the seats table via a left join to boarding_passes, then group by seat_no and sort by count to identify top seats.
Explore the right outer join, which returns all rows from the second table and omits rows only in the first table, mirroring a left outer join when reversed.
Solve a Texas customer join challenge for phone call campaign by using a left, right, or inner join to return first name, last name, phone number, district, and unlinked addresses.
Join customers with their addresses using left or inner joins, filter by district Texas, and select first name, last name, phone, and district, plus finding addresses with no customers.
Perform joins on multiple conditions by matching two columns, such as first name and last name, to link tickets flights and boarding passes and compute the average amount per seat.
Join the ticket and flights tables on multiple conditions to calculate the average amount per seat, then round to two decimals, group by seat number, and order by the result.
Learn how to join multiple tables in SQL by combining sales, city, and country tables using inner joins, and when left joins matter, with practical pgAdmin examples.
Practice an inner join across seats, boarding_passes, and flights to determine which seat category, business, economy, or comfort, sells the most seats, by writing a query and comparing outputs.
Use an inner join from tickets to the ticket_flights bridge to connect via flight_id, then join flights to show ticket_number, passenger_name, scheduled_departure, and scheduled_arrival.
Learn to join multiple tables to target Brazilian customers, and write a query to return first_name, last_name, email, and country for all such customers.
Learn to perform left joins across customers, addresses, cities, and countries using address ID and city ID, then filter results by country Brazil.
Learn how to combine rows with union by aligning column order and data types, understand duplicates versus union all, and apply multiple unions in practice.
Explore how union combines rows from multiple tables, explains duplicates with union versus union all, and teaches using fixed values and aliases to reveal origins.
Master subqueries in the where clause to filter payments by dynamic values, like the average amount, and fetch payments by customer using a subquery with the in operator.
Explore using subqueries in where clauses to filter films by length longer than the average, and combine subqueries with inventory in a store for a more advanced challenge.
Use a subquery in where to filter films longer than the average length; group inventory by film_id in store 2 and filter with having for counts more than three times.
Master subqueries in where clauses to retrieve customer data: names for payments on January 25, 2020; names and emails for totals over 30; and California customers with totals over 100.
Solve sql challenges with subqueries to filter customers by payment date, sum amounts via group by and having, and use inner joins on address to identify California records.
Use a subquery in the from clause to calculate the total amount per customer, then compute the average lifetime spend per customer.
Practice subqueries in the from clause to compute the average daily revenue, aiming for a result like 1644.31.
Group payments by payment date and sum amounts to compute daily totals. Use a subquery in the from clause with an alias to average these totals and round the result.
Use subqueries in the select clause to return a single value, such as the average amount from payments rounded to two decimals; avoid multiple values, or limit to first row.
Calculate a difference column by subtracting each payment from the maximum payment using a subquery in the select, showing all payments with how much each row falls below the maximum.
Learn to use subqueries within a select statement to compute a difference from the maximum payment in the payment table, and explore correlated subqueries for more advanced cases.
Explore correlated subqueries in the where clause by comparing each row's sales to the city-specific average, contrasting with standard subqueries, and practice finding the highest payment per customer.
Master correlated subqueries in where clauses by solving two challenges: surface movie titles with the lowest replacement_cost by rating, and find longest titles by category with film_id and rating.
Use correlated subqueries in the where clause to find films with the lowest replacement cost by category and the longest length by rating, and explore a select clause alternative.
Explore how correlated subqueries operate in the select clause, including computing the minimum sales by city and the maximum customer spend across payments, with table aliases to illustrate the concept.
Explore correlated subqueries through practical challenges: compute total and count of payments per customer, identify films with the highest replacement cost per rating category and the category average.
Explore solutions to SQL challenges by computing customer payments (total and count) with correlated subqueries, and analyze ratings with max and average replacement costs, plus top payments via joins.
Tackle the mid-course project in 15 days of sql to solve 10 of 14 challenges, demonstrate readiness for promotion to senior data analyst, and use solution sheets and video walkthroughs.
Explore solving the first challenge by using distinct to list unique replacement costs from the film table, then identify the lowest cost by ordering results in pgAdmin.
Define replacement cost categories with case when to classify films into low, medium, and high ranges. Count films per category using group by and alias cost category, demonstrating between operators.
Solve a SQL challenge by listing film titles, their length, and category name, using joins across film, film_category, and category, filtering to drama and sports, ordered by length desc.
Count movies by category using a join from film to film category and category, group by name, and order by count, revealing sports with 74 movies as the top category.
This solution joins film, film_actor, and actor tables to count movies per actor by name, then orders results to reveal top actors, such as Susan Davis with 54 movies.
Use a left join between the address and customer tables, then filter where the customer_id is null to identify addresses not linked to any customer, revealing four unassociated addresses.
Join the payment, customer, address, and city tables, then group by city to sum amounts and sort descending, delivering Cape Coral's 221.55 as the top result.
Create a revenue overview by forming country_city formatted as country, city; join country as co; concatenate with || and a comma; group by and order ascending to find lowest sales.
Learn how to compute the average revenue per staff per customer using group by and subqueries on the payments table, identifying which staff_id yields higher average revenue.
Learn to compute the average daily revenue on Sundays by aggregating payments by date, extracting the day of the week, filtering Sundays, and using a subquery.
Explore using a correlated subquery to list films with length and replacement cost, filtering by lengths longer than the average per replacement cost group, then find the two shortest titles.
Learn to compute district-level average customer lifetime value by joining payment, customer, and address tables, then perform a two-step aggregation with a subquery to rank districts by average lifetime value.
Learn to build a SQL query that lists payments with payment_id, amount, and film category, includes a per-category total revenue via a subquery, and orders by category name and payment_id.
Construct a sql query to identify the top revenue film title per category by summing amounts, using joins, a having clause, and a correlated subquery in pgadmin.
Learn data definition and data manipulation to manage databases and tables, including creating, altering, and dropping objects, and applying constraints like primary and foreign keys with insert, update, and delete.
Create a database with the create database command, via pgAdmin or SQL, naming it like companyx, adding a comment, and using underscores or quotes for spaces, with UTF-8 default.
Learn to choose the right data types for each column, from numeric and string types to date, time, boolean, enum, and array, with zip codes and phone numbers as examples.
Learn how to define constraints when creating tables to enforce data rules, including not null, unique, default values, primary and foreign keys, and referential integrity with check constraints.
Learn how primary keys uniquely identify rows using a unique, non-null constraint, and how foreign keys reference primary keys to link tables, enabling joins and constrained table creation.
Master creating tables with the create table command, defining columns, data types, and constraints like primary key, not null, unique, and foreign keys.
Discover how to insert data into a table with insert into, specify columns, and respect data types, constraints, defaults, and serial auto-increment.
master altering tables with SQL by adding or dropping columns, changing data types, renaming columns or tables, and applying constraints like default and not null in one command.
Alter director table by changing account name to varchar(30), dropping default on last name, last name not null, adding email varchar(40), and renaming director account name column to account name.
Master alter table operations, including changing column data types to varchar 30, dropping defaults, enforcing not null, adding email varchar 40, renaming columns and tables, and exploring check constraints.
Learn to use drop and truncate in SQL to manage objects and data: drop removes a table or schema irreversibly, while truncate clears all rows from a table.
Use a check constraint to enforce a condition on inserted rows in a create table statement. Name it with a constraint and manage it via alter table.
Create songs table with primary key, default genre 'Not defined', not null song_name, price minimum 1.99, and date_check for release between today and 1st January, 1950; adjust to 0.99.
Create a songs table with a serial id key and song_name not null, enforce a price check at least 1.99, constrain release_date to today, and modify constraints with alter table.
Master the update command to modify existing rows using update, set, and optional where clauses, including example calculations and dynamic updates like lowercasing emails and changing a song's genre.
Perform two updates: raise 99-cent film rentals to 1.99 and add an initials column to the customer table (varchar(10)), then populate it with initials.
Update the film table to set rental_rate to 1.99 for 99-cent values, then add a customer initials column and populate it from first and last name initials with dots.
Learn to delete rows with delete from and a where clause, use the in operator for multiple IDs, and view deleted rows with the returning operator.
Practice the SQL delete command by removing two incorrect payments with payment_id 17064 and 17067 from a table, then review the solution.
Explore how to safely perform delete operations by first verifying with a select, using where filters, then replacing select with delete, and using returning to display deleted rows.
Create a new table with create table as from a query, using left join of customer and address on address_id to include first name, last name, email, address, and city.
Create a customer spendings table with first name, last name, and total spendings from the payments table using create table as and SQL functions and operators learned.
Create a new table by selecting and concatenating first and last names with a space, and summing payments. Group by first name and last name, then save as customer spendings.
Learn how views let you query data without duplicating storage, keep data dynamic via the underlying query, and compare views with materialized views for performance.
Learn how materialized views store data physically to boost performance of complex queries. Refresh materialized views to keep data up to date, either manually or with triggers.
Learn to create, alter, drop, and replace standard views and materialized views, perform renames of views and columns, and use create or replace for views in practice.
Learn to import CSV data into a created table using PG admin, with UTF8 encoding, headers, and comma delimiters; then export data to CSV with the correct column order.
Learn SQL with the world’s best SQL course in just 15 days!
1 hour per day, for just 15 days and you will be fluent in SQL!
That’s the only course you need to completely master SQL.
You will be guided step-by-step from beginner to absolute expert in SQL.
Why is this the best course you can take?
The most comprehensive course that teaches you everthing from beginner to expert
Much more challenges & hands-on coding exercises than other courses
Much more real-life advanced topics that other courses don’t cover
By the end of this guided experience you will be so fluent in SQL to get a job and work professionally and with a lot of confidence with SQL!
This is the most comprehensive & most modern course you can find on SQL.
Here is why:
Most comprehenisve course with 14 hours video lectures and most topics
Master SQL by working on real-life challenges
Learn PostgreSQL – the most modern SQL system & easy to transfer to all other SQL dialects
We will set up two modern databases and learn everything with realistic data, so you can do everything hands-on!
Learn from a real expert - crystal clear & straight-forward
Understand everything step by step from the absolute basics to the advanced topics
Learn the practical to upskill your career or find a job with SQL
We cover every single important topic you will need including the advanced topics other courses do not cover!
Including...
GROUP BY
JOINs
Functions
UNIONs
Data manipulation & Data Definition
Views
Window functions
Grouping sets
Rollups
Transactions
Subqueries
Query optimization
Indexes and much more!
Plus, tons of practical challenges and 2 complete course projects and much more challenges than you can find anywhere else!
This course will take you all the way from beginner to being able to upskill your career and make you ready to get a job with SQL!
Check out the free video previews and enroll now!
See you inside the course!