ITパスポート試験|データベースの基礎知識と頻出問題 IT Passport Exam | Database: Fundamentals and Frequently Tested Topics

ITパスポート試験対策 - データベースの基礎知識と頻出問題 アイキャッチ画像

ITパスポート試験の「データベース」分野は、テクノロジ系の中でも用語の定義・概念理解と表を使った実践問題の両方が問われる出題範囲です。データベースの基本概念・関係データベースの構造・主キーと外部キー・正規化・DBMS・SQL・トランザクション管理・排他制御など、扱うテーマは多岐にわたりますが、出題パターンは一定の範囲に絞られています。本記事では、試験頻出ポイントに絞り、日英併記でわかりやすく解説します。

The “Database” domain of the IT Passport exam is an area within the technology section where both conceptual understanding of definitions and practical table-based questions are tested. Topics range widely — the fundamental concept of databases, the structure of relational databases, primary and foreign keys, normalization, DBMS, SQL, transaction management, and exclusive control — but exam question patterns follow a consistent set of themes. This article provides a clear, bilingual explanation focused specifically on key points frequently tested in the exam.

この記事で学べること:データベースの基本概念・関係データモデルとは何か・テーブル・レコード・フィールドの関係・主キーの条件・複合主キー・外部キー・E-R図と正規化・データベース管理システム(DBMS)・SQLの役割・データ操作の3種類(選択・射影・結合)・トランザクション管理とコミット・排他制御とロック。公開過去問やシラバスで確認できる重要テーマを中心に、試験対策で押さえておきたいポイントを整理しています。

What you’ll learn: the fundamental concept of a database; what a relational data model is; the relationships among tables, records, and fields; the conditions for a primary key; composite primary keys; foreign keys; E-R diagrams and normalization; database management systems (DBMS); the role of SQL; the three types of data operations (selection, projection, and join); transaction management and commit; and exclusive control and locking. This article focuses on key topics confirmed in the official syllabus and published past questions, organizing the points you should understand for exam preparation.

目次

データベースとは What Is a Database?

データベースとは、特定の目的のために収集・整理された情報の集合体です。コンピュータの世界では、データを一か所に集約して一元管理できる仕組みを指します。「ベース」には「拠点」や「基盤となる場所」という意味があり、データが集積・管理される場所としてイメージするとわかりやすいです。

A database is a collection of information gathered and organized for a specific purpose. In computing, it refers to a mechanism that consolidates data in one place for centralized management. Thinking of it as a location where data is accumulated and managed helps clarify the concept.

データをファイルで個別に管理する場合、担当者ごとにバラバラに保存されるため、情報の重複・矛盾・更新漏れが起きやすくなります。データベースを使ってデータを一元管理することで、こうした問題を解決できます。また、システム関連の図の中に円柱のシンボルが描かれている場合、それはデータベース(またはデータベース管理システム)を意味します。

When data is managed as individual files by separate users, duplication, inconsistencies, and missed updates are common problems. Centralized management through a database resolves these issues. In system-related diagrams, a cylinder symbol represents a database or database management system.

データモデルの種類 Types of Data Models

データの格納・管理の方式(データモデル)には複数の種類があります。ITパスポート試験で問われるのは主に関係データモデルです。

There are multiple types of data models — approaches for storing and managing data. The IT Passport exam focuses primarily on the relational data model.

データモデル / Data Model特徴 / Characteristics
関係データモデル
Relational data model
データを「表(テーブル)」の形式で表現する。現在最も普及しており、ITパスポート試験で主に出題される
Represents data in the form of tables. Currently the most widely used model and the primary focus of the IT Passport exam
階層データモデル
Hierarchical data model
データ同士の関係を木構造(親子関係)で表現する
Represents relationships between data using a tree structure (parent-child relationships)
ネットワークデータモデル
Network data model
データ同士の関係を網目状のつながりで表現する。1つのデータが複数の親を持てる
Represents relationships using a mesh-like structure; each data item can have multiple parents

関係データベース Relational Database

テーブル・レコード・フィールドの関係 Tables, Records, and Fields

関係データベース(Relational Database)とは、データを表(テーブル)の形式で管理するデータベースです。表計算ソフトと似た形でデータを管理しますが、データベースとして高度な操作・管理ができる点が異なります。

A relational database is a database that manages data in the form of tables. While it resembles a spreadsheet in appearance, it differs in that it supports advanced operations and management capabilities.

表の構成要素は次のとおりです。ITパスポート試験では、表・行・列に対応する専門用語として「テーブル」「レコード」「フィールド」「属性」などが問われます。それぞれの対応関係をしっかり覚えておきましょう。

A table is composed of the following elements. In the IT Passport exam, the specialist terms “table” (テーブル), “record” (レコード), “field” (フィールド), and “attribute” (属性) are tested as counterparts to the everyday Japanese words “表 (hyō),” “行 (gyō),” and “列 (retsu).” Be sure to learn the exact correspondence between them.

一般的な呼び方 / Common Term別名 / Alternative Term説明 / Description
表(ひょう)テーブル / Tableデータをレコード(行)と属性・フィールド(列)で管理する単位
The unit that manages data in records (rows) and attributes / fields (columns)
行(ぎょう)レコード / Record1件分のデータのまとまり。データが追加されるとレコード(行)が増える
One unit of data; adding data increases the number of records (rows)
列(れつ)属性 / Attribute、フィールド / Fieldデータの項目(特徴・性質)を表す。属性名(列名)がある
Represents a data item (characteristic or property); has an attribute name (column name)

1つのデータベースは複数のテーブルから構成され、1つのテーブルは複数のレコード(行)から、1つのレコード(行)は複数のフィールド(列)から構成されます。データが追加されるとレコード(行)が1つ増えますが、属性(列)の数は変わりません。

A single database is composed of multiple tables; each table consists of multiple records (rows); each record (row) consists of multiple fields (columns). Adding a new data entry increases the number of records (rows) by one, but the number of attributes (columns) remains unchanged.

なお、「行」「列」は日常的な日本語であり、英語では一般に Row・Column と訳されます。しかし、関係データベースの専門用語としては、行=レコード(Record)、列=属性(Attribute)またはフィールド(Field)と呼びます。ITパスポート試験では専門用語で出題されるため、「行=Row」ではなく「行=Record」、「列=Column」ではなく「列=Attribute / Field」という対応を意識して覚えておくことが重要です。

Note that “行 (row)” and “列 (column)” are everyday Japanese words, translated into English as “row” and “column” in general usage. However, in relational database terminology, a row is specifically called a record and a column is called an attribute or field. Since the IT Passport exam uses these specialist terms, it is important to remember the correspondence as “行 = record” rather than “行 = row,” and “列 = attribute / field” rather than “列 = column.”

主キー Primary Key

主キーとは、テーブル内のある特定のレコード(行)を他のレコード(行)と区別して一意に識別するための属性(列)、または属性(列)の組合せのことです。主キーに設定できる属性(列)(または属性の組合せ)には、次の2つの条件を同時に満たす必要があります。

A primary key is an attribute (column), or a combination of attributes (columns), that uniquely identifies a specific record (row) in a table, distinguishing it from all other records (rows). The attribute (column) — or combination of attributes — must simultaneously satisfy the following two conditions to serve as a primary key.

条件 / Condition説明 / Description
値が重複しないこと
No duplicate values
テーブル内の全レコード(行)にわたって、同じ値が2つ以上存在してはならない
The same value must not appear in more than one record (row) across the entire table
NULL(空)でないこと
No NULL values
値が存在しない(空欄の)状態であってはならない
The column must not contain empty (null) values

NULLとは、関係データベースにおいて「その場所にデータが存在しない」ことを明示的に表す特殊な値です。たとえば、氏名の属性(列)は同姓同名の人が複数いる可能性があるため主キーには不向きです。電話番号の属性(列)も、電話を持っていない人が存在する場合にNULLになり得るため主キーの条件を満たしません。番号が自動的に一意割り当てされる社員番号や顧客番号などが主キーの典型例です。

