Home  >  Article  >  Database  >  vertica从其他表迁移数据到新表(insertinto语句用法实例)

vertica从其他表迁移数据到新表(insertinto语句用法实例)

WBOY
WBOYOriginal
2016-06-07 15:56:361716browse

#例:迁移微博用户数据。 由于源表weiboFriend与目标表weiboUser的表结构不完全相同,因此在语句不但要严排列字段顺序,而且还要用缺省(如:'' 等)补齐源表中没有的字段 具体SQL语句: insert into public.weiboUser ( id,screen_name,location,descriptio

#例:迁移微博用户数据。

由于源表weiboFriend与目标表weiboUser的表结构不完全相同,因此在语句不但要严格排列字段顺序,而且还要用缺省值(如:'' 等)补齐源表中没有的字段值

具体SQL语句:

insert into public.weiboUser ( id,screen_name,location,description,profile_image_url,blog_url,followers_count,statuses_count,created_at ) ( select uid,screen_name,'','',profile_image_url,'',followers_count,statuses_count,created from public.weiboFriend );

大家可以根据实际情况稍加修改后使用

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn