• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SQL check constraint

 
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

It is only about SQL (DDL) and to be more specific - about PostgreSQL.

I have to create a table coordinates with rows: x integer, y integer, id integer, data_set integer. And I allso must specify that in one data_set, there is no dublicated set of coordinates.

My first attempt was like that:

But this one fails, because it does not care about data_set_ID.

So if there is any SQL guru out there, help is very welcome. How would you complete this, or what would you add to the code above?


thanx
[ June 11, 2006: Message edited by: Juhan Voolaid ]
 
Juhan Voolaid
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Daaaahhhh ...

The solution is more simple than I could excpect in my wildest dreams:

UNIQUE (x, y, data_set_id)
 
author & internet detective
Posts: 41861
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Juhan,
Thanks for posting the solution for others who see this thread in the future.
reply
    Bookmark Topic Watch Topic
  • New Topic