Practice
Practise by writing real programs
100 exercises across 6 languages. Each one gives you a small, realistic task, a starter file and test cases; your program is run against every test and you see exactly where it differs. Progress stays in this browser.
- Look at the whole product catalogueEasy
The sales team wants to see everything we sell. Return every column of every row in the Products table.
SQLFoundationsNot started
- Just the names and pricesEasy
For a price list, return only the name and unit_price of every product — nothing else.
SQLFoundationsNot started
- Find the expensive productsEasy
Finance wants a list of products that cost more than 400. Return all columns for those products only.
SQLFoundationsNot started
- Who earns the most?Easy
Return the first_name, last_name and salary of every employee, with the highest earner first and the lowest earner last.
SQLFoundationsNot started
- The three priciest itemsEasy
Return the name and unit_price of just the three most expensive products, most expensive first.
SQLFoundationsNot started
- Which countries do we sell to?Easy
Marketing wants a de-duplicated list of the countries our customers are based in. Return each country exactly once, in a single column named country.
SQLFoundationsNot started
- Active engineers onlyEasy
HR needs the first_name and last_name of employees who are in department 10 and are currently active (active = 1). Both conditions must hold.
SQLFoundationsNot started
- Our best-tier customersEasy
Return the company and tier of every customer whose tier is either Gold or Platinum.
SQLFoundationsNot started
- Companies beginning with AMedium
Return the company name of every customer whose company name starts with the letter A.
SQLFoundationsNot started
- Who reports to nobody?Medium
Department heads have no manager, so their manager_id is empty. Return the first_name and last_name of every employee with no manager.
SQLFoundationsNot started
- How many customers do we have?Easy
Return a single row with a single column named total_customers holding the number of rows in the Customers table.
SQLGrouping & JoinsNot started
- Average salary, roundedEasy
Return the average employee salary rounded to the nearest whole number, in one column named avg_salary.
SQLGrouping & JoinsNot started
- Cheapest and dearestEasy
In one row, return the lowest unit_price as min_price and the highest as max_price from the Products table.
SQLGrouping & JoinsNot started
- Revenue actually shippedMedium
Cancelled and pending orders should not count as revenue. Return the sum of order_total for orders with status 'Shipped', in one column named shipped_revenue.
SQLGrouping & JoinsNot started
- Headcount per departmentMedium
Return each dept_id alongside the number of employees in it, with the count in a column named headcount.
SQLGrouping & JoinsNot started
- Biggest departments firstMedium
Return dept_id and headcount as before, but sort so the department with the most employees comes first.
SQLGrouping & JoinsNot started
- Only the multi-person departmentsMedium
Return dept_id and headcount for departments that contain more than two employees.
SQLGrouping & JoinsNot started
- Put a name to the departmentMedium
Employees only store a dept_id. Return each employee's first_name and last_name next to their dept_name by joining to the Departments table.
SQLGrouping & JoinsNot started
- Every department, even the quiet onesHard
Return every dept_name together with how many employees it has, named headcount. Departments with no employees at all must still appear, showing a count of 0.
SQLGrouping & JoinsNot started
- Label each order by sizeHard
Return order_id, order_total, and a column named size_band that reads 'Large' when order_total is 8000 or more, 'Medium' when it is at least 3000 but under 8000, and 'Small' otherwise.
SQLGrouping & JoinsNot started
- Better paid than averageMedium
Return the first_name, last_name and salary of every employee earning more than the company-wide average salary.
SQLAdvanced QueriesNot started
- Customers with a shipped orderMedium
Every customer has ordered something, but not every order ships. Return the company name of each customer who has had at least one order reach 'Shipped' status.
SQLAdvanced QueriesNot started
- Customers still waitingMedium
Now the exact opposite: return the company name of each customer who has never had an order ship — everything they ordered is still pending or was cancelled.
SQLAdvanced QueriesNot started
- Name the managerHard
Return each employee's first_name alongside their manager's first_name in a column named manager_name. Employees with no manager should be left out.
SQLAdvanced QueriesNot started
- One combined contact listMedium
Build a single two-column list of everyone we deal with. Return each employee's first_name and each customer's contact under a shared column named person_name, plus a column named source containing 'Employee' or 'Customer' as appropriate.
SQLAdvanced QueriesNot started
- Revenue by product categoryHard
Return each product category alongside the total order_total it has generated from shipped orders only, in a column named category_revenue, highest revenue first.
SQLAdvanced QueriesNot started
- Who is closing the deals?Hard
Return the first_name and last_name of each employee together with how many orders they handled, in a column named orders_handled, counting shipped orders only, and listing the busiest employee first. Only include employees who handled at least one shipped order.
SQLAdvanced QueriesNot started
- Big spendersHard
Return company and the total spend as total_spent for every customer whose combined order_total across all their orders exceeds 10000, largest spender first.
SQLAdvanced QueriesNot started
- Label the price bandsEasy
Marketing wants each product labelled. Return name, unit_price, and a column called price_label that says premium for products costing 500 or more and standard for everything else.
SQLExpressions & ReportsNot started
- Support levels by tierEasy
Support triages customers by tier. Return company, tier, and support_level: Platinum customers get 'Top priority', Gold customers get 'Standard support', and everyone else gets 'Self-serve'.
SQLExpressions & ReportsNot started
- One-row status reportMedium
Management wants the order pipeline on a single row: three columns named shipped, pending and cancelled, each counting the orders with that status.
SQLExpressions & ReportsNot started
- Revenue won and lostHard
For each employee who has handled orders, return first_name, shipped_revenue (total order_total of their Shipped orders) and cancelled_revenue (total of their Cancelled orders), highest shipped_revenue first.
SQLExpressions & ReportsNot started
- Mailing labelsEasy
HR needs mailing labels: a single column full_name (first name, a space, last name) plus email, for every employee, alphabetical by full_name.
SQLExpressions & ReportsNot started
- Case-insensitive searchEasy
A colleague types 'an' into the customer search box and expects every company whose name contains those two letters, whether they are stored in upper or lower case - so 'Andes' counts as well as 'Meridian'. Return company.
SQLExpressions & ReportsNot started
- Strip the domainMedium
For the Engineering department (dept_id 10), return each employee's email and a column mailbox holding the email with '@example.com' removed.
SQLExpressions & ReportsNot started
- The longest product namesMedium
The catalogue layout breaks on long names. Return name and name_length for every product whose name is 18 characters or longer.
SQLExpressions & ReportsNot started
- Who reports to whomMedium
List every employee's first_name alongside reports_to - their manager's first name, or the text 'No manager' for employees at the top of the tree.
SQLExpressions & ReportsNot started
- Orders by monthMedium
How does order volume spread across the year? Return order_month (the month number from order_date) and orders (how many orders that month), earliest month first.
SQLExpressions & ReportsNot started
- Big orders, with namesMedium
Define a CTE called big_orders that selects orders with order_total above 3000, then return order_id, company and order_total for those orders.
SQLExpressions & ReportsNot started
- Well-paid departmentsHard
Using a CTE that computes each department's average salary, return dept_name and avg_salary for the departments whose average exceeds 100000.
SQLExpressions & ReportsNot started
- Two CTEs, one reportHard
Build a per-salesperson report using two CTEs: one counting each employee's Shipped orders, one totalling each employee's revenue across all orders. Return first_name, shipped_orders and revenue, highest revenue first.
SQLExpressions & ReportsNot started
- Category revenue reportHard
The quarterly report needs revenue by product category, ignoring cancelled orders: return category, orders (count) and revenue (sum of order_total), biggest revenue first.
SQLExpressions & ReportsNot started
Python
All Python exercises →- Choose a delivery windowEasy
Classify a parcel into a delivery window with clear Python if, elif and else conditions.
PythonConditionsNot started
- Dispatch message initialsEasy
Create uppercase initials from a multi-word dispatch message using Python string operations.
PythonStringsNot started
- Market basket totalEasy
Read item prices and quantities, then print the basket total with two decimal places using Python arithmetic.
PythonBasicsNot started
- Parcel cost functionEasy
Write and call a Python function that calculates a parcel charge from weight and distance bands.
PythonFunctionsNot started
- Unique route stopsEasy
Remove repeated bus stops while preserving first-seen order with Python lists and membership checks.
PythonListsNot started
- Inventory movement tallyMedium
Aggregate stock movements by product and print a sorted Python dictionary report.
PythonDictionariesNot started
- Longest reading streakMedium
Find the longest run of reading days from a compact activity string using a Python loop.
PythonLoopsNot started
- Safe reading averageMedium
Parse sensor tokens safely in Python and average only valid numeric readings using exception handling.
PythonExceptionsNot started
- Word frequency reportMedium
Count repeated words with a Python dictionary and print a deterministic alphabetical frequency report.
PythonDictionariesNot started
JavaScript
All JavaScript exercises →- Cafe bill totalEasy
Read prices and quantities, then print a JavaScript cafe bill total with exactly two decimal places.
JavaScriptBasicsNot started
- Cold-room alertEasy
Classify a sensor reading with JavaScript if, else if and exact boundary handling.
JavaScriptConditionsNot started
- Deduplicate article tagsEasy
Remove repeated tags while preserving first-seen order using JavaScript arrays and includes.
JavaScriptArraysNot started
- Headline to URL slugEasy
Normalise a simple headline into a lowercase hyphenated URL slug with JavaScript string methods.
JavaScriptStringsNot started
- Shipping fee functionEasy
Write and call a JavaScript function that calculates shipping from weight and distance.
JavaScriptFunctionsNot started
- Longest open runMedium
Scan a status string and find its longest consecutive open period with a JavaScript loop.
JavaScriptLoopsNot started
- Ticket code countsMedium
Count repeated support codes with a JavaScript object and print a sorted frequency report.
JavaScriptObjectsNot started
- Validated score averageMedium
Validate score tokens in JavaScript and average only finite numeric readings without hiding bad input.
JavaScriptError HandlingNot started
- Warehouse movement tallyMedium
Aggregate warehouse movements by item and print sorted totals with a JavaScript object.
JavaScriptObjectsNot started
- Bakery tray packingEasy
Read a loaf count and print how many full trays of six it fills and how many loaves remain. Practise integer division and modulo in C#.
C#BasicsNot started
- Conference badgeEasy
Print a three-line attendee badge from a name and an organisation, using ToUpper, string length and a repeated character. A first C# string exercise.
C#StringsNot started
- Greenhouse alertEasy
Read a greenhouse temperature and print which action the controller takes. Practise if, else if and else with inclusive ranges in C#.
C#Control flowNot started
- Sensor extremesEasy
Read one line of temperature readings into an array and print the highest, lowest and their difference. Practise Split, int.Parse and array scanning in C#.
C#Arrays and listsNot started
- Staircase step counterEasy
Print a running total of steps climbed after each flight of stairs. A C# for loop exercise with an accumulator variable.
C#Control flowNot started
- Garden bed areasMedium
Compute the area of rectangular, square and circular garden beds through a shared abstract base class. Inheritance and polymorphism in C#.
C#Classes and objectsNot started
- Locker code checkMedium
Validate gym locker codes (two capital letters then four digits) with a bool method that inspects each character. C# methods and char checks.
C#StringsNot started
- Messy invoice linesMedium
Total the valid lines of a damaged invoice export and count the rejected ones. Read to end of input and handle FormatException in C#.
C#ExceptionsNot started
- Overdue library feesMedium
Model library loans as objects with a fee calculation, then print each fee and the total. Classes, properties and methods in C#.
C#Classes and objectsNot started
- Staff per departmentMedium
Group a hospital roster by department with LINQ and list departments from most staffed to least, ties alphabetical. GroupBy, OrderByDescending, ThenBy.
C#LINQNot started
- Longest affordable stretchHard
Find the most consecutive trail segments whose total climb fits a budget using a sliding window over an int array. A two-pointer exercise in C#.
C#AlgorithmsNot started
- Market stall bookingsHard
Choose the largest set of non-overlapping stall bookings by sorting on end time and picking greedily. Greedy interval selection in C# with LINQ.
C#AlgorithmsNot started
- Shelf weight queriesHard
Answer many range-sum questions about a row of warehouse shelves in constant time each by precomputing prefix sums. Arrays and long arithmetic in C#.
C#AlgorithmsNot started
- Boards to cover a panelEasy
Write a Rust function that returns how many boards of a given width cover a panel, rounding up. Practise function signatures, return values and rounding up.
RustFunctionsNot started
- Library late feeEasy
Compute a library's overdue fee with a two-day grace period and a cap, using if/else and min in Rust. An exercise in simple branching.
RustControl flowNot started
- Seed packet labelEasy
Read a plant name, a packet count and seeds per packet, then print a one-line label with the total number of seeds. A first Rust input-and-output exercise.
RustBasicsNot started
- Ticket machine changeEasy
Turn change in cents into a euros-and-cents string like 3.05 using integer division, remainder and zero padding. Practise integer types and formatting in Rust.
RustBasicsNot started
- Trip odometerEasy
Keep a running odometer reading across three delivery trips and print it after each one. Practise let mut and updating a variable in place in Rust.
RustBasicsNot started
- Bakery order tallyMedium
Process add and remove commands for a bakery counter with slice patterns in match, then print the tally in alphabetical order. Practise Rust pattern matching.
RustPattern matchingNot started
- Hyphenate product codesMedium
Insert a hyphen wherever a product code switches between letters and digits, for every code on input. Practise walking chars and tracking state in a Rust loop.
RustStringsNot started
- Longest word in a headlineMedium
Return a borrowed &str for the longest word of each headline, with an explicit lifetime on the function. Practise borrowing instead of copying in Rust.
RustOwnership and borrowingNot started
- Parcel shipping costMedium
Model parcels with a struct and a zone enum, price each parcel from its zone and weight, and print a total. Practise enums, structs and impl blocks in Rust.
RustStructs and enumsNot started
- Sum the valid readingsMedium
Sum the lines of a noisy sensor feed that parse as integers and count the ones that do not, by matching on the Result from parse. Practise Result in Rust.
RustError handlingNot started
- Busiest stock windowHard
Find the K consecutive hours with the largest total net stock change using a sliding window in O(N). A Rust exercise in prefix sums and running totals.
RustAlgorithmsNot started
- Jars and lidsHard
Match jars to lids within a tolerance to seal as many jars as possible, using sorting and two pointers. A greedy Rust exercise with a proof sketch.
RustAlgorithmsNot started
- Shortest gap between revisitsHard
Find the fewest steps between two visits to the same stop on a long delivery route with a HashMap of last-seen positions. A Rust hashing exercise.
RustCollectionsNot started
- Ferry fare totalEasy
Compute the total cost of ferry tickets for adults and children in PHP and print it with two decimal places using sprintf.
PHPBasicsNot started
- Initials from a full nameEasy
Read a full name and print its initials in uppercase. Practise explode, string indexing and strtoupper in PHP.
PHPStringsNot started
- Parcel weights summaryEasy
Read a line of parcel weights into a PHP array and print the total and the heaviest one using explode, array_sum and max.
PHPArraysNot started
- Platform announcementEasy
Read a platform number and a destination, then print a railway announcement line. A first PHP exercise in reading input and echoing text.
PHPBasicsNot started
- Vaccine fridge statusEasy
Classify a fridge temperature reading as OK, TOO COLD or TOO WARM with if, elseif and else in PHP. Practise comparisons on decimal input.
PHPControl flowNot started
- Dose checker with exceptionsMedium
Validate pharmacy input with InvalidArgumentException in PHP, catch it per line, and keep processing after each error.
PHPExceptionsNot started
- Fun run results tableMedium
Sort race finishers by time and then by name with usort and the spaceship operator, and print a ranked results table in PHP.
PHPSortingNot started
- Headline to URL slugMedium
Turn a blog headline into a URL slug in PHP: lowercase, replace runs of non-alphanumerics with one hyphen, trim, and handle empty results.
PHPStringsNot started
- Ingredient tally for the weekMedium
Total ingredient quantities across recipes with a PHP associative array, then print them sorted by name using ksort.
PHPAssociative arraysNot started
- Postage cost per parcelMedium
Write a PHP function that prices parcels by weight band and express flag, returns integer cents, and prints each cost with two decimals.
PHPFunctionsNot started
- Savings jar commandsMedium
Model a savings jar as a PHP class with a private balance, then drive it with add, take and show commands read from input.
PHPClasses and objectsNot started
- Fewest charging stops for the vanHard
Plan the minimum charging stops for an electric van on a straight route with a greedy choice in PHP, or report that the trip is impossible.
PHPControl flowNot started
- Flatten a nested config fileHard
Recursively flatten a nested JSON object into dotted key=value lines in PHP with json_decode, is_array and a recursive function.
PHPJSON and dataNot started
- Longest dry stretch within a rainfall budgetHard
Find the longest run of consecutive days whose total rainfall stays within a budget. A sliding window (two pointers) exercise in PHP.
PHPArraysNot started