LoginSignup
1
2

More than 5 years have passed since last update.

PostgreSQLで料理のレシピを管理

Last updated at Posted at 2016-11-05

こんにちは、みゆうです。食いしん坊です。
PostgreSQL初心者です。

やりたいこと:料理のレシピを管理するため自分用DBの構築

やったこと:PortgreSQLのtutorial通りにDBを作った後、練習のためTABLEに情報をいくつか書き込んだ

やったことをほんのちょっと詳しく書くと、

  • DB作成
  • 以下のコマンドでテーブル作成
CREATE TABLE recipe (
recipe_id int PRIMARY KEY,
recipe_name varchar(80),
link varchar(2000),
time_to_cook time,
ingredients varchar[]
);
  • お気に入りのレシピをTABLEに挿入
INSERT INTO recipe VALUES
(
'5',
'野菜ジュースのいきなりパスタ',
'http://www.bh-recipe.jp/recipe/050400142.html',
'0:15',
ARRAY['野菜ジュース']
);
  • テーブルの確認

recipe_db=> SELECT * FROM recipe;

recipe_id recipe_name link time_to_cook ingredients
1 マスタードソース http://略 00:10:00 {マスタード}
2 パンプキンケーキ http:// 01:00:00 {かぼちゃ}
3 鮭のムニエル http:// 00:30:00 {鮭}
4 リンゴのパウンドケーキ https:// 01:00:00 {りんご}
5 野菜ジュースのいきなりパスタ http://www.bh-recipe.jp/recipe/050400142.html 00:15:00 {野菜ジュース}

ingredientsには、必要な食材を書きました。
でも、常備されてる食材を書くのは省略しました。

なんとなく思いついた料理名を書いていっただけなのに、ingredientsがすべて1つになった...。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2