NULL is a special value in relational databases that explicitly indicates the absence of data in a given position. For example, a name attribute (column) is unsuitable as a primary key because multiple people may share the same name. A phone number attribute (column) also fails to qualify because some individuals may have no phone, resulting in a NULL value. Employee numbers and customer IDs — where a unique value is automatically assigned to each record (row) — are typical examples of primary keys.

複合主キーと外部キー Composite Primary Keys and Foreign Keys

テーブル内に主キーの条件を単独で満たす属性(列)が存在しない場合、複数の属性(列)を組み合わせて主キーに設定することができます。これを複合主キーといいます。たとえば、「校舎コード」と「座席番号」をそれぞれ単独で使っても一意にはなりませんが、2つを組み合わせることで特定の座席のレコード(行)を一意に識別できます。

When no single attribute (column) in a table independently satisfies the conditions for a primary key, multiple attributes (columns) can be combined to form a primary key. This is called a composite primary key. For example, neither “building code” nor “seat number” alone can uniquely identify a seat, but the two combined can uniquely identify any specific record (row).

外部キーとは、別のテーブルの主キーを参照するために設けられた属性(列)のことです。関係データベースでは、データの内容や種類ごとにテーブルを分けて管理することが基本です。外部キーを使うことで、分離した複数のテーブル間の関連を保ちながらデータを効率よく管理できます。

A foreign key is an attribute (column) established to reference the primary key of another table. In relational databases, it is standard practice to separate data into distinct tables according to its content and type. Foreign keys enable efficient data management while maintaining the relationships between separate tables.

データベース設計 Database Design

E-R図 E-R Diagram

E-R図(Entity-Relationship Diagram)とは、データベースを設計する際に、データ同士の関連性を視覚的に表した設計図です。エンティティ(実体)リレーションシップ(関連)という2つの概念を組み合わせて表現します。

An E-R diagram (Entity-Relationship Diagram) is a blueprint used during database design to visually represent the relationships between data. It uses two concepts: entities (things that exist) and relationships (connections between entities).

要素 / Element説明 / Descriptionイメージ / Example
エンティティ(実体)
Entity
管理対象となるもの。「名詞で表せるもの」と考えるとわかりやすい
The object being managed; think of it as something expressible as a noun
社員・部署・商品・顧客など
Employee, department, product, customer, etc.
リレーションシップ(関連)
Relationship
エンティティとエンティティの関係。「動詞で表せるもの」と考えるとわかりやすい
The connection between entities; think of it as something expressible as a verb
「社員が部署に所属する」「顧客が商品を注文する」など
“An employee belongs to a department,” “A customer orders a product,” etc.

リレーションシップの種類(多重度)は次の3種類です。試験では、必要な表記方法が問題文中で示されることが多いため、まずは多重度の意味を理解しておきましょう。

There are three types of relationship multiplicity. In the exam, the necessary notation is often explained within the question, so focus on understanding what each type of multiplicity means.

多重度 / Multiplicity意味 / Meaning例 / Example
1対1
One-to-one
一方の1つのデータに対して、他方も1つのデータが対応する
One data item on one side corresponds to exactly one data item on the other
社員と社員証
Employee and employee ID card
1対多
One-to-many
一方の1つのデータに対して、他方は複数のデータが対応する
One data item on one side corresponds to multiple data items on the other
部署と社員
Department and employees
多対多
Many-to-many
両方の側で、1つのデータに対して複数のデータが対応する
Multiple data items on each side correspond to multiple data items on the other
社員と担当プロジェクト
Employees and their assigned projects

正規化 Normalization

正規化とは、データの重複や更新時の矛盾が生じないよう、テーブルを適切な単位に分割・整理することです。正規化の目的は、ITパスポート試験において出題頻度の高いテーマの一つです。

Normalization is the process of dividing and organizing tables into appropriate units to prevent data duplication and inconsistencies during updates. The purpose of normalization is one of the important topics tested in the IT Passport exam.

たとえば、1つの大きなテーブルに「社員情報」と「所属部署情報」を混在させて管理していると、次のような問題が生じます。

For example, if “employee information” and “department information” are mixed together in one large table, the following problems arise.

