NULL makes the value for the corresponding column in the table null.DEFAULT makes the value for the corresponding column the default value.); insert into summary ( sum_pop, max_pop, min_pop, avg_pop) values ( (select sum(population) from densities), (select max(population) from densities), (select min(population) from densities), (select avg(population) from densities) ); select * from summary; Each subquery in the INSERT statement is a scalar subquery.Each subquery returns one value (the sum, maximum, minimum, and average values) from the data in one column, Population, to populate the new table.That is, one value is returned for each department. As in the previous example, the subquery counts all of the rows in Employees table minus those that describe a manager and correlates them to the Dept No column of the Depts table.However, the WHERE clause further qualifies the query to retrieve information only about departments that have more than one employee.A non-correlated subquery is executed before the outer query and the subquery is executed only once.
Most importantly, the result of the subquery does not change if the data processed by the outer query changes. The contents of the Dept and Deptno columns are compared with the IN predicate.
The following is an example of a scalar subquery in the INSERT statement.
This example uses data from the Densities example table, which has a column named Population.
A correlated subquery is evaluated for each row identified by the outer query, making the subquery resource-intensive.
Many correlated queries can be restated in terms of a join operation. This dictionary provides a list of argument names accepted by various schema-level constructs on behalf of a dialect.