Bands That Departed from Vladivostok
Regional news outlets in the Russian Far East want to know which bands departed on tour from Vladivostok. Return their names without duplicates.
These PostgreSQL practice problems cover much more than basic SELECT queries. Work through joins, aggregations, window functions, table definitions, JSON data, and query optimization. You can also practice PostgreSQL-specific features where a problem calls for them. Every query runs in a real PostgreSQL database and is automatically checked using hidden data. Problems: 1,003, free: 240.
Problems in this set: 1,003, free: 240
Start with a free problemProblems found: 240
Reset filtersRegional news outlets in the Russian Far East want to know which bands departed on tour from Vladivostok. Return their names without duplicates.
The tour logistics team is mapping out trips departing from Paris, including each destination and travel time.
An Avito interview question tests whether candidates understand that applying DISTINCT to an already grouped result often changes nothing.
Gazprombank is building a daily transaction volume report for its corporate banking products. Each operation has an associated client, product category, and amount in rubles.
Rosbank's DDS layer stores contract history using SCD2. Each record version is valid over a right-open interval stored in the valid column, meaning the lower bound is inclusive and the upper bound is…
Otkritie Bank is building a risk score based on the type of operation confirmed by an OTP code.
A tour promoter needs a complete list of registered fans to send invitations to a private performance. Return the names of all fans in the database.
Otkritie Bank is analyzing two-factor authentication flows to find where customers enter OTP codes most often. This will help improve UX and assess the load on the SMS gateway.
Skypro uses a daily dashboard to show how many students are actively studying. Each course enrollment has an access period: the start date is inclusive, and the end date is exclusive.
Microsoft Teams wants to identify its most active users: those who sent the most messages in August 2022. Find the top two senders and return sender_id and message_count.
Skypro's finance team is closing out the last full calendar month and wants revenue totals for each course. The current date is fixed at 2024-04-15, so the last full month is March 2024.
The band's management wants to know how often the tour features club shows because that affects the marketing budget. Count all concerts held at venues of type Club.
DISTINCT ON keeps one row for each distinct combination of expressions, but ORDER BY determines which row is selected. Without suitable sorting, you may get an arbitrary record instead of the latest or highest-valued one. Define which row should win within each group.
PostgreSQL supports convenient casts using ::, but casting cannot turn invalid text into a valid number or date. An unexpected value may cause the query to fail. Check the source data type and consider which input formats are valid before applying a conversion.
JSONB stores structured JSON data rather than an ordinary text string. When extracting nested values, it matters whether you need a JSON value or its text representation. Check the returned type and consider what should happen when a key or nested field is missing.
EXPLAIN ANALYZE actually executes the statement and collects runtime statistics. This matters especially for statements that modify data. When reading the output, compare estimated and actual row counts as well as execution times instead of focusing only on operation names.
Yes. Your queries execute in PostgreSQL rather than a simulated SQL environment. Their results are automatically compared with expected results using hidden data. This allows you to practice standard SQL concepts alongside PostgreSQL-specific syntax and behavior when the problem requires it.
Free PostgreSQL problems: 240. After signing in, the free plan lets you solve up to 3 new problems each day. Premium problems appear in the catalog but require a subscription. Problems also include hints and an AI mentor.
No. The collection covers SQL topics ranging from basic selections and joins to window functions, DDL, JSON, and query optimization. You can start with straightforward queries and move on to more specialized PostgreSQL features as you become comfortable with the fundamentals.
FILTER applies a condition to an individual aggregate calculation, making it useful when calculating different metrics for the same groups. DISTINCT ON selects one row per distinct set of expressions. They solve different problems, and DISTINCT ON requires careful ordering to select the intended row.
It shows how PostgreSQL executed a statement, including actual row counts and timing information for plan operations. Comparing those figures with estimates can help identify expensive steps. Remember that EXPLAIN ANALYZE executes the statement, so use care with operations that change data.