0

So I am working in postgreSQL and I want to create a table and in one column of this table I want to have multiple values as booleans. For example:

create table if not exists x(
     Numx numeric(5) PRIMARY KEY,
     method (here for example I want method to be able to be something like this "method {a,b,c,d}"
);

So method could have either value a or b or a,b etc.

How am I able to do so?

Thanks in advance

1 Answer 1

1

Use an array type.

http://www.postgresql.org/docs/current/static/arrays.html

CREATE TABLE sal_emp (
    name            text,
    pay_by_quarter  integer[],
    schedule        text[][]
);

You can see loads of examples in the docs. I personally would only use them if I had hundreds that I wanted to store, for a few booleans I'd likely use a column each or a bitmask.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.