問題 / Problem具体例 / Example
データの重複
Data duplication
同じ部署名が複数のレコード(行)にわたって繰り返し入力される
The same department name is entered repeatedly across multiple records (rows)
更新時の矛盾
Update inconsistency
部署名を変更する際、該当する全レコード(行)を修正しないと一部だけ古い名称が残ってしまう
When a department name changes, all relevant records (rows) must be updated or some will retain the old name
削除時の情報消失
Loss of information on deletion
ある社員のレコード(行)を削除すると、その社員だけが持っていた部署情報も一緒に失われる
Deleting an employee’s record (row) also removes department information that existed only in that record

正規化を行ってテーブルを「社員表」と「部署表」に分離することで、部署名の修正は部署表の1か所だけで済み、社員のレコード(行)を削除しても部署情報が失われることはなくなります。正規化の目的は「データの冗長性を排除し、整合性を保つこと」です。試験ではこの目的の文言が出題されやすいテーマです。

By normalizing the data and separating it into an “employee table” and a “department table,” updating a department name requires only a single change in the department table, and deleting an employee’s record (row) no longer causes department information to be lost. The purpose of normalization is to eliminate data redundancy and maintain consistency. This definition is an important topic that tends to appear in the exam.

データベース管理システムとSQL DBMS and SQL

DBMSとは What Is a DBMS?

データベース管理システム(DBMS:Database Management System)とは、アプリケーションソフトウェアからの要求を受け取り、データベースへのアクセスや操作を仲介・管理するソフトウェアです。一般的なデータベースシステムでは、ユーザーや業務アプリケーションはDBMSを介してデータベースを操作します。アプリケーションがデータベースを操作する際は、DBMSを経由するのが基本です。

A database management system (DBMS) is software that receives requests from application software and mediates and manages access to and operations on the database. In a typical database system, users and business applications operate on the database through the DBMS. Going through the DBMS is the standard approach when applications interact with the database.

関係データベースを専門に管理するDBMSをRDBMS(Relational Database Management System)と呼びます。また、関係データベース以外の形式でデータを管理するデータベースの総称として、NoSQL(Not Only SQL)という用語も使われます。

A DBMS that specializes in managing relational databases is called an RDBMS (Relational Database Management System). The term NoSQL (Not Only SQL) is also used for databases that manage data in forms other than the relational model.

SQLとは What Is SQL?

SQL(Structured Query Language)とは、関係データベースを操作するための専用の言語です。アプリケーションソフトウェアはSQLを使ってRDBMSに命令を出し、RDBMSがデータベースからデータを取り出したり更新したりして、その結果をアプリケーションに返します。

SQL (Structured Query Language) is the dedicated language used to operate relational databases. Application software issues instructions to the RDBMS using SQL; the RDBMS then retrieves or updates data in the database and returns the results to the application.

試験で押さえたいDBMS関連機能 Key DBMS-Related Functions for the Exam

ここでは、ITパスポート試験で特に押さえておきたいDBMS関連の論点として、データ操作・トランザクション管理・排他制御を整理します。試験では特に排他制御とデータ操作の中の選択・射影・結合が出題されやすい重要テーマです。

This section summarizes three DBMS-related topics that are especially important for the IT Passport exam: data operations, transaction management, and exclusive control. Among these, exclusive control and the data operations of selection, projection, and join are particularly important themes that appear frequently.

(1)データ操作 Data Operations

データベース内のデータに対して行う操作をデータ操作といいます。データ操作には大きく分けて次の6種類があります。

Operations performed on data within a database are called data operations. There are six main types of data operations.

操作 / Operation説明 / Description
選択
Selection
テーブルから条件に合致する特定のレコード(行)だけを取り出す操作
Extracts only the records (rows) from a table that meet specified conditions
射影
Projection
テーブルから必要な特定の属性・フィールド(列)だけを取り出す操作
Extracts only the specified attributes / fields (columns) from a table
結合
Join
関連するキーをもとに複数のテーブルを1つにまとめる操作
Merges multiple tables into one based on related keys
挿入
Insertion
テーブルに新しいレコード(行)を追加する操作
Adds new records (rows) to a table
更新
Update
テーブル内の既存のレコード(行)のデータを変更する操作
Modifies the data in existing records (rows) of a table
削除
Deletion
テーブルからレコード(行)を取り除く操作
Removes records (rows) from a table

このうち、ITパスポート試験で特に出題されやすいのは選択・射影・結合の3つです。「レコード(行)を取り出す=選択」「属性・フィールド(列)を取り出す=射影」「テーブルを合体させる=結合」という対応関係をしっかり押さえておきましょう。

Of these, selection, projection, and join are the three that appear most frequently in the IT Passport exam. Make sure to remember: “extracting records (rows) = selection,” “extracting attributes / fields (columns) = projection,” and “merging tables = join.”

(2)トランザクション管理 Transaction Management

トランザクションとは、一つのまとまりとして処理されるべき、分割できない複数の操作の集合のことです。たとえば、銀行の送金処理では「送り手の口座からの出金」と「受け手の口座への入金」という2つの操作は、どちらか一方だけが実行されると深刻な矛盾が生じます。この2つの操作を1つのトランザクションとして管理することで、「全部成功」または「全部なかったこと」のどちらかに確定させることができます。

A transaction is a set of multiple operations that cannot be divided and must be processed as a single unit. For example, in a bank transfer, “withdrawing from the sender’s account” and “depositing into the recipient’s account” are two operations that would cause serious inconsistencies if only one were executed. Managing both operations as a single transaction ensures the outcome is either “both succeed” or “neither takes effect.”

トランザクション管理に関して、試験で特に重要な用語が2つあります。

Two terms related to transaction management are particularly important for the exam.

用語 / Term説明 / Description
コミット(Commit)トランザクション内の全操作が正常に完了したときに、その変更内容をデータベースに正式に確定・保存すること
Formally confirms and saves all changes to the database when all operations within a transaction complete successfully
ロールバック(Rollback)トランザクションの途中でエラーや障害が発生した場合に、そのトランザクションの開始前の状態にデータベースを戻すこと
Restores the database to its state before the transaction began when an error or failure occurs partway through

障害が発生した場合、トランザクションは「まったく実行されていない状態(ロールバック)」か「完全に実行済みの状態(コミット)」のどちらかの状態に復元されます。これにより、データの整合性が常に保たれます。

When a failure occurs, a transaction is restored to either “a state in which it was never executed (rollback)” or “a state in which it was fully executed (commit).” This ensures that data consistency is always maintained.

(3)排他制御 Exclusive Control

排他制御とは、複数のユーザーが同じデータを同時に更新しようとした際に、データの整合性(一貫性)を保つための制御機能です。試験で出題されやすい重要なDBMS関連機能です。

Exclusive control is a control function that maintains data integrity (consistency) when multiple users attempt to update the same data simultaneously. It is an important DBMS-related function that is frequently tested.

排他制御ではロックという仕組みを使います。あるユーザーがデータの読み書きを開始するとき、そのデータにロックをかけることで他のユーザーによる同時更新や競合する操作を制御します。処理が完了したらロックを解除(アンロック)し、他のユーザーがアクセスできる状態に戻します。

Exclusive control uses a mechanism called locking. When a user begins reading from or writing to data, a lock is placed on that data to control simultaneous updates or conflicting operations by other users. Once processing is complete, the lock is released (unlocked), restoring access for other users.

ロックがない場合の問題例:在庫数が3個の商品に対して、AさんとBさんが同時に「1個売れた」という処理を実行すると、お互いが「3個ある」という情報をもとに計算するため、最終的な在庫数がどちらも「2個」と書き込まれてしまい、実際には2個売れたのに在庫が2個のままになるという矛盾が生じます。ロックを使うことで、一方の処理が完了してから他方の処理が開始されるため、正しく「1個」の在庫が残ります。

An example of the problem without locking: suppose a product has 3 units in stock and users A and B simultaneously process “1 unit sold.” Because each reads the same “3 units” before the other’s update is reflected, both write “2 units” as the result — leaving the inventory at 2 even though 2 units were sold. With locking, one user’s process completes before the other begins, correctly leaving 1 unit in stock.

