Search
 
SCRIPT & CODE EXAMPLE
 

SQL

postgresql insert select

insert into items_ver(item_id, item_group, name)
select * from items where item_id=2;
Comment

postgres trigger insert into another table

CREATE OR REPLACE FUNCTION function_copy() RETURNS TRIGGER AS
$BODY$
BEGIN
    INSERT INTO
        table2(id,name)
        VALUES(new.id,new.name);

           RETURN new;
END;
$BODY$
language plpgsql;
Comment

postgres trigger insert into another table

CREATE TRIGGER trig_copy
     AFTER INSERT ON table1
     FOR EACH ROW
     EXECUTE PROCEDURE function_copy();
Comment

POSTGRES INSERT INTO TABLE VALUE FROM OTHER TABLE

##fetch data from other table with sub-query to insert it into another one

INSERT INTO PUBLIC."MyTable"(conversion_job_id, message, last_status)
VALUES (17, 'test', (SELECT status FROM PUBLIC."OtherTable" WHERE id=17))
RETURNING *
Comment

insert to postgres table

INSERT INTO holiday_calender (hcl_country,hcl_company,hcl_date,hcl_description,hcl_active) VALUES
	 (2,1,'2022-05-21 00:00:00','Holiday 1',1),
	 (2,1,'2022-05-22 00:00:00','Holiday 2',1),
	 (2,1,'2022-05-23 00:00:00','Holiday 3',1),
	 (2,1,'2022-05-25 00:00:00','Holiday 4',1),
	 (2,1,'2022-05-26 00:00:00','Holiday 5',1),
	 (2,1,'2022-05-28 00:00:00','Holiday 6',1);
Comment

postgres insert into table

INSERT INTO table_name(column1, column2, …)
VALUES (value1, value2, …);
Code language: SQL (Structured Query Language) (sql)
Comment

postgresql, Rows, INSERT INTO


            
                
            
         INSERT INTO table_name(column1, column2, …)
VALUES (value1, value2, …)
RETURNING *;Code language: SQL (Structured Query Language) (sql)
Comment

PREVIOUS NEXT
Code Example
Sql :: oracle show error line number 
Sql :: SQL Error [42501]: ERROR: permission denied for table 
Sql :: sql query to create table in database 
Sql :: check if word is in column sql 
Sql :: reset postgres table index to next max value 
Sql :: mysql add hours to time field 
Sql :: mysql group concat 
Sql :: sql remove check constraint 
Sql :: sql statement to change a field value 
Sql :: generate sql from specific migration ef core 
Sql :: sql view index 
Sql :: sql default value if null 
Sql :: how-to-remove-mysql-root-password 
Sql :: psql check tables command 
Sql :: php5-mysql has no installation candidate 
Sql :: mysql decimal 
Sql :: sql arithmetic operators 
Sql :: how to find max and min salary in sql 
Sql :: sql to c# model 
Sql :: Create table with JSON column SQL Server 
Sql :: sql get month 
Sql :: mysql date_format 
Sql :: get size of mysql database 
Sql :: Select All From A Table In A MySQL Database 
Sql :: mysql date time string format for marshmellow field schema 
Sql :: time in sql server 
Sql :: group by sql not ordering issues 
Sql :: psql command not found windows 
Sql :: create table kusto 
Sql :: update from select postgresql 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =