postgresql にデータ量が多いテキストを挿入する場合の方法

PostgreSQL

参考:https://wiki.postgresql.org/wiki/FAQ/ja#.E3.82.AB.E3.83.A9.E3.83.A0.E3.81.AE.E3.83.87.E3.83.BC.E3.82.BF.E5.9E.8B.E3.82.92.E5.A4.89.E6.9B.B4.E3.81.99.E3.82.8B.E3.81.AB.E3.81.AF.E3.81.A9.E3.81.86.E3.81.97.E3.81.BE.E3.81.99.E3.81.8B.EF.BC.9F

PostgreSQLのテーブルを作成するときに text型を選ぶと、サイズに関係なくテキストデータを保存することができる。

CREATE TABLE movie5 (movie_title varchar(64),
movie_id varchar(64),
movie_overview text,
movie_release_date varchar(64),
movie_runtime varchar(64),
movie_poster_path text
);

insert into movie5 values (‘Ariel’, ‘2’, ‘Taisto Kasurinen is a Finnish coal miner whose father has just committed suicide and who is framed for a crime he did not commit. In jail, he starts to dream about leaving the country and starting a new life. He escapes from prison but things dont go as planned…’, ‘1988-10-21′, ’73’, ‘https://image.tmdb.org/t/p/w500/w0NzAc4Lv6euPtPAmsdEf0ZCF8C.jpg’);

 

これでインサート完了。

Facebook Plugins

コメント

タイトルとURLをコピーしました