
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
learn what a database is, focusing on relational databases and SQL, with Postgres in examples, and compare spreadsheets versus databases in terms of multi-user access, size, and data integrity.
Discover how schemes organize tables in a database, using a logical row and column structure to store records and fields, with data types ensuring integrity and storage optimization.
Install PostgreSQL 16 on your system, set up pgadmin4, create the dvdrental database, and restore data from dvdrental.tar to practice SQL locally.
Learn SQL fundamentals by querying tables in a relational database, applying filters and ordering data. Remove duplicates, limit results, and explore your first aggregation function.
Learn to write select queries, choose columns with an asterisk or specific names, and specify the source table with from, using practical pgadmin exercises.
Explore adding comments to SQL queries using per-line comments with two hyphens and block comments with slash-asterisk, and review practical examples in pgadmin 4 on the actors and film tables.
Learn to rename query result columns with the as alias, leaving table definitions intact, with practical examples from film and payment tables.
Use the distinct command to return non-duplicate rows for selected columns, removing duplicates from a table like the district values in the address table; explore practical examples in pgAdmin 4.
Learn to filter data with the where clause using multiple conditions and operators like =, !=, >, <, >=, <=, with text in quotes and numbers unquoted.
Explore how to filter data using and, or, and not operators to combine conditions, negate expressions, and write clearer, maintainable queries with practical examples.
Explore how to filter ranges with the between operator in SQL, applying it to numeric amounts and date values in the payments table, with practical examples using pgAdmin 4.
Learn to use the in operator to filter values and replace or with concise syntax, returning districts such as Santa Catarina and Rio Grande do Sul with less code.
Master the sql like operator to filter text with patterns. Use percent and underscore wildcards and ilike nuances for starts with, ends with, and length checks with real-world examples.
Sort query results by one or more columns with order by, choose ascending or descending options, with default ascending when not specified, and apply multi-column sorts.
Learn how to use the limit command to restrict query results, apply with order by to fetch top rows, and improve performance on large tables in Postgres.
Learn to use the count function to tally rows, count values, and count distinct values with filters, as shown with 603 addresses and 378 distinct districts.
Practice using basic SQL commands with four exercises across different databases to reinforce fundamentals and consolidate learning.
Explore how to group data, apply aggregation functions, and filter aggregation results to analyze datasets in SQL.
Learn how the group by command groups values and applies aggregation functions like count, max, and average, with practical examples from payments and addresses.
Apply max, min, avg, and sum aggregation functions in SQL by grouping by customer ID. Compute per-customer metrics, filter February payments, and sort by total amount to identify top customers.
Learn how to filter data from aggregation using the having clause and distinguish it from where. See practical examples of grouping by customer id, with average payments and total payments.
Build on SQL fundamentals and aggregation as you learn to join data across tables and union datasets.
Use inner join to combine two tables by a join condition, returning only matching rows. Alias tables and columns to avoid ambiguity, then join city and country for full addresses.
Master how left joins combine two tables, returning all rows from the left table and nulls for missing right-table matches, with practical examples from customers, addresses, and rentals.
Use right join to return all rows from the right table and matching rows from the left, with nulls for non-matches; swap table order to convert to a left join.
Learn how a full join combines left and right joins to return all rows, with nulls for missing matches, as shown by the customer and address example.
Explore the cross join, a join that combines all combinations of rows from two tables, with cautions about potential results errors and its limited practical use.
Learn to use the union command to combine queries with matching columns and types. Use union to remove duplicates; apply parentheses for order by and limit to ensure performance.
Discover how union all preserves duplicates and improves performance when combining query results, and practice its syntax with practical examples in pg admin 4.
Build on your basics and intermediates of sql as you prepare to master more advanced sql topics in the upcoming sections.
Master string functions in SQL, starting with concat and the pipe pipe symbol in Postgres, and applying length, upper, lower, trim, ltrim, and rtrim to data.
Explore SQL string functions, including replace, substring, position, repeat, left, and right, with practical address-table examples and ilike filtering to build text-processing skills.
Explore date and time functions in SQL, including current date, current time, and current timestamp, and learn to format with to_char and extract units.
Explore date trunc function and time arithmetic in Postgres, including adding or subtracting intervals. Learn datediff, at time zone conversions, and practical rental date examples.
Learn SQL mathematical functions by performing addition, subtraction, multiplication, and division on the amount field, and apply round, ceil, floor, and abs with practical pgadmin 4 queries.
Learn SQL mathematical functions, including power and caret exponentiation, sqrt for square roots, and random with range scaling and floor rounding, plus Pgadmin 4 practical examples.
Learn how to use the cast function in Postgres to convert field types, with examples converting varchar to integer and to date or timestamp, and using :: as alternate syntax.
Learn how the nullif function returns null when a field equals a value, helping avoid division by zero. Grasp the difference between null and blank values and their sql comparisons.
Explore how the coalesce function returns the first non-null value among parameters to replace nulls with another field or a fixed value, using address two and phone numbers as examples.
Learn to use the case conditional in SQL to return values based on conditions, with else and case when, and categorize customers by payments into gold, silver, or bronze.
Proceed to the final section to explore advanced SQL concepts and deepen your knowledge. Rate the course and share feedback to help other students and improve the content.
Explore subqueries within other queries— in where, joins, and selects— using not in with aliases; compare performance with joins and group by to count rentals.
Learn how common table expressions, declared with the with command and the as keyword, reuse subqueries and allow multiple ctes to simplify SQL queries and improve readability.
Learn how the exists operator checks a subquery for at least one row. Filter films via tables and aliases, and contrast with not exists for films have not been rented.
Declare the window function and use over to define partition by and order by, then perform calculations on the subset of rows related to the current line.
Learn window functions in sql: use row_number to assign per-partition numbers, rank and dense_rank for ordered positions, and apply partitions by category to compare rentals and movies.
Use lead and lag window functions to fetch next or previous row values within a partition and apply windowed aggregations such as sum, average, min, and max ordered by date.
Master data analysis with SQL by applying practical queries to McQueen dealership's exclusive database and advance your SQL skills through data analysis with SQL.
Learn how to work with SQL for real with this course!
In recent years the data area has grown a lot and has been in great demand, the SQL language has been one of the requirements in several professional areas outside the technological scope, for example in some companies in the areas of marketing, finance, HR, they use SQL to carry out analyzes and make decisions! Learning SQL nowadays is essential to increase your chances in the job market.
You will learn with an effective method, from basic to advanced and understand SQL by applying it in practice with practical examples, and you will be ready to apply it immediately in the real world. In this course we will use the PostgreSQL database to execute our queries, but this knowledge can be applied to any database that uses SQL, such as MySQL, Oracle, SQL Server, Redshift...
What will you learn:
Concepts about Databases, schemes and tables
Basic and Intermediate SQL (WHERE command, ORDER BY command, Logical Operators, Conditionals)
Group data with aggregate functions using the GROUP BY command
Filter aggregated data with HAVING command
Perform all types of SQL JOINs (Inner, Left, Right, Cross, Full...)
String functions
Date and Time functions
Mathematical functions
Subqueries
CTEs (Common Table Expressions)
Window Functions
SQL Advanced Topics
Performance Improvements on Queries
Let's learn together, from basic to advanced of SQL! Check out the free preview videos for more information about the complete guide!