Skip to content
← Back to glossary

選択Selection

Learn in the textbookControl Structures and Notation Methods

DefinitionSelection (選択) is a control structure that switches the next step depending on whether a condition (条件) holds (true) or does not hold (false).

ExplanationSelection is also called branching (分岐); in a diagram, one line leaves the diamond-shaped decision (判断) symbol for each result, such as true and false (Yes and No). Placing one selection inside another divides processing into three or more paths.

AnalogyIt works like a station ticket gate: a valid ticket opens the gate, and an invalid one keeps it shut.

Memory hookPrograms usually write a selection starting with the word if.

In other units (1)

Learn in the textbookBasics of Data Operations (Insert/Update and the Relational Operations for Retrieval)

DefinitionSelection (選択) is the operation that takes the rows meeting a condition out of a table to form a new table.

ExplanationA relational operation (関係演算) is a retrieval operation that takes tables as input and returns a table as its result. A selection's result has the same columns as the original, with only the rows that meet the condition left (zero rows if none match). In SQL, the condition written in the WHERE clause plays the role of selection.

AnalogyLike copying out only the lines for people absent today from an attendance register.

Memory hookRelational algebra writes it as σ (sigma), the Greek letter that matches the s of selection.

Related past-exam questions(40 questions)