Q:

creating fixed number for id in sql programming

I am trying to have 10 numbers for my id column in sql and number only. I want to check the input is only from 0000000000 to 9999999999. I wrote the following codes but I am not sure where goes wrong as it lets A000000000 pass the checking. Please help me! Thanks a lot!
create table member (
  member_id char(10) primary key,
  check (member_id not like '%^[0-9]%' and char_length(member_id) = 10)
);

insert into member values ('A000000000')

A:

change member_id not like '%^[0-9]%'
to
member_id not ~ '^[0-9]{10}'
for regular expression ~ operator is used instead of like
your example like '%^[0-9]%' checks for exact match of ^[0-9] string in any place

