云服务器内容精选

  • dbc.sessioninfo 输入: SELECT username ,clientsystemuserid ,clientipaddress ,clientprogramname FROM dbc.sessioninfo WHERE sessionno = lv_mig_session ; 输出: select usename AS username, NULL::TEXT AS clientsystemuserid , client_addr AS clientipaddress, application_name AS clientprogramname from pg_catalog.pg_stat_activity WHERE pid = lv_mig_session;
  • dbc.sessioninfoV 输入: select username,clientsystemuserid,clientipaddress,clientprogramname from dbc.sessioninfoV where sessionno = 140167641814784; 输出: select usename AS username, NULL::TEXT AS clientsystemuserid , client_addr AS clientipaddress, application_name AS clientprogramname from pg_catalog.pg_stat_activity WHERE pid = 140167641814784;
  • LOCK DSC工具在迁移MySQL事务处理锁表语句时会根据 GaussDB (DWS)特性进行相应适配。 输入示例 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ## A. START TRANSACTION; LOCK TABLES `mt`.`runoob_tbl` WRITE,`mt`.`runoob_tb2` READ; commit; ## B. START TRANSACTION; LOCK TABLES `mt`.`runoob_tbl` WRITE; commit; ## C. START TRANSACTION; LOCK TABLES `mt`.`runoob_tbl` READ,`mt`.`runoob_tbl` AS t1 READ; commit; 输出示例 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 -- A. START TRANSACTION; LOCK TABLE "mt"."runoob_tbl" IN AC CES S EXCLUSIVE MODE; LOCK TABLE "mt"."runoob_tb2" IN ACCESS SHARE MODE; COMMIT WORK; -- B. START TRANSACTION; LOCK TABLE "mt"."runoob_tbl" IN ACCESS EXCLUSIVE MODE; COMMIT WORK; -- C. START TRANSACTION; LOCK TABLE "mt"."runoob_tbl" IN ACCESS SHARE MODE; COMMIT WORK;
  • TRANSACTION DSC工具在迁移MySQL事务处理语句时会根据GaussDB(DWS)特性进行相应适配。 输入示例 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ##该声明仅适用于会话中执行的下一个单个事务 SET TRANSACTION ISOLATION LEVEL READ COMMITTED; SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; SET TRANSACTION READ ONLY; SET TRANSACTION READ WRITE; SET TRANSACTION ISOLATION LEVEL READ COMMITTED,READ ONLY; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE,READ WRITE; ##使用SESSION关键字,适用于当前会话中执行的所有后续事务 START TRANSACTION; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; commit ; 输出示例 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 --该声明仅适用于会话中执行的下一个单个事务 SET LOCAL TRANSACTION ISOLATION LEVEL READ COMMITTED; SET LOCAL TRANSACTION ISOLATION LEVEL REPEATABLE READ; SET LOCAL TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SET LOCAL TRANSACTION ISOLATION LEVEL SERIALIZABLE; SET LOCAL TRANSACTION READ ONLY; SET LOCAL TRANSACTION READ WRITE; SET LOCAL TRANSACTION ISOLATION LEVEL READ COMMITTED READ ONLY; SET LOCAL TRANSACTION ISOLATION LEVEL SERIALIZABLE READ WRITE; --使用SESSION关键字,适用于当前会话中执行的所有后续事务 START TRANSACTION; SET SESSION CHARACTERIS TICS AS TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION CHARACTERISTI CS AS TRANSACTION ISOLATION LEVEL READ COMMITTED; SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL SERIALIZABLE; SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL SERIALIZABLE; COMMIT WORK;
  • 数据库管理 DSC工具迁移时会将MySQL SET CHARACTER SET语句迁移为SET SESSION NAMES。字符集对照如下表: 表1 字符集对照表 MySQL CHARACTER SET GaussDB(DWS) SESSION NAMES ASCII SQL_ASCII BIG5 BIG5 CP1250 WIN1250 CP1251 WIN1251 CP1256 WIN1256 CP1257 WIN1257 CP932 SJIS EUCJPMS EUC_JP EUCKR EUC_KR GB2312 GB18030 GBK GBK GREEK ISO_8859_7 HEBREW ISO_8859_8 KOI8R KOI8R KOI8U KOI8U LATIN1 LATIN1 LATIN2 LATIN2 LATIN5 LATIN5 LATIN7 LATIN7 SJIS SJIS SWE7 UTF8 TIS620 WIN874 UTF8 UTF8 UTF8MB4 UTF8 输入示例 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 SET CHARACTER SET 'ASCII'; SET CHARACTER SET 'BIG5'; SET CHARACTER SET 'CP1250'; SET CHARACTER SET 'CP1251'; SET CHARACTER SET 'CP1256'; SET CHARACTER SET 'CP1257'; SET CHARACTER SET 'CP932'; SET CHARACTER SET 'EUCJPMS'; SET CHARACTER SET 'EUCKR'; SET CHARACTER SET 'GB2312'; SET CHARACTER SET 'GBK'; SET CHARACTER SET 'GREEK'; SET CHARACTER SET 'HEBREW'; SET CHARACTER SET 'KOI8R'; SET CHARACTER SET 'KOI8U'; SET CHARACTER SET 'LATIN1'; SET CHARACTER SET 'LATIN2'; SET CHARACTER SET 'LATIN5'; SET CHARACTER SET 'LATIN7'; SET CHARACTER SET 'SJIS'; SET CHARACTER SET 'SWE7'; SET CHARACTER SET 'TIS620'; SET CHARACTER SET 'UTF8'; SET CHARACTER SET 'UTF8MB4'; ##mysql中不支持 SET CHARACTER SET 'UCS2'; ##mysql中不支持SET CHARACTER SET 'UTF16'; ##mysql中不支持SET CHARACTER SET 'UTF16LE'; ##mysql中不支持SET CHARACTER SET 'UTF32'; 输出示例 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 SET SESSION NAMES 'SQL_ASCII'; SET SESSION NAMES 'BIG5'; SET SESSION NAMES 'WIN1250'; SET SESSION NAMES 'WIN1251'; SET SESSION NAMES 'WIN1256'; SET SESSION NAMES 'WIN1257'; SET SESSION NAMES 'SJIS'; SET SESSION NAMES 'EUC_JP'; SET SESSION NAMES 'EUC_KR'; SET SESSION NAMES 'GB18030'; SET SESSION NAMES 'GBK'; SET SESSION NAMES 'ISO_8859_7'; SET SESSION NAMES 'ISO_8859_8'; SET SESSION NAMES 'KOI8R'; SET SESSION NAMES 'KOI8U'; SET SESSION NAMES 'LATIN1'; SET SESSION NAMES 'LATIN2'; SET SESSION NAMES 'LATIN5'; SET SESSION NAMES 'LATIN7'; SET SESSION NAMES 'SJIS'; SET SESSION NAMES 'UTF8'; SET SESSION NAMES 'WIN874'; SET SESSION NAMES 'UTF8'; SET SESSION NAMES 'UTF8'; --mysql中不支持 SET CHARACTER SET 'UCS2'; --mysql中不支持SET CHARACTER SET 'UTF16'; --mysql中不支持SET CHARACTER SET 'UTF16LE'; --mysql中不支持SET CHARACTER SET 'UTF32'; 父主题: 事务管理和数据库管理
  • ROLLUP MySQL中的group by column with rollup需要转换为GaussDB(DWS)中的group by rollup (column); 输入示例 1 2 3 select id,product_id,count(1) from czb_account.equity_account_log where id in (6957343,6957397,6957519,6957541,6957719) group by 1, 2 with rollup; 输出示例 1 2 3 4 5 6 7 8 9 10 SELECT id, product_id, count(1) FROM czb_account.equity_account_log WHERE id IN (6957343, 6957397, 6957519, 6957541, 6957719) GROUP BY ROLLUP(1, 2); 父主题: 数据操作语句(DML)
  • INTERVAL MySQL中使用interval表达式格式为INTERVAL N时间单位,DWS不支持,需要转换为INTERVAL 'N'时间单位。 输入示例 1 2 3 4 5 6 SELECT CURRENT_TIME() - INTERVAL 4 DAY; SELECT NOW() - INTERVAL 5 HOUR; SELECT CURRENT_TIME() - INTERVAL '4' DAY; SELECT NOW() - INTERVAL '5' HOUR; SELECT CURRENT_TIME() - INTERVAL "4" DAY; SELECT NOW() - INTERVAL "5" HOUR; 输出示例 1 2 3 4 5 6 SELECT (CURRENT_TIME () - INTERVAL '4' DAY); SELECT (NOW () - INTERVAL '5' HOUR); SELECT (CURRENT_TIME () - INTERVAL '4' DAY); SELECT (NOW () - INTERVAL '5' HOUR); SELECT (CURRENT_TIME () - INTERVAL '4' DAY); SELECT (NOW () - INTERVAL '5' HOUR); 父主题: 数据操作语句(DML)
  • 注释 MySQL支持由 '#' 或 '--' 字符引起的单行注释,而GaussDB(DWS)仅支持由双破折号 '--' 字符引起的单行注释。DSC工具迁移时会将 '#' 转化为 '--' 注释。 输入示例 1 2 3 4 5 6 7 ## comment sample create a table CREATE TABLE IF NOT EXISTS `public`.`runoob_tbl`( `runoob_id` VARCHAR, `runoob_title` VARCHAR(100) NOT NULL, `runoob_author` VARCHAR(40) NOT NULL, `submission_date` VARCHAR )ENGINE=InnoDB DEFAULT CHARSET=utf8; 输出示例 1 2 3 4 5 6 7 8 9 10 11 -- comment sample create a table CREATE TABLE IF NOT EXISTS "public"."runoob_tbl" ( "runoob_id" VARCHAR, "runoob_title" VARCHAR(400) NOT NULL, "runoob_author" VARCHAR(160) NOT NULL, "submission_date" VARCHAR ) WITH ( ORIENTATION = ROW, COMPRESSION = NO ) NOCOMPRESS DISTRIBUTE BY HASH ("runoob_id"); 父主题: MySQL语法迁移
  • Teradata SQL配置 设置Teradata配置参数可在迁移Teradata数据库脚本时自定义迁移工具的行为。 打开config文件夹中的features-teradata.properties文件,并根据实际需要设置表1中的参数。 表1 features-teradata.properties文件中的配置参数 参数 说明 取值范围 默认值 样例 deleteToTruncate 该参数用于设置不含WHERE的DELETE语句迁移规则。 若该参数设为true,则可将DELETE迁移为TRUNCATE。若该参数设为false,则不可将DELETE迁移为TRUNCATE。 true false false deleteToTruncate=true distributeByHash 基于主索引中指定的字段,将数据分布在集群多个节点上。 若该参数设为one,表示数据基于主索引的首个字段分布。 若该参数设为many,表示数据基于所有主索引字段分布。 该功能通过指定DISTRIBUTE BY子句实现。 说明: 该参数在V100R002C60版本中设置为one,因为该版本不支持在DISTRIBUTE BY子句中指定多个字段。 one many many distributeByHash =many extendedGroupByClause 该参数用于启用和禁用Group By(grouping sets/cube/rollup)迁移。 若该参数设为true,则可迁移GROUP BY()。 若该参数设为false,则不可迁移GROUP BY()。 true false false extendedGroupByClause=false inToExists 该参数可用于启用和禁用从IN/NOT IN到EXISTS/NOT EXISTS的查询优化。 true false false inToExists=false rowstoreToColumnstore 该参数将rowstore(行存)表转换为COLUMN(列存)表。 如果该参数设为true,则所有rowstore表脚本迁移时会转换为columnstore表。 true false false rowstoreToColumnstore=false session_mode 该参数用于在运行CREATE TABLE时设置默认表类型(SET/MULTISET)。 若该参数设为Teradata,则默认表类型会配置为SET。 若该参数设为ANSI,则默认表类型会配置为MULTISET。 Teradata ANSI Teradata session_mode=ANSI tdMigrateALIAS 该参数用于启用/禁用ALIAS迁移。 若该参数设为true,则迁移ALIAS。 若该参数设为false,则不迁移ALIAS。 true false false tdMigrateALIAS=true tdMigrateDOLLAR 该参数用于设置迁移工具行为,从而迁移名称以$(美元符号)开头的静态对象。该参数不适用于动态对象,这些对象的名称使用${}格式。 若该参数设为true,则使用英文双引号(")将以$开头的对象名称括起来。 若该参数设为false,则直接迁移以$开头的对象。 说明: 详情请参见以$开头的对象名称。 true false true tdMigrateDOLLAR=true tdMigrateLOCKoption 该参数是否迁移包含LOCK关键字的查询。 true表示在迁移此类查询时注释掉LOCK功能(LOCK到ACCESS)。 false表示不迁移此类查询。工具会跳过此查询,并记录以下消息: Gauss does not have equivalent syntax for LOCK option in CREATE VIEW and INSERT statement. Please enable the config_param tdMigrateLockOption to comment the LOCK syntax in the statement. 说明: 详情请参见ACCESS LOCK。 true false false tdMigrateLOCKoption=true tdMigrateNULLIFZERO 该参数指定是否迁移NULLIFZERO()。 若该参数设为true,则迁移NULLIFZERO()。 若该参数设为false,则不迁移NULLIFZERO()。 true false true tdMigrateNullIFZero=true tdMigrateVIEWCHECKOPTION 该参数指定是否迁移包含CHECK OPTION的视图。 若该参数设为true,则迁移时注释掉此类视图。 若该参数设为false,则不迁移此类视图。工具将按原样复制此查询并记录以下消息: Gauss does not support WITH CHECK OPTION in CREATE VIEW. Please enable the config_param tdMigrateViewCheckOption to comment the WITH CHECK OPTION syntax in the statement. true false false tdMigrateVIEWCHECKOPTION=true tdMigrateZEROIFNULL 该参数指定是否迁移ZEROIFNULL。 若该参数设为true,则迁移ZEROIFNULL()。 若该参数设为false,则不迁移ZEROIFNULL()。 true false true tdMigrateZEROIFNULL=true volatile 特定会话的volatile数据和表仅存储在该会话中。会话结束后,其数据和表会删除。 volatile表可以是表迁移表或unlogged表。 说明: V100R002C60仅支持unlogged表选项,不支持local temporary表。 local temporary unlogged local temporary volatile=unlogged tdMigrateCharsetCase 该参数指定是否迁移CHARACTER SET和CASESPECIFIC。 若该参数设为true,则迁移CHARACTER SET和CASESPECIFIC为注释掉的脚本。 若该参数设为false,则不迁移CHARACTER SET和CASESPECIFIC。工具按原样复制查询,并在错误日志文件中记录以下消息,包括查询细节(如文件名和语句位置): CHARACTER SET和CASESPECIFIC是列级选项,Gauss不提供等效语法。 用户可以改写相应语句,或将tdMigrateCharsetCase参数设为true,从而注释掉CHARACTER SET和CASESPECIFIC。 true false false tdMigrateCharsetCase=false 说明: 如果tdminatecharsetcase = true,则注释该字符的特殊关键字。 terdataUtilities 是否支持迁移Teradata命令行工具。 支持以下参数值: true false true false true terdataUtilities=true unique_primary_index_in_column_table 是否支持为列存表创建unique索引。 true false true unique_primary_index_in_column_table=true default_charset 是否支持迁移default_charset。 支持以下参数值: LATIN UNICODE GRAPHIC LATIN UNICODE GRAPHIC LATIN default_charset=LATIN mergeImplementation 指定merge类型: 使用WITH子句 拆分查询 支持以下参数值: With Split None With Split None None mergeImplementation=None dsqlSupport 是否支持dsql。 支持以下参数值: true false true false false dsqlSupport=false tdcolumnInSensitive 是否在迁移时删除包含双引号的列名称。 支持以下参数值: true false true false false tdcolumnInSensitive=false tdMigrateCASE_N 指定分区关键字CASE_N的迁移方式。Gauss不支持多级(嵌套)分区。 支持以下参数值: comment none comment none comment tdMigrateCASE_N=comment tdMigrateRANGE_N 指定分区关键字RANGE_N的迁移方式。Gauss不支持多级(嵌套)分区。 支持以下参数值: comment none range comment none range range tdMigrateRANGE_N=range tdMigrateAddMonth 是否支持迁移addMonth。 支持以下参数值: true false 若该参数设为true,则迁移后为mig_td_ext.ADD_MONTHS(添加mig_td_ext)。否则,不支持迁移。 true false false tdMigrateAddMonth=false 父主题: 配置DSC
  • ODBC驱动 GaussDB(DWS) 也支持开源的ODBC驱动程序:PostgreSQL ODBC 09.01.0200或更高版本。 表5 ODBC驱动下载地址 适用操作系统 下载地址 校验文件 Microsoft Windows dws_8.2.x_odbc_driver_for_windows.zip dws_8.2.x_odbc_driver_for_windows.zip.sha256 dws_8.1.x_odbc_driver_for_windows.zip dws_8.1.x_odbc_driver_for_windows.zip.sha256 Euler ARM dws_8.2.x_odbc_driver_for_arm_euler.zip dws_8.2.x_odbc_driver_for_arm_euler.zip.sha256 dws_8.1.x_odbc_driver_for_arm_euler.zip dws_8.1.x_odbc_driver_for_arm_euler.zip.sha256 Redhat ARM dws_8.2.x_odbc_driver_for_arm_redhat.zip dws_8.2.x_odbc_driver_for_arm_redhat.zip.sha256 dws_8.1.x_odbc_driver_for_arm_redhat.zip dws_8.1.x_odbc_driver_for_arm_redhat.zip.sha256 Redhat x86_64 dws_8.2.x_odbc_driver_for_x86_redhat.zip dws_8.2.x_odbc_driver_for_x86_redhat.zip.sha256 dws_8.1.x_odbc_driver_for_x86_redhat.zip dws_8.1.x_odbc_driver_for_x86_redhat.zip.sha256 SUSE x86_64 dws_8.2.x_odbc_driver_for_x86_suse.zip dws_8.1.x_odbc_driver_for_x86_suse.zip.sha256 dws_8.1.x_odbc_driver_for_x86_suse.zip dws_8.1.x_odbc_driver_for_x86_suse.zip.sha256
  • Data Studio图形界面客户端 表2 Data Studio下载地址 适用操作系统 下载地址 校验文件 Windows x64 Data_Studio_8.2.x_64.zip Data_Studio_8.2.x_64.zip.sha256 Data_Studio_8.1.x_64.zip Data_Studio_8.1.x_64.zip.sha256 Data_Studio_8.0.x_64.zip Data_Studio_8.0.x_64.zip.sha256 Windows x86 Data_Studio_8.2.x_32.zip Data_Studio_8.2.x_32.zip.sha256 Data_Studio_8.1.x_32.zip Data_Studio_8.1.x_32.zip.sha256 Data_Studio_8.0.x_32.zip Data_Studio_8.0.x_32.zip.sha256
  • JDBC驱动 GaussDB(DWS) 支持开源的JDBC驱动程序:PostgreSQL JDBC驱动程序9.3-1103或更高版本。 表4 JDBC驱动下载地址 驱动名称 下载地址 校验文件 DWS JDBC Driver dws_8.2.x_jdbc_driver.zip dws_8.2.x_jdbc_driver.zip.sha256 dws_8.1.x_jdbc_driver.zip dws_8.1.x_jdbc_driver.zip.sha256 DWS ARM JDBC Driver dws_euler_kunpeng_jdbc.zip dws_euler_kunpeng_jdbc.zip.sha256
  • 命令行客户端(包含GDS工具包) 本章节各工具下载地址中的8.0.x、8.1.x、8.2.x等指的是集群版本,而非工具版本。 表1 gsql下载地址 操作系统类别 适用操作系统版本 下载地址 校验文件 Microsoft Windows Microsoft Windows x86_64: Windows 7及以上。 Windows Server 2008及以上。 dws_8.1.x_gsql_for_windows.zip dws_8.1.x_gsql_for_windows.zip.sha256 dws_8.2.x_gsql_for_windows.zip dws_8.2.x_gsql_for_windows.zip.sha256 Redhat x86_64 RHEL 6.4~7.6 dws_client_8.2.x_redhat_x64.zip dws_client_8.2.x_redhat_x64.zip.sha256 dws_client_8.1.x_redhat_x64.zip dws_client_8.1.x_redhat_x64.zip.sha256 dws_client_8.0.x_redhat_x64.zip dws_client_8.0.x_redhat_x64.zip.sha256 SUSE x86_64 SLES 11.1~11.4,SLES 12.0~12.3 dws_client_8.2.x_suse_x64.zip dws_client_8.2.x_suse_x64.zip.sha256 dws_client_8.1.x_suse_x64.zip dws_client_8.1.x_suse_x64.zip.sha256 dws_client_8.0.x_suse_x64.zip dws_client_8.0.x_suse_x64.zip.sha256 Euler Kunpeng_64 EulerOS 2.0 SP8 dws_client_8.1.x_euler_kunpeng_x64.zip dws_client_8.1.x_euler_kunpeng_x64.zip.sha256 Redhat Kunpeng_64 CentOS-7.6-aarch64和NeoKylin-7.6-aarch64 (适配鲲鹏920处理器) dws_client_8.1.x_redhat_kunpeng_x64.zip dws_client_8.1.x_redhat_kunpeng_x64.zip.sha256
  • SET MySQL REPLACE支持使用SET设置值,DSC工具将对其转换。 输入 1 2 3 4 5 replace INTO `runoob_datatype_test` VALUES (100, 100, 100, 0, 1); replace INTO `runoob_datatype_test` VALUES (100.23, 100.25, 100.26, 0.12,1.5); replace INTO `runoob_datatype_test` (dataType_numeric,dataType_numeric1) VALUES (100.23, 100.25); replace INTO `runoob_datatype_test` (dataType_numeric,dataType_numeric1,dataType_numeric2) VALUES (100.23, 100.25, 2.34); replace into runoob_datatype_test set dataType_numeric=23.1, dataType_numeric4 = 25.12 ; 输出 1 2 3 4 5 INSERT INTO "public"."runoob_datatype_test" VALUES (100,100,100,0,1); INSERT INTO "public"."runoob_datatype_test" VALUES (100.23,100.25,100.26,0.12,1.5); INSERT INTO "public"."runoob_datatype_test" ("datatype_numeric","datatype_numeric1") VALUES (100.23,100.25); INSERT INTO "public"."runoob_datatype_test" ("datatype_numeric","datatype_numeric1","datatype_numeric2") VALUES (100.23,100.25,2.34); INSERT INTO "public"."runoob_datatype_test" ("datatype_numeric","datatype_numeric4") VALUES (23.1,25.12);
  • VALUES MySQL REPLACE支持一条语句插入或删除多值,以逗号分隔。 输入 1 2 3 4 5 #有数据的话则替换replace,没有的话则插入新的数据同INSERT Replace INTO exmp_tb1 (tb1_id,tb1_name,tb1_gender,tb1_address,tb1_number) VALUES(17,'David','male','NewYork11','01015827875'),(18,'Rachel','female','NewYork22','01015827749'),(20,'Monica','female','NewYork','010158996743'); Replace INTO exmp_tb1 (tb1_id,tb1_name,tb1_gender,tb1_address,tb1_number) VALUES(17,'David1','male','NewYork11','01015827875'),(21,'Rachel','female','NewYork22','01015827749'),(22,'Monica','female','NewYork','010158996743'); Replace INTO exmp_tb1 (tb1_id,tb1_name,tb1_gender,tb1_address,tb1_number,tb1_date) VALUES(17,'David2',DEFAULT,'NewYork11','01015827875',DEFAULT),(18,'Rachel','female',DEFAULT,'01015827749','2018-12-14 10:44:20'),(DEFAULT,'Monica','female',DEFAULT,DEFAULT,'2018-12-14 10:44:20'); Replace INTO exmp_tb1 VALUES(DEFAULT,'David',DEFAULT,'NewYork11','01015827875',DEFAULT),(18,'Rachel','female',DEFAULT,'01015827749','2018-12-14 10:44:20'),(DEFAULT,'Monica','female',DEFAULT,DEFAULT,'2018-12-14 10:44:20'); 输出 1 2 3 4 5 6 7 8 9 10 11 12 13 --有数据的话则替换replace,没有的话则插入新的数据同INSERT INSERT INTO "public"."exmp_tb1" ("tb1_id","tb1_name","tb1_gender","tb1_address","tb1_number") VALUES (17,'David','male','NewYork11','01015827875'); INSERT INTO "public"."exmp_tb1" ("tb1_id","tb1_name","tb1_gender","tb1_address","tb1_number") VALUES (18,'Rachel','female','NewYork22','01015827749'); INSERT INTO "public"."exmp_tb1" ("tb1_id","tb1_name","tb1_gender","tb1_address","tb1_number") VALUES (20,'Monica','female','NewYork','010158996743'); INSERT INTO "public"."exmp_tb1" ("tb1_id","tb1_name","tb1_gender","tb1_address","tb1_number") VALUES (17,'David1','male','NewYork11','01015827875'); INSERT INTO "public"."exmp_tb1" ("tb1_id","tb1_name","tb1_gender","tb1_address","tb1_number") VALUES (21,'Rachel','female','NewYork22','01015827749'); INSERT INTO "public"."exmp_tb1" ("tb1_id","tb1_name","tb1_gender","tb1_address","tb1_number") VALUES (22,'Monica','female','NewYork','010158996743'); INSERT INTO "public"."exmp_tb1" ("tb1_id","tb1_name","tb1_gender","tb1_address","tb1_number","tb1_date") VALUES (17,'David2',DEFAULT,'NewYork11','01015827875',DEFAULT); INSERT INTO "public"."exmp_tb1" ("tb1_id","tb1_name","tb1_gender","tb1_address","tb1_number","tb1_date") VALUES (18,'Rachel','female',DEFAULT,'01015827749','2018-12-14 10:44:20'); INSERT INTO "public"."exmp_tb1" ("tb1_id","tb1_name","tb1_gender","tb1_address","tb1_number","tb1_date") VALUES (DEFAULT,'Monica','female',DEFAULT,DEFAULT,'2018-12-14 10:44:20'); INSERT INTO "public"."exmp_tb1" VALUES (DEFAULT,'David',DEFAULT,'NewYork11','01015827875',DEFAULT); INSERT INTO "public"."exmp_tb1" VALUES (18,'Rachel','female',DEFAULT,'01015827749','2018-12-14 10:44:20'); INSERT INTO "public"."exmp_tb1" VALUES (DEFAULT,'Monica','female',DEFAULT,DEFAULT,'2018-12-14 10:44:20');