Hey how can I check if the input has 5 numbers? I tried everything like isnumeric/LIKE '%[0-9]%' they all not working...
I tried the following but it doesn't work.. please help
CREATE TABLE Code ( PIN TEXT NOT NULL, CHECK(LENGTH(title) = 5), CHECK(title LIKE '[0-9][0-9][0-9][0-9][0-9]'));
CodePudding user response:
You can use GLOB
operator:
CREATE TABLE Code (
PIN TEXT NOT NULL,
title TEXT,
CHECK(title GLOB '[0-9][0-9][0-9][0-9][0-9]')
);
See the demo.