試験直前チェック Key Points to Remember

データベース分野の重要ポイントをまとめます。

Here is a summary of the key points for the Database domain.

  1. データベースとはデータを一元管理する仕組み システム図の円柱はデータベースを表す。ITパスポート試験では関係データモデル(表形式)が主な出題対象
    A database is a mechanism for centralized data management — The cylinder symbol in system diagrams represents a database. The relational data model (table format) is the primary focus of the IT Passport exam
  2. 表=テーブル、行=レコード、列=属性(フィールド) データが追加されるとレコード(行)が増えるが属性(列)の数は変わらない。日常語のRow・Columnではなく、専門用語のRecord・Attribute / Fieldで覚えること
    Table = table, row = record, column = attribute (field) — Adding data increases records (rows) but not attributes (columns). Remember using the specialist terms Record and Attribute / Field, not the everyday words Row and Column
  3. 主キーの2条件は「重複なし」と「NULLなし」 単独で条件を満たす属性(列)がない場合は複合主キーを設定する。外部キーは別テーブルの主キーを参照する属性(列)
    Two conditions for a primary key: no duplicates and no NULLs — If no single attribute (column) qualifies, use a composite primary key. A foreign key is an attribute (column) that references the primary key of another table
  4. 正規化の目的は「データの冗長性排除と整合性の維持」 テーブルを適切に分割することで、更新の矛盾・データの重複・レコード(行)削除時の情報消失を防ぐ
    The purpose of normalization is to eliminate redundancy and maintain consistency — Dividing tables appropriately prevents update inconsistencies, data duplication, and loss of information on deletion of records (rows)
  5. E-R図はエンティティとリレーションシップで構成される 多重度は1対1・1対多・多対多の3種類。試験では必要な表記方法が問題文中で示されることが多いため、多重度の意味を理解しておくことが重要
    E-R diagrams consist of entities and relationships — Multiplicity has three types: one-to-one, one-to-many, and many-to-many. In the exam, the necessary notation is often explained within the question, so understanding the meaning of each multiplicity is important
  6. DBMSはアプリとデータベースの仲介役 アプリがデータベースを操作する際はDBMSを経由するのが基本。SQLはRDBMSへの命令に使う言語
    The DBMS acts as an intermediary between applications and the database — Going through the DBMS is the standard approach when applications interact with the database. SQL is the language used to issue instructions to an RDBMS
  7. データ操作の重要3種:選択(レコード/行)・射影(属性・フィールド/列)・結合(テーブルの合体) 「レコード(行)=選択」「属性・フィールド(列)=射影」「複数テーブル=結合」の対応を確実に覚える
    Three important data operations: selection (records / rows), projection (attributes / fields / columns), join (merging tables) — Memorize: “records (rows) = selection,” “attributes / fields (columns) = projection,” “multiple tables = join”
  8. コミットは確定・ロールバックは取消し 障害時にはどちらかの状態に復元される。トランザクションは「分割できない処理の単位」
    Commit confirms; rollback cancels — On failure, the database is restored to one of these two states. A transaction is “an indivisible unit of processing”
  9. 排他制御はデータの整合性を守る機能・ロックで実現 試験で出題されやすい重要なDBMS関連機能。複数ユーザーの同時更新による矛盾を防ぐ
    Exclusive control protects data integrity and is implemented through locking — An important DBMS-related function that is frequently tested. Prevents inconsistencies caused by simultaneous updates from multiple users

練習問題で理解を確認しよう Practice Questions

ここまでの内容を試験形式で確認しましょう。解答と解説は各問題の直下に記載しています。

Let’s test what you’ve learned with some exam-style practice questions. The answer and explanation for each question appear directly below it.

本練習問題3問は、独立行政法人情報処理推進機構(IPA)公開 ITパスポート試験 公式公開過去問題(データベース分野)より引用しています(第1問=令和6年度 問81、第2問=令和5年度 問59、第3問=令和5年度 問66)。出典:令和6年度 ITパスポート試験 問81、令和5年度 ITパスポート試験 問59、令和5年度 ITパスポート試験 問66。※英訳は本記事による補訳です。

