Creating the following table (MySQL 8.0):
create table Customer_Dim(
customer_ID int not null,
FirstName varchar(30) not null,
LastName varchar(30) not null,
Gender char(1) not null CHECK (gender in ('m','f')),
Street1 varchar(100) not null,
Street2 varchar(100) null,
City varchar(30) not null,
StateAbbrev char(2) not null,
ZipCode char(5) not null CHECK (ZipCode LIKE repeat('[0-9]',5)),
PrimaryPhone varchar(10) not null CHECK (PrimaryPhone LIKE repeat('[0-9]',10)),
EmailAddress varchar(50) default null,
constraint custkey Primary Key(customer_ID)
);
but when I enter the following insert statement:
insert into Customer_DIM
values (10001, 'Josh', 'Dexter', 'M', '123 E Elm st.', null, 'Denver', 'CO', '80002', '2023459767', 'test@aol.com')
It fails the check on phone and zipCode. From what I could read it should work?
