I have an assignment problem that i can’t manage to fix and got totally stuck on.
I’ve got two tables (table1 and table2 which i created and filled with data:
CREATE TABLE Table1(
pnr VARCHAR2(11) PRIMARY KEY,
fnamn VARCHAR2(20),
enamn VARCHAR2(20),
bor_i VARCHAR2(20),
jobbar_i VARCHAR2(20));
CREATE TABLE Table2(
regnr VARCHAR2(6) PRIMARY KEY,
pnr REFERENCES bilägare(pnr),
tillverkare VARCHAR2(20),
modell VARCHAR2(20),
årsmodell NUMBER(4),
hk NUMBER(4),
datum DATE);
Now i created a third table (table3) which I want to fill with data from table1 and table2 using an anonymous PL-SQL block and explicit cursor. I created the third table like this:
CREATE TABLE table3(
pnr VARCHAR2(11),
fnamn VARCHAR2(20),
enamn VARCHAR2(20),
regnr VARCHAR2(6),
tillverkare VARCHAR2(20),
modell VARCHAR2(20));
How can I fill it (table3) with data from table1 and table2? I also only want to fill it with data from those who have got more than 200 hk (have a look at table1). How do I manage to fix this? Thankful for all the help I can get.
Thanks for your help 🙂 I solved it the following way