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
7
Replies
8
Views
6 Years
Discussion Span
Last Post by smantscheff
1

If the field may only have four values, use an enum type.

create table publisher(name varchar(20), city enum('mumbai','pune','nasik','panji'))
0

hi......smantscheff.
i tried on ur solution, but it doesn't work. Plz, help me in different way.

0

I know, this is mysql forum. I wrongly put this question in this forum. but i want the output in 'MS SQL Server'.


Thanks & regerds,
Pooja.

This topic has been dead for over six months. 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.