0

In SQL there's a query INSERT IGNORE which keeps duplicate entries out of the database based on the primary key. But is there a way to achieve this functionality in OrientDB since the primary key concept here is kind of achieved using the @rid concept?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 1
    Unrelated, but: "*in SQL there's a query Insert ignore*" - no there isn't. SQL (the query language) does not define such a thing. One specific DBMS implements an extension to the SQL language supporting that. –  Jan 29 '16 at 09:41
  • So should it be changed to MySQL (I guess MySQL supports that `INSERT IGNORE` thing)? Or is it okay to keep the question this way? – Rajith Gun Hewage Jan 29 '16 at 10:03

2 Answers2

1

I think you can use a unique index on that class, so you can avoid duplicate entries.

Alessandro Rota
  • 3,560
  • 1
  • 8
  • 10
1

Have you tried the UPSERT?

UPDATE Profile SET nick = 'Luca' UPSERT WHERE nick = 'Luca'

Please create an index against "nick" property.

Lvca
  • 8,938
  • 2
  • 24
  • 25