Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Insert The Data Into the Text File From Postgres Database

Here i'm explained about How to insert the data into the csv file from postgres database.

PRACTICAL 1.

Step1. Just select the table for wchich table do you want to copy
postgres=# select * from batch;
 batch_id |             batch_name              | members 
----------+-------------------------------------+---------
        1 | nijam                               |       1
        2 | nijam                               |       5
        3 | nijam                               |       5
        4 | nijam                               |       5
        4 | nijam                               |       8
(5 rows)
Step2.then give the following command this will insert the data into the csv file from postgres database table.
postgres=# copy batch to '/opt/PostgreSQL/9.3/data/michel.csv' with delimiter ',' CSV header;
COPY 5
step3. just check the file for is it correct or not.
[root@p1 ~]# cat /opt/PostgreSQL/9.3/data/michel.csv
batch_id,batch_name,members
1,nijam                              ,1
2,nijam                              ,5
3,nijam                              ,5
4,nijam                              ,5
4,nijam                              ,8
PRACTICAL 2.
Here also i'm  exlpained same as above example but small different is first i copied table from pg_tables after that i will insert  the data to text nijam2.csvtext file
postgres=# copy (select * from pg_tables) to '/opt/PostgreSQL/9.3/data/nijam2.csv' with delimiter ',' CSV header; 
COPY 83
[root@p1 ~]# cat /opt/PostgreSQL/9.3/data/nijam2.csv
schemaname,tablename,tableowner,tablespace,hasindexes,hasrules,hastriggers
pg_catalog,pg_statistic,postgres,,t,f,f
pg_catalog,pg_type,postgres,,t,f,f
public,t1,postgres,,f,f,f
pg_catalog,pg_authid,postgres,pg_global,t,f,f
pg_catalog,pg_proc,postgres,,t,f,f
pg_catalog,pg_class,postgres,,t,f,f
pg_catalog,pg_user_mapping,postgres,,t,f,f
pg_catalog,pg_attribute,postgres,,t,f,f
pg_catalog,pg_constraint,postgres,,t,f,f
pg_catalog,pg_inherits,postgres,,t,f,f
pg_catalog,pg_index,postgres,,t,f,f
pg_catalog,pg_operator,postgres,,t,f,f
pg_catalog,pg_opfamily,postgres,,t,f,f
pg_catalog,pg_opclass,postgres,,t,f,f
pg_catalog,pg_am,postgres,,t,f,f
pg_catalog,pg_amop,postgres,,t,f,f
pg_catalog,pg_amproc,postgres,,t,f,f
pg_catalog,pg_language,postgres,,t,f,f
pg_catalog,pg_largeobject_metadata,postgres,,t,f,f
pg_catalog,pg_aggregate,postgres,,t,f,f
pg_catalog,pg_database,postgres,pg_global,t,f,f
pg_catalog,pg_trigger,postgres,,t,f,f
pg_catalog,pg_event_trigger,postgres,,t,f,f
pg_catalog,pg_description,postgres,,t,f,f
pg_catalog,pg_cast,postgres,,t,f,f
pg_catalog,pg_enum,postgres,,t,f,f
pg_catalog,pg_conversion,postgres,,t,f,f
pg_catalog,pg_depend,postgres,,t,f,f
pg_catalog,pg_db_role_setting,postgres,pg_global,t,f,f
pg_catalog,pg_tablespace,postgres,pg_global,t,f,f
pg_catalog,pg_pltemplate,postgres,pg_global,t,f,f
pg_catalog,pg_auth_members,postgres,pg_global,t,f,f
pg_catalog,pg_shdepend,postgres,pg_global,t,f,f
pg_catalog,pg_shdescription,postgres,pg_global,t,f,f
pg_catalog,pg_ts_config,postgres,,t,f,f
pg_catalog,pg_ts_config_map,postgres,,t,f,f
pg_catalog,pg_ts_dict,postgres,,t,f,f
pg_catalog,pg_ts_parser,postgres,,t,f,f
pg_catalog,pg_ts_template,postgres,,t,f,f
pg_catalog,pg_extension,postgres,,t,f,f
pg_catalog,pg_foreign_data_wrapper,postgres,,t,f,f
pg_catalog,pg_foreign_server,postgres,,t,f,f
pg_catalog,pg_foreign_table,postgres,,t,f,f
pg_catalog,pg_default_acl,postgres,,t,f,f
pg_catalog,pg_seclabel,postgres,,t,f,f
pg_catalog,pg_shseclabel,postgres,pg_global,t,f,f
pg_catalog,pg_collation,postgres,,t,f,f
pg_catalog,pg_range,postgres,,t,f,f
pg_catalog,pg_largeobject,postgres,,t,f,f
information_schema,sql_implementation_info,postgres,,f,f,f
information_schema,sql_languages,postgres,,f,f,f
information_schema,sql_packages,postgres,,f,f,f
information_schema,sql_parts,postgres,,f,f,f
public,postgres,postgres,,t,f,f
information_schema,sql_sizing_profiles,postgres,,f,f,f
pg_catalog,pg_attrdef,postgres,,t,f,f
public,primtab,u8,,t,f,f
public,films,u8,,t,f,f
public,distributors,u8,,t,f,f
pg_catalog,pg_namespace,postgres,,t,f,f
pg_catalog,pg_rewrite,postgres,,t,f,f
public,k,u8,,t,f,f
public,distributorc,u8,,f,f,f
public,distributorsct,u8,,f,f,f
public,postgres1,postgres,,t,f,f
public,postgres2,postgres,,t,f,f
public,postgres3,postgres,,t,f,f
public,postgres4,postgres,,t,f,f
public,postgres_5,postgres,,t,f,f
public,students,postgres,,t,f,f
public,india,postgres,,t,f,f
information_schema,sql_features,postgres,,f,f,f
information_schema,sql_sizing,postgres,,f,f,f
public,batch,postgres,,t,f,f
public,cellphones,postgres,,t,f,f
public,mobiles,postgres,,t,f,f
public,location,postgres,,t,f,f
public,dept,postgres,,f,f,f
public,products1,postgres,,f,f,f
public,products2,postgres,,f,f,f
public,t7,postgres,,f,f,f
public,village,postgres,,f,f,f
public,emp_d,postgres,,f,f,f






Comments

Popular posts from this blog

Oracle DBMS SCHEDULER Examples

How to find the server is whether standby (slave) or primary(master) in Postgresql replication ?

7 Steps to configure BDR replication in postgresql

How to Get Table Size, Database Size, Indexes Size, schema Size, Tablespace Size, column Size in PostgreSQL Database

vacuumlo - removing large objects orphans from a database PostgreSQL