Hi
I have two tables,
First one has the following contents:
Code:
CREATE TABLE A
(
FCode VARCHAR NOT NULL,
VarietyName VARCHAR
PRIMARY KEY (FCode)
);
INSERT INTO A
VALUES
(
'AP01',
'Bramley Cookers'
);
INSERT INTO A
VALUES
(
'PR01',
'Comice'
);
Second one has the following contents:
Code:
CREATE TABLE B
(
typeOfFruit_character CHAR(2) PRIMARY KEY,
Type VARCHAR
);
INSERT INTO B
VALUES
(
'AP',
'Apples'
);
INSERT INTO B
VALUES
(
'PR',
'Pears'
);
I want to use sub_string extraction feature to answer the following query:
(Assume that AP01 and PR01 are to kind of fruits)
*what is the type of fruit AP01?
I want to write a code that when I write the first two characters of “FCode”( for example AP ) from table A I get the type of fruit from table B . in this case Apples.
Please help me. I have no idea how to do it!
