SQL ET POSTGRE 5.24 : Introduction to the section

Now that we have created the film database and inserted plenty of data into it, we can finally learn how to select data from our tables. In pgAdmin we pick the film database, right-click on it and choose Query Tool — that is where we will write all our SELECT queries from now on.

SELECT *, single column, multiple columns

We already saw the most basic form, SELECT * FROM realisateur;, which returns every column and every row of the table. The star (*) means "all columns". This is the simplest query you can run. From there, we can target one column by writing the column name instead of the star: SELECT prenom FROM realisateur; returns only the first name column with all the directors' first names.
SELECT * FROM realisateur;

SELECT prenom FROM realisateur;

SELECT prenom, nom FROM realisateur;
  • SELECT * returns all columns.
  • SELECT <col> returns one column only.
  • Comma-separate column names to select several at once.
We can also select several columns in a single query by separating their names with commas: SELECT prenom, nom FROM realisateur; returns both the first names and last names of every director. You can extend this to three, four or more columns the same way. This is the simplest form of SELECT you can write to retrieve data from a table — in the next videos we will see more advanced queries.

Summary

This section introduction covers the fundamentals of SQL SELECT queries and data retrieval techniques in PostgreSQL. Learners will master filtering with WHERE conditions and logical operators, advanced comparison functions (IN, LIKE, BETWEEN), and techniques for ordering, limiting, and selecting distinct data. The module also addresses NULL value management, column aliasing, and string concatenation in SQL.

Key points

  • SELECT queries for retrieving data from database tables
  • WHERE conditions combined with logical operators for precise filtering
  • Comparison operators: IN, LIKE, BETWEEN for advanced data filtering
  • Ordering, limiting, and selecting distinct rows in query results
  • NULL value handling and column aliasing techniques
  • String concatenation methods in SQL queries

FAQ

What SQL topics are covered in this section?

This section covers SELECT query fundamentals including WHERE filtering, logical operators, IN/LIKE/BETWEEN operators, result ordering and limiting, distinct selection, NULL value management, column aliases, and string concatenation in PostgreSQL.

What filtering techniques will I learn?

You will learn to use WHERE conditions paired with logical operators (AND, OR, NOT) and comparison operators including IN, LIKE, and BETWEEN to filter query results effectively.

How can I practice these concepts?

Each topic includes challenges and solution videos that allow you to practice and test your understanding of the SELECT query techniques covered in this section.