Hi to all,
I created the following table
---------------------------------

create table publisher(name varchar(20), city varchar(20))

---------------------------------

I want to put following constraint, 'name is having unique with city taken only from 'mumbai', 'pune', 'nasik', 'panji''. I know about unique constraints with name. I searched many about constraint with city, but i don't get it till now. Will you please help me about constraint. I used 'BETWEEN' constraint, but it failed. What should I do?

create table publisher(name varchar(20), city varchar(20) check(city in('mumbai', 'pune', 'nasik', 'panji')))

Between is used on number or date data types not on string.

ex
1. number between 1 to 10
2. date between 1-jan and 31-jan

etc...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.