0417 · 18.2Manipulate data
Cambridge IGCSE Information and Communication Technology (0417) · Topic 18, Databases · 10:36
Practise this topic
Real past-paper questions on manipulate data, with their mark schemes. Free with an account.
57 more Information and Communication Technology videos like this one
With a CIE Buddy account: every video in syllabus order, past-paper practice on each topic, and an AI tutor for anything unclear.
In this video
- 0:00Database queries and calculations. Defines database terms, queries and calculation tools used to process equipment order data.
- 2:13Calculated fields and controls. Shows how to calculate order totals and use report controls to summarise query results.
- 3:55Sorting records. Explains ascending, descending and multiple-criterion sorting, including how ties are resolved.
- 4:54Selection criteria and wildcards. Explains comparison, logical and pattern-matching criteria for selecting database records.
- 7:55Worked query and exam tips. Combines calculations, selection, sorting and report totals, then reviews evidence and common exam errors.
Transcript: Manipulate data
Database queries and calculations
0:00A school equipment order list contains prices and quantities, but the organiser needs answers. Each order needs a cost, the orders need arranging, and sports equipment needs a separate list. These tasks involve calculations, sorting and selecting records. All three use the same stored values to answer different questions. Data is facts or values that a computer can process. A database is an organised collection of related data. Inside each table, a field stores one item of data about something.
0:27A record, in contrast, is a collection of related fields about one item or person. Each row here represents one order, and each column contains one field. The quantity field tells us how many items were ordered. Unit price gives the cost of one item. Keep those meanings clear, because they decide which calculation answers each question. A file is a named collection of information stored together. Our worked file is called Equipment Orders, and it holds one table of five orders.
0:55The practical papers provide source files, and candidates work without internet access. Describe each action by what it does, because answers naming a brand of software gain no marks. A query is a request to retrieve or process data from a database. A subset is a selection of records from a larger collection. A query can calculate values, arrange its results and select the matching records. The records in the table stay unchanged, whatever the query shows.
1:20The calculation tools are addition, subtraction, multiplication, division, sum, average, maximum, minimum and count. Addition combines amounts, such as increasing a quantity by two. Subtraction finds a difference, such as reducing a price by one pound. Multiplication gives the cost of several identical items from the price of one. Division shares an amount into equal parts, so total cost divided by quantity gives the cost per item. A function is a named operation that carries out a particular calculation.
1:51The SUM function adds the values from every record included. AVERAGE adds the values and divides by how many there are. MAX gives the largest value in a set. To find the smallest value, use MIN. COUNT gives the number of records that hold a value in the chosen field. Counting the primary key, order ID, therefore counts every record, because no record can leave its primary key empty.
Calculated fields and controls
2:13A calculated field is a query field whose value is worked out from an expression. Create a query from the orders table, then add a calculated field named Order Total. Its expression multiplies unit price by quantity. Type the field names exactly as they appear in the table, then run the query and check one result by hand. For Amy Shaw, one ball costs eight pounds and the order contains three balls.
2:35Multiplying eight by three gives twenty-four pounds. The same expression works on every record, using that record’s own values. Ben Shaw’s bat costs twelve pounds, and two of them also come to twenty-four pounds. Cara’s five brushes at four pounds each come to twenty pounds, while Dan’s four pads at six pounds come to twenty-four. Eva’s two ropes at five pounds make the smallest order, ten pounds. Set the order total to display a currency symbol and two decimal places, so each result reads as money.
3:02The new field exists only in the query, so the table itself is unchanged. Run time means the moment when the query or report is opened or run. The calculation is worked out at run time, every time. If a quantity in the table changes, running the query again uses the new value. A calculated result therefore never goes out of date. A calculated control is a box on a form or report that displays the result of an expression.
3:26A report total can use the SUM function to add the order totals. Place an overall total in the report footer, so it covers every record in the report. A calculated field works out a value for each record, while a calculated control usually summarises many records. The five order totals add up to one hundred and two pounds. Dividing that sum by five gives an average of twenty pounds and forty pence.
3:47The maximum is twenty-four pounds, and the minimum is ten pounds. COUNT finds five orders, and each of these results summarises every record in the report.
Sorting records
3:55Sorting means arranging records into a specified order using one or more fields. A sort criterion gives a field and the direction to sort it in. Ascending order runs from smallest to largest, or from A to Z for text. Descending order runs the other way, from largest to smallest or from Z to A. For a single criterion, sort unit price into ascending order. Cara’s four-pound brush comes first, followed by the five, six and eight pound items.
4:22Ben’s twelve-pound bat comes last. Sorting the same field into descending order reverses the list, so Ben’s order moves to the top. Each record moves as a whole, because its fields describe the same order. When two records share a value in the first sort field, a second criterion decides their order. With multiple criteria, the first field has priority. Sort surname ascending, then first name ascending. Reed comes first, followed by the two Shaw records, then Singh and Stone.
4:49Within the shared surname, Amy comes before Ben, because the second criterion settles that tie.
Selection criteria and wildcards
4:54A selection criterion is a condition that a record must meet to appear in the query results. A comparison operator sets the test between a field and a value. The comparison operators are greater than, less than, equals, greater than or equal to, less than or equal to, and not equal to. Whether the boundary value itself is included decides which records qualify. Quantity greater than three selects Cara’s five brushes and Dan’s four pads.
5:19Less than three picks out the two orders of two, from Ben and Eva. Equals three selects only Amy’s order. With greater than or equal to three, the boundary value three is included as well, so Amy, Cara and Dan all appear. Less than or equal to three includes both orders of two and Amy’s order of three. Not equal to three selects every order except Amy’s, so four records appear.
5:40Test the boundary value by hand whenever a task uses a comparison. That check shows whether the condition needs the equals part. The logical operators are AND, OR and NOT. With AND, every connected condition must be true. OR accepts a record when at least one of the conditions is true. NOT reverses a condition, so it selects the records that do not meet it. Category Sport AND quantity greater than or equal to three selects Amy alone, since Ben and Eva each ordered only two.
6:07Category Art OR quantity greater than or equal to three selects Amy, Cara and Dan. Cara and Dan meet both conditions, yet each appears only once. NOT category Art selects the three sports orders. In a query grid, each condition goes under its own field. Conditions typed on the same criteria row must all be true, so they work as AND. A condition on the next row is an alternative, so it works as OR.
6:30This grid therefore selects sports orders of three or more, or any art order, which gives Amy, Cara and Dan. Use brackets to show which alternatives belong together when a criterion mixes AND with OR. Suppose the task asks for sports orders with a total of either ten pounds or twenty-four pounds. The two totals are grouped in brackets, and the category condition then applies to both. Amy, Ben and Eva are selected, so check the complete condition against each record before accepting it.
6:57LIKE is an operator that tests whether text matches a pattern. A wildcard is a character that stands for unknown characters in a search pattern. An asterisk stands for any number of characters, including none. This lets us search for part of a value when the full spelling is not given. Surname LIKE S followed by an asterisk selects the four surnames that begin with S. An asterisk followed by the letters A W selects the surnames ending in those letters, which are both Shaw records.
7:24Putting an asterisk on each side of a letter finds values that contain it anywhere. Item LIKE asterisk, A, asterisk therefore selects the ball, the bat and the pad. A question mark stands for exactly one character, so S, a question mark, A, then W, also matches Shaw. NOT can be combined with LIKE, and surname NOT LIKE S asterisk leaves only Reed. Some database software uses a percent sign and an underscore for these two wildcards.
7:50Use whichever symbols the software in front of you accepts, and check the selected records afterwards.
Worked query and exam tips
7:55A typical Paper Two task combines these skills. Use the calculated field from earlier, then select sports orders whose total is at least twenty pounds. Both conditions go on the same criteria row, because every selected record must meet both. Category is needed for the search but is not listed for display, so untick its show box. Amy and Ben both qualify, because their category is Sport and each total is twenty-four pounds.
8:19Eva’s ten-pound order falls below the limit, so it is left out. Sorting unit price into descending order puts Ben’s twelve pounds above Amy’s eight pounds. The criterion uses greater than or equal to, because an order of exactly twenty pounds must also be included. Add a calculated control in the report footer that sums the selected order totals. The finished total is forty-eight pounds, because the report contains two orders of twenty-four pounds.
8:43The control refers to the order total field, so it uses the values of the selected records only. The calculated field still works out each order, while this control summarises the report. A screenshot is an image captured from all or part of a screen. Put the requested screenshots in your Evidence Document, with the expressions and query criteria fully visible. Include your name, centre number and candidate number on every printout.
9:05Check that every label and value can be read in full. The marks most often lost here come from small slips. Using greater than when the task says at least leaves out the boundary record. A misspelt category or a missing asterisk selects nothing, while sorting fields in the wrong priority gives the wrong order. Other marks go when the calculated field name differs from the task, or a field that should be hidden is shown.
9:26A screenshot that hides the criteria or the formula earns nothing. The first question asks for a definition worth one mark. A calculated field is a query field whose value is worked out from an expression. The sort question earns its two marks from two steps. Records are first arranged by surname in ascending order. Those sharing a surname are then arranged by first name in ascending order. For the question on AND, link the operator to the requirement.
9:51AND means a record is selected only when both conditions are true. Every selected order therefore belongs to the Sport category and has a total of at least twenty pounds. The last question compares two calculation tools. A calculated field works out a new value for each record in a query. In contrast, a calculated control sits on a form or report and often summarises many records, such as a total in the report footer.
10:15As a reminder, a query is a request to retrieve or process data from a database. To sum up sorting, it means arranging records into a specified order using one or more fields. Every selection criterion is a condition that a record must meet to appear in the query results. Calculations produce values, sorting sets the order, and selection decides which records appear.