简体   繁体   English

使用java或sql导入具有多个值的数据库表

[英]Database importing tables with multiple values using java or sql

i would like to import an csv data from imdb.我想从 imdb 导入一个 csv 数据。 The file contains following stuff: id, title, release_date, and actors But in column Actors there are more then one actor stored so it look like该文件包含以下内容:id、title、release_date 和 actor 但在 Actors 列中存储了不止一个 actor,所以它看起来像

id   title   release_date   actor

1     FF7      2015         Vin Diesel|Paul Walker|Jason Statham

I know that the actor is a fk from an actors table which I have to create.我知道演员是来自我必须创建的演员表的 fk。 If I would like to import that csv how to clear up the csv to import it using java or sql.如果我想导入该 csv,如何清除 csv 以使用 java 或 sql 导入它。 It could take to long if I sperate the first three colums from the actors and import the columns and try to import the actor column如果我从演员中分离出前三个列并导入列并尝试导入演员列,则可能需要很长时间

Import the entire csv, as is, into a staging table.按原样将整个 csv 导入临时表。 Then execute a stored proc to move the data to the desired destination tables.然后执行存储过程将数据移动到所需的目标表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM