L
L
Lileika2015-08-06 07:47:41
SQL
Lileika, 2015-08-06 07:47:41

Why is the query not executed when populating the SQL table?

Given a table with an index:
create table TABLE_1 (col1 int, col2 int);
create unique index INDEX_1_2 on TABLE_1(col1, col2);
We start filling it with data by executing the queries below one by one. Which of the queries will succeed? Why won't any query be executed?
insert into TABLE_1 values ​​(1, 2);
insert into TABLE_1 values ​​(null, 1);
insert into TABLE_1 values ​​(null, null);
insert into TABLE_1 values ​​(null, 1);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Ivanov, 2015-08-06
@Lileika

all queries
will be executed You will not execute only the query in which there will be any values ​​other than NULL in both fields and already existing in the database. None of the conditions match
. Executing it insert into TABLE_1 values (1, 2);again will result in an error.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question