1
It is possible - with some syntax adaptation - to fulfill the objective of the following query?
insert into X (a, b) values(16, select c from Y where d = e)
1
It is possible - with some syntax adaptation - to fulfill the objective of the following query?
insert into X (a, b) values(16, select c from Y where d = e)
1
You can use the quotes for such a need, thus creating a Subquery
.
One Subquery
is basically one query within another. When working with subquerys, we should be aware of certain points, such as the case that a subquery can return more than one value, causing your sql query to generate an error (my experience is based only on databases mssql
and oracle
, so I don’t know what the behavior of other databases).
Example:
insert into X (a, b) values(16, (select c from Y where d = e))
1
insert into X (a, b)
select 16, c from Y where d = e
You can do so too, without the word values.
1
You don’t even need to put the word Values, just keep the values inside the select. So:
insert into X (a, b) (select "16", c from Y where d = e)
Browser other questions tagged sql
You are not signed in. Login or sign up in order to post.