Search notes:

SQL: INSERT statement

The purpose of the insert statement is to add data (that is: create new records) to a table.

Insert a single record into a table

INSERT INTO target_table                VALUES (1, 'one');
INSERT INTO target_table (col_1, col_2) VALUES (2, 'two');

Insert multiple records in one go

The individual records to be inserted can be separated with commas:
INSERT INTO target_table VALUES
('record'    , 'one'   ),
('another'   , 'record'),
 …;
Note, that this variant does not work with Oracle SQL (18c).

Insert the result of a query

The result of a select statement can be inserted into a table:
INSERT INTO target_table
  SELECT …
  FROM   …
;

See also

A trigger allows to specify a sequence of actions to be executed when one or more records are inserted into a table.
DML statements

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758199937, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/SQL/DML/insert/index(67): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78