I am a novice and the question is very simple, do not judge strictly. The fact is that when I try to change the length of a table column, I get ERROR: syntax error at or near "MODIFY" . What could be the reason?

CREATE TABLE movies ( title VARCHAR(20) NOT NULL ); ALTER TABLE movies MODIFY title VARCHAR(10) NOT NULL; 

    1 answer 1

    I will give my own version, since the answer tCode did not take off from me:

     CREATE TABLE movies ( title VARCHAR(20) NOT NULL ); ALTER TABLE movies ALTER COLUMN title TYPE VARCHAR(10); 

    And a link to the documentation. In postgre it is a little different.

    • Now it works, thank you. - Alexander Shmatko
    • one
      @AlexanderShmatko In the comments to the remote answer, you complained that a variant of a non-working request was listed in the book. You shouldn't blame the book, the fact is that in postgre, a column type modification is done differently. Your request will be perfectly executed on MySql 5.6 for example. So do not write off throwing the book. :) - GreyGoblin