views:

230

answers:

1

I am doing my first database project.

I would like to know how you can have false as the default value for the following SQL -query

...
MODERATOR_REMOVAL boolean NOT NULL
...

Context

 CREATE TABLE Questions 
 (
     USER_ID integer FOREIGN KEY 
                     REFERENCES User_info(USER_ID) 
                     PRIMARY KEY 
                     CHECK (USER_ID>0), 
     QUESTION_ID integer FOREIGN KEY REFERENCES Tags(QUESTION_ID) 
                         NOT NULL 
                         CHECK (USER_ID>0), 
     QUESTION_BODY text NOT NULL,           -- question must have body 
     TITLE varchar(60) NOT NULL,            -- no empty title$                                
     MODERATOR_REMOVAL boolean NOT NULL,    -- by default false$     ///       Here
     SENT_TIME timestamp NOT NULL
 );

How can you set the default value to be false for MODERATOR_REMOVAL by PostgreSQL?

+1  A: 
ALTER TABLE questions ALTER COLUMN moderator_removal SET DEFAULT FALSE
Quassnoi
Thank you for your answer!
Masi