I have created 3 tables with the following queries:

S table:

```
CREATE TABLE S (
    SN INT,
    SNAME CHAR(10),
    RATING FLOAT,
    CITY CHAR(10),
    PRIMARY KEY (SN)
)

```

J table:

```
CREATE TABLE J (
    JN INT,
    JNAME CHAR(10),
    CITY CHAR(10),
    PRIMARY KEY (JN)
)

```

P table:

```
CREATE TABLE P (
    PN INT,
    PNAME CHAR(10),
    COLOR CHAR(10),
    CITY CHAR(10),
    WEIGHT FLOAT,
    PRIMARY KEY (PN)
)

```

and they successfully created without any errors. 

The problem is that when I try to run the following query I face with a weird error:

```
 CREATE TABLE SPJ (
    QTY INT,
    FOREIGN KEY (SN) REFERENCES S(SN),
    FOREIGN KEY (PN) REFERENCES P(PN),
    FOREIGN KEY (JN) REFERENCES J(JN),
    PRIMARY KEY (SN, PN, JN)
)

```

> 
> ERROR: column "sn" named in key does not exist LINE 6: PRIMARY KEY (SN, PN, JN)
> 
> 
>