
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
Explore a university database setup in DataGrip, with students, instructors, courses, and registrations, and begin writing select and aggregate queries while planning to create tables with SQL.
Learn to select specific columns in PostgreSQL by avoiding the star, retrieving only the id, or choosing id, first name, and last name with comma-separated syntax.
Sort records with order by to arrange query results by age in ascending or descending order, and apply multiple order by clauses such as first name then age for tie-breaks.
Mastering PostgreSQL covers limit and offset to control query results, illustrating how to fetch the five oldest students and paginate results using order by age desc, limit, and offset.
Mastering PostgreSQL: learning by real examples explains the is null operator, why equal to null fails, and how to use is null and is not null to filter records.
Learn how the and and or operators work in where statements to combine conditions. Use examples to filter students by name and age, and mix and or to refine results.
Explore the not operator in PostgreSQL to negate where conditions, with examples such as selecting students whose name is not Tom and using is not null for null checks.
Learn how the between operator in the where clause filters by a range, such as age between 21 and 25, and verify it matches the equivalent condition.
Learn how the any and sum operators in PostgreSQL mirror the in operator, using an age example with arrays [18, 25, 27] and age = any or age = sum.
Learn to use column and table aliases in PostgreSQL, rename a column with the as operator, and shorten table references with aliases like est and sd to simplify complex queries.
Explore the distinct operator to retrieve unique values, demonstrated by selecting distinct first names from the students table, showing how duplicates affect the result.
Learn how to use the upper and lower functions to transform student first names to uppercase and lowercase, with practical PostgreSQL examples.
Explore the initcap function to capitalize the first letter of strings in PostgreSQL queries, and apply it to student IDs by selecting and displaying properly capitalized values.
Explore the left string operator in PostgreSQL, extracting the first three characters from a string to create a short name column.
Explore the substring operator in PostgreSQL, including left and right operators, and extract a middle section by selecting the second to fourth characters from a student's first name.
Learn to use the length operator in PostgreSQL to measure string length, compute letters in first names, and order results by name length with practical examples from student.
Apply the PostgreSQL replace function to swap substrings in a column, demonstrated by replacing st with sdu in student ids and viewing the updated results.
Convert data types using the cast function, transforming integers to decimals or decimals to strings. Apply explicit type cast, such as cast age as varchar, to avoid argument type errors.
Explore PostgreSQL trim operators to remove spaces from leading, trailing, or both sides, with practical examples like trimming student first names before saving to the database.
Explore aggregates by performing calculations on tables, such as sum, count, and average ages, to return a single value like minimum or maximum, with practical real examples to follow.
Master the max operator in PostgreSQL by replacing min with max. See how to select the maximum age from students to identify the oldest.
Use the sum operator to total a column, illustrated by summing student ages and transaction amounts to yield a total like 198.
Use the average operator in SQL to compute the mean age from the students table, returning the result as average age (e.g., 24.75).
Explore the count operator, an aggregate function tallying rows. See examples counting all students and those named Matt, with where to refine by date, year, or name.
Use the filter clause in PostgreSQL to count students by age groups in a single query. Alias the results for a clean, readable table for reporting systems.
Explore grouping by multiple columns in PostgreSQL, counting instances by combinations of first and last name, and extend grouping to additional columns for complex analyses.
Learn to filter groups by aggregates using the having clause in PostgreSQL, with an age-count example to return groups with multiple instances.
Learn how the over operator enhances aggregation by displaying per-row results, solving group by limitations with average age calculations for all students.
Combine two tables using the union operator, ensure identical columns and names, and learn that union removes duplicates, as shown with student and instructor names.
Learn how to use a left join to merge course registrations with student names, applying on conditions to pull first names from the students table while handling nulls and duplicates.
Learn how the inner join merges two tables on a matching condition and omits non-matching rows, unlike the left join example with students and course registrations.
This is a course intended for software engineers and data analysts that want to learn more about Relational Databases and SQL It covers both basic and advanced SQL concepts and theories. The course is intended for both Junior and Senior Level Engineers and is purely focused on SQL and writing queries.
PostgreSQL will be used in this course. But the theories you learn can be applied in any Relational Database such as SQL Server or MySql
All the sections are explained by one or more examples. I used a sample database that had students, courses, registrations and instructors records. Learning by doing examples is a much better technique than just studying a theory.
This course contains lectures and exercises. You'll get immediate practice on all of the different topics and features that you learn!
You will learn about:
Selecting Data
Aggregate Functions
Built in Functions
Joins
Dates
Schema and Data
CRUD Operations
Transactions
Arrays in Postgres
JSONs in Postgres
And More!
Data is the core of an application. Any application that you see on your phone or on your website uses some storage somewhere. Having a good database design and queries is very crucial for any application. This course focuses mainly on the querying part.
At the end of the course, you should be able to:
Master basic query syntax and functionality: Students will learn the syntax of basic SQL queries, including SELECT, FROM, WHERE, GROUP BY, and ORDER BY. They will also gain an understanding of how to filter and sort data, and how to use basic functions and operators.
Develop proficiency in advanced querying techniques: Students will learn how to write more complex queries, including subqueries, inner and outer joins, and aggregations. They will also learn how to use advanced functions and operators such as CASE statements, window functions, and regular expressions.
Optimize queries for performance: Students will learn how to optimize queries for faster execution, including indexing strategies, query planning and execution, and common performance issues to avoid.
Apply queries to real-world scenarios: Students will learn how to apply their query skills to solve real-world problems. They will also explore best practices for data modeling and query design to ensure their queries are accurate and efficient.