All three practice questions are taken from the IT Passport Examination — Official Published Past Questions, Database Domain, published by the Information-technology Promotion Agency, Japan (IPA) (Question 1 = Reiwa 6 (2024) Item 81, Question 2 = Reiwa 5 (2023) Item 59, Question 3 = Reiwa 5 (2023) Item 66). Source: IT Passport Examination, Reiwa 6 Item 81, Reiwa 5 Item 59, Reiwa 5 Item 66. ※ English translations are supplementary translations provided by this article.

第1問(令和6年度 問81) Question 1 (Reiwa 6, Item 81)

一つの表で管理されていた受注データを、受注に関する情報と商品に関する情報に分割して、正規化を行った上で関係データベースの表で管理する。正規化を行った結果の組合せとして、最も適切なものはどれか。ここで、同一商品で単価が異なるときは商品番号も異なるものとする。また、発注者名には同姓同名はいないものとする。
Received-order data, previously managed in a single table, is divided into order-related information and product-related information, normalized, and then managed in relational database tables. Which combination of tables best represents the result of normalization? Here, when the unit price differs for the same product, the product number also differs. Also, no two orderers share the same name.

【受注データ / Received-Order Data】

受注番号
Order No.
発注者名
Orderer Name
商品番号
Product No.
商品名
Product Name
個数
Qty
単価
Unit Price
T0001試験花子M0001商品153,000
T0002情報太郎M0002商品234,000
T0003高度秋子M0001商品123,000
  • ア 表1:受注番号・発注者名 / 表2:商品番号・商品名・個数・単価
  • イ 表1:受注番号・発注者名・商品番号 / 表2:商品番号・商品名・個数・単価
  • ウ 表1:受注番号・発注者名・商品番号・個数・単価 / 表2:商品番号・商品名
  • エ 表1:受注番号・発注者名・商品番号・個数 / 表2:商品番号・商品名・単価

解答:エ / Answer: エ

正規化では、「ある属性(列)の値が決まると、別の属性(列)の値も一意に決まる」という関係(関数従属)に着目して表を分割します。問題文の条件「同一商品で単価が異なるときは商品番号も異なる」から、商品番号が決まれば商品名と単価が一意に定まります。よって、商品番号・商品名・単価は同じ表に置くべきです。次に、「発注者名に同姓同名はいない」という条件から、受注番号と発注者名は同一の表で管理しても問題ありません。受注番号と商品番号の両方がそろうことで個数が一意に定まるため、個数は受注側の表に入れます。以上から、表1に「受注番号・発注者名・商品番号・個数」、表2に「商品番号・商品名・単価」を置く組み合わせが正規化として最も適切です。したがって正解はエです。
Normalization involves dividing tables by identifying functional dependencies — relationships in which knowing the value of one attribute (column) uniquely determines the value of another. The condition “when the unit price differs for the same product, the product number also differs” means that knowing the product number uniquely determines both the product name and unit price. Therefore, product number, product name, and unit price belong in the same table. The condition “no two orderers share the same name” means that order number and orderer name can coexist in the same table without issue. Because the quantity is uniquely determined by the combination of order number and product number, quantity belongs in the order-side table. The most appropriate normalization result therefore places “order number, orderer name, product number, and quantity” in Table 1 and “product number, product name, and unit price” in Table 2. The correct answer is エ.

第2問(令和5年度 問59) Question 2 (Reiwa 5, Item 59)

関係データベースで管理された”会員管理”表を正規化して、”店舗”表、”会員種別”表及び”会員”表に分割した。”会員”表として、適切なものはどれか。ここで、表中の下線は主キーを表し、一人の会員が複数の店舗に登録した場合は、会員番号を店舗ごとに付与するものとする。
The “member management” table managed in a relational database was normalized and divided into a “store” table, a “member type” table, and a “member” table. Which option represents an appropriate “member” table? Here, underlined columns indicate primary keys, and when one member registers at multiple stores, a separate member number is assigned for each store.

