title: SQL output the id of inserted new data or output the id if duplicated without insertion
body: <p>I have a simple table with the following</p>
  
  <pre><code>TABLE Color(
      Color_id int IDENTITY(1,1) NOT NULL PRIMARY KEY,
      Coloring_type [varchar](20) NULL,
      ColorA int NOT NULL,
      ColorB int NULL,
      ColorC int NULL)
  </code></pre>
  
  <p>and I want to execute the following query to insert some data and return the Inserted Color_id to do some stuff with in C#</p>
  
  <pre><code>INSERT INTO Color OUTPUT INSERTED.Color_id
  VALUES ('solid' ,'red' ,'green' ,'blue')
  </code></pre>
  
  <p>anyway, in fact, insertion like this may make the data duplicated when inserting the same values again so I want to make a query that either insert the data if it is new and output the inserted id or output the id of the same data if they're already inserted to the table, what changes should I make to the query?</p>