postgresql
函数
-- 查询随机数
SELECT ceil(random()*(10000-1)+1) as num;
SELECT floor(random()*(10000-1)+1) as num;
SELECT trunc(random()*(10000-1)+1) as num;
UPDATE ecc_masc_mds_temp SET create_time = null;
SELECT CURRENT_TIMESTAMP -- 查询当前时间
将数据从一个表拷贝到另一个表,而且改变结构
INSERT INTO ecc_masc_mds_temp (
pid,
create_time,
geo_name,
country_code,
country_name,
vendor_id,
vendor_name,
station_id,
station_name,
vendor_station_id,
sold_to,
ship_to,
sales_org,
plant,
LOCATION,
chanel,
division
) SELECT
trunc(random()*(10000-1)+1) as num,
CURRENT_TIMESTAMP,
geo_name,
country_code,
country_name,
vendor_id,
vendor_name,
station_id,
station_name,
vendor_station_id,
sold_to,
ship_to,
sales_org,
plant,
LOCATION,
chanel,
division
FROM
ecc_masc_mds
配置的sql
-- 删除 configuration workLevel
delete from platform.configuration_code_working_level ccwl where ccwl.config_id in (SELECT id from platform.configuration_code cc where cc.config_type = 'TARGET_WOI_CONFIG')
-- 删除 configuration code
DELETE FROM platform.configuration_code cc where cc.config_type = 'TARGET_WOI_CONFIG'
-- 查找
select * from platform.configuration_code_working_level ccwl where ccwl.config_id in (SELECT id from platform.configuration_code cc where cc.config_type = 'TARGET_WOI_CONFIG')