【会員管理表 / Member Management Table(正規化前 / Before normalization)】

店舗コード店舗名会員番号会員名会員種別コード会員種別名
001札幌1試験 花子02ゴールド
001札幌2情報 太郎02ゴールド
002東京1高度 次郎03一般
002東京2午前 桜子01プラチナ
003大阪1午前 桜子03一般

【分割済みの表 / Already Divided Tables】

店舗表 / Store Table会員種別表 / Member Type Table
店舗コード店舗名会員種別コード会員種別名
  • ア 会員番号・会員名
  • イ 会員番号・会員名・会員種別コード
  • ウ 会員番号店舗コード・会員名
  • エ 会員番号店舗コード・会員名・会員種別コード

解答:エ / Answer: エ

まず主キーを確認します。会員番号は店舗ごとに付与されるため、同じ会員番号が複数の店舗に存在します。したがって会員番号だけではレコード(行)を一意に識別できず、主キーは「会員番号+店舗コード」の複合主キーになります。次に含める属性(列)を検討します。会員名は「会員番号+店舗コード」の組み合わせで一意に定まるため、会員表に含めます。会員種別コードについては、会員種別表が既に分離されているため会員表から外してもよいように思えますが、会員種別コードは会員一人一人の属性として会員表に残しておく必要があります。これは、会員種別表との関連(外部キーによる参照)を維持するためです。したがって会員表は「会員番号・店舗コード・会員名・会員種別コード」となり、正解はエです。
First, confirm the primary key. Because member numbers are assigned per store, the same member number can exist at multiple stores. Therefore, member number alone cannot uniquely identify a record (row), and the primary key must be the composite “member number + store code.” Next, consider which attributes (columns) to include. Member name is uniquely determined by the combination of member number and store code, so it belongs in the member table. As for member type code — although the member type table has already been separated, the member type code must remain in the member table as an attribute of each individual member. This is necessary to maintain the relationship with the member type table (through a foreign key reference). The member table therefore contains “member number, store code, member name, and member type code.” The correct answer is エ.

第3問(令和5年度 問66) Question 3 (Reiwa 5, Item 66)

トランザクション処理におけるコミットの説明として、適切なものはどれか。
Which of the following correctly describes a commit in transaction processing?

  • ア あるトランザクションが共有データを更新しようとしたとき、そのデータに対する他のトランザクションからの更新を禁止すること
    When a transaction attempts to update shared data, prohibiting updates to that data from other transactions
  • イ トランザクションが正常に処理されたときに、データベースへの更新を確定させること
    When a transaction is processed successfully, confirming the updates to the database
  • ウ 何らかの理由で、トランザクションが正常に処理されなかったときに、データベースをトランザクション開始前の状態にすること
    When a transaction fails to process successfully for any reason, restoring the database to its state before the transaction began
  • エ 複数の表を、互いに関係付ける列をキーとして、一つの表にすること
    Merging multiple tables into a single table using columns that relate them as keys

解答:イ / Answer: イ

コミットとは、トランザクション内の全操作が正常に完了した際に、変更内容をデータベースに正式に確定・保存する処理です。したがって正解はイです。各選択肢の内容を確認しておきましょう。アは「あるトランザクションが更新しようとしているデータへの他からのアクセスを禁止する」処理を説明しており、これは排他制御(ロック)の説明です。ウは「処理が途中で失敗したときにデータベースを開始前の状態に戻す」処理を説明しており、これはロールバックの説明です。エは「関連する属性(列)をキーにして複数のテーブルを1つにまとめる」操作を説明しており、これはデータ操作における結合(JOIN)の説明です。
A commit is the process of formally confirming and saving changes to the database after all operations within a transaction complete successfully. The correct answer is therefore イ. Let’s review the other options. Option ア describes prohibiting access to data that a transaction is about to update — this is a description of exclusive control (locking). Option ウ describes restoring the database to its state before the transaction began when processing fails midway — this is a description of rollback. Option エ describes merging multiple tables into one using related attributes (columns) as keys — this is a description of the join operation in data manipulation.

よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!

この記事を書いた人

目次