0

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?

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by debasisdas
0

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

0

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...

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.