0

I found this schema of block. I wonder how to make relationship betweeen hash and parent_hash.

In my head, it whould be like this(Postgres).

CREATE TABLE block (
    hash VARCHAR(8) PRIMARY KEY,
    parent_hash VARCHAR(8) NOT NULL,
    FOREIGN KEY (parent_hash) REFERENCES block (hash),
);

Is there no self-reference constraint?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.