There is a "BUSHO" Table and a "SHAIN" Table. The "SHAIN" Table is defined by the following SQL statement
CREATE TABLE SHAIN
(S_CODE CHAR(3) PRIMARYKEY,
S_NAMEN CHAR(3),
BU_CODE CHAR(3),
S_AGE DECIMAL(2),
FOREIGN KEY(BU_CODE) REFERENCE SBUSHO,
CHECK(S_AGE BETWEEN 18 AND 60))
Also The "BUSHO" and "SHAIN" tables currently contain the following data.
BUSHO
BU_CODE | BU_NAME |
B01 | HR department |
B02 | general affairs department (bureau) |
B03 | accounting department |
SHAIN
S_CODE | S_NAME | BU_CODE | S_AGE |
111 | Yamada | B02 | 60 |
122 | Kawakami | B03 | 55 |
233 | Tanaka | B01 | 35 |
259 | Okamoto | B02 | 34 |
In this case, which of the following tuples can be added to the "SHAIN" Table?
| S_CODE | S_NAME | BU_CODE | S_AGE |
A | 012 | Yamada | B03 | 60 |
B | 111 | Yamada | B02 | 55 |
C | 320 | Yamamoto | B04 | 34 |
D | 920 | Yamashita | B03 | 17 |
This is a hint because it is slightly more difficult and does not explanation about the CREATE statement.
・The CREATE statement is SQL that creates a table.
・PRIMARYKEY is not allowed to have duplicate values in the primary key.
・REFERENCE is a value defined as a primary key in an external, and values not in the external table are not allowed.
・Data cannot be stored in the Table unless the conditions in CHECK are met.
Answer
A
Explanation
Since PRIMARYKEY is specified in S_CODE, B is a duplicate key.
C cannot be added because B04 does not exist for BU_CODE, which is specified as a foreign key in REFERENCE.
Of the rest, only A will meet the condition S_AGE BETWEEN 18 AND 60, so the answer is A.