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 table postgres

CREATE TABLE new_table AS 
SELECT
*
FROM
    existing_table
WHERE
    condition;
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

postgres copy table

Syntax:
CREATE TABLE new_table AS 
TABLE existing_table;
Comment

PREVIOUS NEXT
Code Example
Sql :: mysql database manager 
Sql :: oracle sql date get month 
Sql :: postgres foreign key multiple columns 
Sql :: how to use group_concat in sql server 
Sql :: CONCAT_WS() concat function in mysql 
Sql :: Alter table add column in SQL Server- NAYCode.com 
Sql :: select last 2 characters sql 
Sql :: mysql select multiple rows into one column 
Sql :: sql merge 
Sql :: sql select second max 
Sql :: oracle convert int to date 
Sql :: postgres set column equal to another 
Sql :: postgres json to string 
Sql :: how to use rank function in sql 
Sql :: vbscript connect mssql 
Sql :: how to extract year from date in sql 
Sql :: pad zero sql server 
Sql :: mysql utc timestamp 
Sql :: generate a random otp in sql server 
Sql :: sql query to get the number of rows in a table 
Sql :: select last 30 days sql 
Sql :: create mysql database on windows 
Sql :: read all columns of a table sql 
Sql :: sql server information_schema temp tables 
Sql :: sql server alter table add column tinyint 
Sql :: sql convert float to string 
Sql :: how to enable extension in postgreSQL 
Sql :: primary key multiple 
Sql :: sql lag 
Sql :: avg sql 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =