Be able to set report titles

📊 18 Databases – Setting Report Titles

In the IGCSE ICT exam, you’ll often need to create a report from a database and give it a clear, informative title. Think of the title as the headline of a news article – it tells the reader what the story (or report) is about before they even read it.

What is a Report Title?

A report title:

  • Summarises the main focus of the data.
  • Includes key terms like Sales, Year, Region, etc.
  • Is usually placed at the top of the report page.

Example: "2023 Q4 Sales Report – North America"

Setting Report Titles in SQL

When you generate a report with SQL, you can set the title in the application that displays the data (e.g., a spreadsheet or a web page). In pure SQL, you often just create a SELECT statement and then add the title in the front‑end.

However, some reporting tools let you embed the title directly in the query using a WITH clause or a COMMENT. Here’s a simple example using a SELECT and a UNION ALL trick to add a title row:

Query Result
SELECT '2023 Q4 Sales Report – North America' AS Title
UNION ALL
SELECT Product, SUM(Units) AS TotalUnits, SUM(Sales) AS TotalSales
FROM SalesData
WHERE Region = 'North America' AND Quarter = 'Q4' AND Year = 2023
GROUP BY Product;
Title
2023 Q4 Sales Report – North America
Product   TotalUnits   TotalSales
Widget A  1,200        $48,000
Widget B  850          $34,500
…

In a real application, you’d usually set the title in the report designer, but knowing how to embed it in SQL can be handy for quick tests.

Example: Sales Report with Title

  1. Open your database tool (e.g., MySQL Workbench, pgAdmin).
  2. Write a query to pull the data you need.
  3. Use UNION ALL to prepend a title row, as shown above.
  4. Export the result to a CSV or display it in a web page.
  5. In the front‑end, style the first row as a header (bold, larger font).

Analogy: It’s like putting a banner on a road sign before the actual directions – it tells everyone what the sign is about.

Examination Tips 🎯

  • Remember that a good title is concise but informative.
  • Use capitalisation consistently (Title Case is common).
  • When writing SQL for the exam, show the SELECT statement clearly and, if asked, explain how you would add a title in the report.
  • Practice formatting the title in a spreadsheet: bold, larger font, centered.
  • Check that the title matches the data – if you’re reporting on 2023 Q4, don’t say 2022.

Tip: In the exam, you can write a short comment in the SQL block: /* Report Title: 2023 Q4 Sales – North America */ – this shows you understand the concept even if the tool doesn’t support embedded titles.

Summary

Setting a report title is all about clarity. Treat it like the headline of a newspaper: it should immediately tell the reader what the data is about. In SQL, you can add a title row with UNION ALL or use a comment. In the front‑end, style the title to stand out. Keep it short, accurate, and consistent, and you’ll ace this part of the IGCSE ICT exam!

Revision

Log in to practice.

3 views 0 suggestions