HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Problems
  2. /A stationery cupboard keeps its pens in a table Pens…
EasyComputer ScienceHigh School (9–10)Computer Science › Databases and SQLNumericalIGCSE

A stationery cupboard keeps its pens in a table Pens…

StemPy LabContributed by StemPy Lab

Try it on paper first. A hint, the key idea and the worked solution are here when you need them.

A stationery cupboard keeps its pens in a table Pens.

table
PenID  Colour  Ink   Stock
W1     Blue    Gel   25
W2     Black   Ball  40
W3     Red     Gel   8
W4     Green   Felt  12
W5     Blue    Ball  33
  1. How many rows and how many columns does this script output?
sql
SELECT Colour, Stock
FROM Pens;
  1. Write down the first two rows of the output.

Check your answer

Work it out on paper, then type your number. The answer itself stays hidden.

Need a reminder? The key ideaShowHide

A query starts SELECT (the fields to output, with commas between them, in the order you want) and FROM (the table). A semicolon ends it. With no condition, every record is output, in the order of the table.

The worked solution

Have you tried it?

Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.

Step 1. The records. There is no WHERE, so all 555 records are output, in the order of the table.

Step 2. The fields. The script selects Colour and Stock, so the output has 222 columns, Colour first.

Step 3. The output.

sql
SELECT Colour, Stock
FROM Pens;

The output:

table
Colour  Stock
Blue    25
Black   40
Red     8
Green   12
Blue    33

Answer: (a) 555 rows and 222 columns. (b) Blue, 252525; Black, 404040.

Log in to save this for later
← All Problems
← A hotel validates each booking before it is added…A student wants the name and the price of every product in a shop table called Products. He writes… →
More onComputer Science › Databases and SQL

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. SELECT and FROM: choosing the fieldsSQL Queries: SELECT, WHERE and ORDER BY

More on this topic

  1. A restaurant stores its staff in a table Staff…Hard
  2. A town library stores its readers in a table Readers…Medium
  3. A gym stores its members in a table Gym…Easy
  4. A school garden club records each plot in a table Plots: the water it needs each day in litres, its…
Hard
  • A school weather station stores one record a day in a table Weather: the rainfall in millimetres…Medium
  • All problems on this topic →