db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From AmFr...@web.de
Subject Making a table with max 1 row
Date Mon, 10 Oct 2011 20:05:16 GMT

Hi,

i need a table with 1 or 0 rows in it. So that after 1 row is inserted the  
table can only be updated or the row deleted, but there can never be a row  
inserted.
I came as far as this:

CREATE TABLE test
  (field1 INTEGER NOT NULL
  CHECK (field1 = 1) UNIQUE)

but that would (obviously) mean that field1 could only have the value 1.

I would need something like check(COUNT(*) FROM test <= 1).

Thanks for any suggestions / answers

Biene Maja

Mime
View raw message