Search
 
SCRIPT & CODE EXAMPLE
 

SQL

postgres copy table from one schema to another

create table schema2.the_table (like schema1.the_table including all);
insert into schema2.the_table
select * 
from schema1.the_table;
Comment

copy value from one column to another postgres

UPDATE table SET columnB = columnA;
Comment

copy from one table to another postgres using matching column

UPDATE Table2 --format schema.table_name
SET 
ref_id2 = table1.ref_id1
FROM table1 -- mention schema name
WHERE table1.id = table2.id
AND 
table1.a_ref1 = table2.b_ref1;
Comment

PREVIOUS NEXT
Code Example
Sql :: what is cursor in sql server with example 
Sql :: union postgresql 
Sql :: Create table with JSON column SQL Server 
Sql :: sql distinct vs unique 
Sql :: declare date variable sql 
Sql :: how to put is null in where in clause 
Sql :: control files oracle 
Sql :: list mysql tables and views 
Sql :: sql max min 
Sql :: select only unique values from and to current table 
Sql :: ERROR: permission denied for table accounts postgresql 13 
Sql :: mysql sql.gz 
Sql :: sqlite clear console 
Sql :: spark apache sql coalesce 
Sql :: how to add new column with default value in sql server 
Sql :: Rows, INSERT INTO, Returning 
Sql :: SQL DATEDIFF(date_part, start_date, end_date) 
Sql :: oracle list partitioned tables 
Sql :: mysqli_free_result 
Sql :: tsql generate rows 
Sql :: Write an SQL query to fetch the count of employees working in the department ‘Admin’. 
Sql :: sql with as 
Sql :: how to verify sequence result in oracle SQL 
Sql :: postgresql like 
Sql :: Truncate a table then insert data 
Sql :: except in sql 
Sql :: mariadb cast null to 0 
Sql :: sql select statements 
Sql :: mysql copy data from one table to another 
Sql :: join three tables sql 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =