Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (20.3k points)

How can I accomplish this using Postgres? I've tried the code below but it doesn't work:

ALTER TABLE mytable ALTER COLUMN mycolumn BIGINT NULL; 

1 Answer

0 votes
by (40.7k points)

Try this code:

ALTER TABLE mytable ALTER COLUMN mycolumn DROP NOT NULL;

Note: Don't specify the type when you're just changing the nullability.

For more information, you can refer to this link:

https://www.postgresql.org/docs/current/sql-altertable.html

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jul 5, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer

Browse Categories

...