Masking Card Numbers for a PCI Report
You're an analyst at a fintech company that processes card payments. The compliance team is preparing a report for a PCI DSS audit. The support interface must never display a complete card number.
Get comfortable retrieving exactly the data you need with SQL SELECT exercises. Practice choosing columns, filtering rows with conditions, sorting results, and limiting the output. Each query runs in a real database and is checked against expected results using hidden data. Problems in this collection: 224, free: 127.
Problems in this set: 224, free: 127
Start with a free problemProblems found: 81
Reset filtersYou're an analyst at a fintech company that processes card payments. The compliance team is preparing a report for a PCI DSS audit. The support interface must never display a complete card number.
You're an analyst at a streaming service. The catalog was inherited from an old CMS that stores each full title as a single string, with the series name and episode subtitle separated by a colon…
You're a data engineer at a telecom operator that has acquired a regional competitor.
You're an analyst at a game studio. The server records item drops using compact hyphen-separated codes containing the zone, item type, and rarity, such as 'north-sword-epic'.
You're a treasury analyst at Meridian Trust, a digital bank. The treasury team needs to plan liquidity.
You're an analyst at SafeHarbor, an insurance company. An automated claims system approves a payout when this rule is satisfied: "The claim amount does not exceed 5000 AND the damage has been…
You're an analyst at TransNord, a logistics company. Customers declare shipment weights when booking transportation, and some shipments are weighed again for verification at a sorting hub.
You're an analyst at BattleGrid, an esports platform. The season is ending, and the community manager is preparing a leaderboard showing each player's win percentage for the season.
You're an analyst at Nordhaus, a real estate agency. The property listings are displayed from most expensive to least expensive, but some premium properties have undisclosed prices available only on…
You're an analyst at a fintech company. Card payments are stored in one table and bank transfers in another.
You're an analyst at a game studio. Your online game has two modes, arena (PvP matches) and cooperative raids, each with its own log.
You're an analyst for a network of clinics. After an initial appointment, patients are scheduled for a follow-up, but some never attend: they cancel or fail to show up.
AND has higher precedence than OR in SQL. Reading a condition from left to right can lead to a different interpretation than the database uses. Break complex filters into logical parts, add parentheses where needed, and test rows that meet only some of the conditions.
LIMIT restricts how many rows are returned, but it does not choose the newest, cheapest, or highest-ranked records. Without ORDER BY, the result order is not guaranteed. If a problem asks for top or latest entries, identify the sorting rule before applying LIMIT.
NULL represents a missing value, so = NULL does not work like an ordinary equality check. The condition may silently exclude records you expected to see. Use the appropriate NULL check and consider whether records with missing values should be included or excluded.
Values stored as text follow string sorting rules, which can produce a different order from numeric sorting. Dates stored as strings can cause similar surprises. Check the column's data type and inspect the first few returned rows before assuming the ordering is correct.
Yes. Free exercises in this collection: 127. With the free plan, you can sign in and solve up to 3 new problems per day without paying. Premium exercises remain visible in the catalog but require a subscription to solve.
Your SQL runs in a real database, using PostgreSQL, MySQL, ClickHouse, or BigQuery depending on the problem. The result is automatically compared with an expected result using hidden data. This makes it worth checking the selected columns, returned rows, and required ordering carefully.
WHERE determines which rows qualify for the result. ORDER BY determines their sequence. Sorting does not remove unwanted records, and filtering does not guarantee their order. Read the selection and sorting requirements separately, then make sure your query handles both.
Without ORDER BY, a database does not guarantee the order of returned records. LIMIT simply takes a portion of that result. If you need a predictable set of first rows, specify the sorting criteria. When values tie, an additional sorting column may be necessary.
Yes. Understanding tables, rows, columns, and basic filtering is enough to begin. SELECT exercises help you practice retrieving and organizing data from individual tables. Once those operations feel familiar, combining multiple tables with JOIN becomes much easier to reason about.