INSERT INTO

INSERT INTO allows the output of a SELECT to be used to insert values into an existing table. INSERT INTO table [ ( column [, ...] ) ] SELECT query Example "List of student names": INSERT INTO name_list (name) SELECT name FROM stud; SELECT * from name_list ; name ------ fred tom john lisa (4 rows)


SELECT INTO

SELECT INTO creates a new table and fills it with data computed by a query. The data is not returned to the client, as it is with a normal SELECT. The new table's columns have the names and data types associated with the output columns of the SELECT. SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ] * | expression [ AS output_name ] [, ...] INTO [ TEMPORARY | TEMP ] [ TABLE ] new_table FROM from_table Example "List of student names": SELECT name AS stud_name INTO name_list FROM stud; SELECT * from name_list ; stud_name ----------- fred tom john lisa (4 rows)

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-21
  • 2021-05-20
  • 2021-11-13
  • 2021-12-21
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-08
  • 2022-02-08
  • 2022-01-18
  • 2021-11-04
相关资源
相似解决方案