---
# System prepended metadata

title: thai home cooking

---

# thai home cooking 


Create and populate tables
```sql=
select * from pg_catalog.pg_tables where schemaname = 'public';

drop table menu_item;
drop table menu_category;
drop table pricing;
drop table review;

create table
  menu_category (
    id bigint generated by default as identity primary key,
    created_at timestamp with time zone default timezone ('utc'::text, now()) not null,
    name text unique not null
  );

create table
  menu_item (
    id bigint generated by default as identity primary key,
    created_at timestamp with time zone default timezone ('utc'::text, now()) not null,
    name text unique not null,
    description text not null,
    image_url text,
    category_id bigint references menu_category (id) not null
  );

  create table
  review (
    id bigint generated by default as identity primary key,
    created_at timestamp with time zone default timezone ('utc'::text, now()) not null,
    post_title text unique not null,
    blog_name text not null,
    excerpt text not null,
    url text not null,
    highlight boolean not null
  );

create table pricing (
    id bigint generated by default as identity primary key,
    created_at timestamp with time zone default timezone ('utc'::text, now()) not null,
    price_group text not null,
    price_per text not null,
    price decimal not null
);

INSERT INTO menu_category
(name) VALUES
 ('Main'), 
 ('Dessert'), 
 ('Appetizer'), 
 ('Drinks');

INSERT INTO menu_item 
(name, description, category_id ) VALUES
('Chu Chee Gung', 'Shrimp in Red Curry sauce and peppercorn', (select id from menu_category where name = 'Main')),
('Gaeng Gari Gai', 'Yellow Curry with chicken', (select id from menu_category where name = 'Main')),
('Bua Loy Fakthong', 'Pumpkin balls simmered in coconut syrup', (select id from menu_category where name = 'Dessert'));

INSERT INTO pricing
(price_group, price, price_per) VALUES
('1 person', 4000,'per lesson'),
('2-4 people', 3500, 'per person and lesson'),
('5-6 people', 3000, 'per person and lesson')
;


INSERT INTO review
(post_title, blog_name, excerpt, url, highlight) VALUES 
('Cooking Class Part 1: Traditional Thai Market', 'Three Bradleys Blog', 'One of the most unique aspects of this class was that our day started with a trip to the market, where we told Angsana the 3 dishes we had decided we wanted to make (no pre-set menu!).<br>We felt like we were truly being immersed into Thai life, experiencing how the locals shop.<br><br>Bottomline: If you are ever in Bangkok, you must take a class from Angsana.  This was one of the highlights of our trip, and our only regret is that we didn’t sign up for two classes! ', 'https://3bradleys.wordpress.com/2011/12/30/cooking-class-part-1-traditional-thai-market/', true),
(' The most amazing cooking class', 'Camilla Bracewell', 'I went to some other cooking classes and they just were not nearly as thorough as this.<br>There was loads of time to ask questions and I left feeling I understood Thai food so much better.<br><br>Best of all I came home and cooked 2 of the recipes in the first week and they were so easy and delicious, I was left glowing with pride that I had cooked them myself! If I am ever in Bangkok I am 100% going back.', 'http://camillabracewell.blogspot.com/2010/10/most-amazing-cooking-class.html', true),
('A Market + Wok + A GREAT Teacher = Delicious Thai Food ', 'Here And There Blog', 'One of the reasons we decided Angsana was best is because it is a private lesson for just the two of us and it truly is HOME cooking. The class is taught in a kitchen at the back of her home in Bangkok.<br><br>So if you are in Bangkok and want to learn how to cook that delicious Thai food in your home, Angsana is a wonderful choice!', 'http://dtbradshaw.blogspot.com/2012/02/market-wok-great-teacher-delicious-thai.html', false),
('Bangkok travel review & recommendations 2008', 'Bug Bitten Blog', 'The highlight of our time in Bangkok was a private cooking class we took (at the last minute).<br><br>  At the time you call for your appointment, she asks you which dishes you’d like to make – she makes suggestions if you are stumped – and her cashew nut chicken is to DIE FOR! She does all the shopping for you before you arrive and you sit down at the end to the lunch you have just prepared – so rewarding!', 'https://www.bugbitten.com/asia/bangkok/bangkok-travel-review-recommendations-2008/', false),
('Delightful Cooking Class in Bangkok', 'Virtual Tourist', '', 'https://web.archive.org/web/20160328095222/https://members.virtualtourist.com/m/129f26/160d76/4/', false),
('A great cooking experience', 'Virtual Tourist', '', 'https://web.archive.org/web/20160826135945/http://members.virtualtourist.com/m/f5673/160d76/4/?o=1', false),
('Bangkok: Thai Cooking Class Album', 'darcydivine (Flickr)', '', 'https://www.flickr.com/photos/darcydivine/sets/72157605494407744/', false),
('Thai Cooking Classes', 'Travel Forum', '', 'https://web.archive.org/web/20161207091602/www.travelforum.org/thailand/801-thai-cooking-classes.html', false),
('i lub thailand', 'Travel Lark', '', 'https://web.archive.org/web/20160331164747/http://travellark.blogspot.com/2009/03/i-lub-thailand_27.html', false);

```

Graphql connection from supabae

- Goto: `Settings > API`
- Copy project url and append `/graphql/v1` 
- Add the `apiKey` header to you 




Select 
```sql=
select * from menu_category;
select * from menu_category where name = 'Main'

select 
    mi.name,
    mi.description,
    mc.name as category
from menu_item as mi
join menu_category as mc on mc.id = mi.category_id;
```


List all public tables
```sql=
select * from pg_catalog.pg_tables where schemaname = 'public';
```