I want to set score number to be maximum 100 and minimum 0. Am I right with just giving score number 3 placements, 3 digits and that is already enough as long as I don't looks for a number larger than 100 with NO decimal places.
create table grades (
S varchar2(12),
C varchar2(10),
Score number(3),
Letter_Grade char(1)
Constraint PK_grades Primary Key (S)
)
You need to use a check constraint:
create table myTable (
a number check (a between 0 and 100),
b number
);
Do you want to allow decimal places? If not specify the precision too
Score number(3, 0),
The other thing is, number(3) will allow a range of -999 to 999. So you need to add a check constraint. Something like this
constraint CK_grades check ( score between 0 and 100 )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With