Skip to content
Advertisement

How do you Alter a column in Oracle SQL to only allow it to take in two values, either a Y or a N?

Most of the results I have seen were for MySQL. I understand that Alter Table is to be used, as well as MODIFY, but after that I am stuck

My table in question is this:

For the comm column, I want to set it where it can only allow either “Y” or “N”. I hope this is enough to help solve the problem.

Advertisement

Answer

You are looking for a check constraint:

Or after the table is created:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement