Computer Science, asked by griya1746, 8 months ago

how to insert null value into table explain with command​

Answers

Answered by Anonymous
2

Answer:

There's a few ways:

Let's assume this table:

create table mytable (a int, b int, c int, primary key (c));

You can explicitly insert a NULL by using INSERT INTO mytable (a, b, c) values (1, NULL, 2);

You can also omit the column in an INSERT using something like

insert into mytable (a, c) values (1, 3);

In both rows, the column "b" in the above table will be NULL.

You can also use INSERT INTO mytable SELECT <rows with nulls> from othertable.

I'm sure there's lots of other ways that I can't think of at the moment...

Answered by jagdish101660
1

Answer:

There's a few ways:

Let's assume this table:

create table mytable (a int, b int, c int, primary key (c));

  • You can explicitly insert a NULL by using INSERT INTO mytable (a, b, c) values (1, NULL, 2);
  • You can also omit the column in an INSERT using something like

insert into mytable (a, c) values (1, 3);

In both rows, the column "b" in the above table will be NULL.

  • You can also use INSERT INTO mytable SELECT <rows with nulls> from other table.

I'm sure there's lots of other ways that I can't think of at the moment...

Similar questions