반응형
블로그 이미지
개발자로서 현장에서 일하면서 새로 접하는 기술들이나 알게된 정보 등을 정리하기 위한 블로그입니다. 운 좋게 미국에서 큰 회사들의 프로젝트에서 컬설턴트로 일하고 있어서 새로운 기술들을 접할 기회가 많이 있습니다. 미국의 IT 프로젝트에서 사용되는 툴들에 대해 많은 분들과 정보를 공유하고 싶습니다.
솔웅

최근에 받은 트랙백

글 보관함

Leetcode 196 Delete Duplicate Emails (SQL) - Easy

2022. 11. 21. 19:27 | Posted by 솔웅


아이디와 이메일이 있는 Person이라는 테이블이 있습니다.

여기서 id는 키 컬럼이라서 유니크 합니다.

이메일에는 중복된 데이터가 들어갈 수 있습니다.

이메일이 중복 됐을 경우 하나만 남기고 나머지를 지워서 유니크하게 만드는 쿼리를 만들라는 문제 입니다.

이메일은 모두 소문자 입니다.

 

 

일단 하나 하나 접근해 보겠습니다.

테이블은 하나 이지만 이 하나인 테이블을 조인 할 수 있습니다.

 

우선 이 조인을 사용해서 이메일이 중복된 걸 찾아 보겠습니다.

 

SELECT p1.*
FROM Person p1,
    Person p2
WHERE
    p1.Email = p2.Email
;

이렇게 하면 중복된 이메일 리스트를 얻을 수 있습니다.

 

여기서 중복된 이메일들 중에 아이디가 더 큰 것을 골라 보겠습니다.

 

SELECT p1.*
FROM Person p1,
    Person p2
WHERE
    p1.Email = p2.Email AND p1.Id > p2.Id
;

이렇게 하면 지우고 싶은 데이터만 출력 되는 것을 보실 수 있습니다.

 

그러면 이 where 절을 사용해서 지우면 됩니다.

 

DELETE p1 FROM Person p1,
    Person p2
WHERE
    p1.Email = p2.Email AND p1.Id > p2.Id
반응형

Comment


드디어 올해 첫 송이 버섯을 땄다.

 

https://youtu.be/KWpLkfVb8EU

 

가뭄이 길었고 예년보다 기온도 높아서 올해는 송이 가뭄이다.

 

 

작년에는 10월에만 23 개를 땄고 재작년 에는 33 개를 땄다.

그런데 올해는 0개.

11월 3일이 돼서야 겨우 2개를 땄다.

 

이곳에서 오랫동안 버섯을 캐러 다녔던 미국 친구들도 올해는 송이 버섯 찾기가 어렵다고 한다.

 

이제 눈 내리고 얼어 버리면 끝인데........

 

앞으로 송이 버섯을 얼마나 더 딸 수 있을 지.....

 

하여간 화이팅이다......

반응형

Comment


얼마 전 와이프가 산에서 따온 버섯을 먹고 배탈이 난 적이 있다.

아마 덜 익혀서 그런 것 같기도 하고...

아니면 평소에 위가 안 좋아서 그랬던 것 같기도 하고......

 

페이스북 평소 가입 돼 있었던 버섯 관련 그룹들에 에 문의를 했더니 많은 댓글들이 올라 왔다.

 

그 글들을 좀 정리를 해 봤다.

 

Facebook Replies

 

I have had a similar reaction 1 time and 1 time only after eating lobster mushrooms.  I have eaten them since and many times before and have not had issues.  I don’t know what caused it.  My partner ate the same mushrooms and was just fine.  I know I have sensitivity to some mushroom species (like elfin saddles) so it may have been the host mushroom for the ascomycete (sp) was something other than Russula Brevipes and that affected me 🤷🏼‍♀️ totally unsure but you are not alone

 

Exactly my reaction to honeys. I've since not been able to eat any mushrooms, wild or cultivated, without the same adverse reaction. The pain was so excruciating I fainted.

 

Unfortunately, I have that reaction to morels. I ate them fine as a kid, but now they make me violently ill. So of course, I get stuck cooking mushrooms I love but can't eat. 😒😅

 

IDs are correct but that doesn't mean they aren't the cause. Could of had a spoiled mushroom or potentially she has an adverse/allergic reaction to them. Even a safe mushroom isn't safe for everyone same goes for all food.

 

i’ve also heard some folks get tummy ache from chanterelles too

 

Symptoms don't match what I'd expect from either of these species.

Some people have an adverse reaction to some wild mushrooms, but if she's eaten these before without issues I'd get to a doctor quickly. It could also be a host of other issues that need prompt attention.

 

There are many cases of people having adverse effects to edible mushrooms. Low stomach release of the enzyme trehalase for example. Please seek medical help.

 

Campylobacter Jejuni (from raw chicken or pork) has these symptoms.  I know from experience.  Was meat cooked with the mushrooms?

 

Changsoo Park  "People can get Campylobacter infection by eating raw or undercooked poultry or eating something that touched it. They can also get it from eating other foods, including seafood, meat, and produce, by contact with animals, and by drinking untreated water.".

 

I have the same reaction to Chanterelles. I ate them for years with no ill effects then one day I thought I was going to die and it’s been that way ever since. I can still eat all other varieties just not Chanterelle’s. Hope she is better soon!

 

If I don’t cook them for a very long time (12-15) minutes I will be up with the sh*ts for hours. Similar for my spouse. Pretty scary the first time it happens. Which makes it feel worse. Note: mushrooms contain chitin which must be cooked to be digested by humans. Some humans digest it better than others.

 

If I don’t cook some kinds super well, morels for sure, it can suck. 

 

I know a couple people who suddenly became ill affected by wild mushrooms after eating them for years. One was Chanterelles.

 

Shaun Hulsizer I got this as a kid after eating mushrooms almost daily for years. Wasn’t until recently that I can eat mushrooms again. Still can’t eat certain ones without heart burn and nausea

 

Tiffany Olsen Yes a friend of mine I used to trade I would pick mushrooms for them and they give me other veggies and different things in trade and one day she got sick after eating Chanterelles her whole life she wasn’t sure what it was so she tried again and sure enough got sick again so she doesn’t eat them anymore

 

In our house, I ate lobster with my husband the first time we found them. Super delicious! 

The next season we were excited to eat them again... BUT I am now allergic even though I heroically tried to eat three different geo locations in hopes that I would get not get sick, again... 

No luck. I cannot eat lobster mushrooms anymore. I would bet this is the case for your wife.

 

Those are 100% lobsters and chanterelles. Is there a possibility you may have undercooked them? My mom has had a similar reaction to undercooked chants

 

If she drank any type of alcohol. There is a high rate of people who have adverse effects from drinking alcohol and eating wild mushrooms.

The symptoms you described are very similar with the alcohol mixed with mushrooms.

 

Possible the mix of both mushrooms or alcohol. Lobster can bother some folks

 

Anecdotal evidence: 

When I was in Maine visiting family in September, we found many lobsters (mushrooms). It was my first experience with them. I ate way too much and had GI issues for three days. I totally overindulged and paid for it.

 

Agreed with the above comment, but in your pictures and video, the species ingested were correctly identified. She could have had an individual bad reaction to the mushrooms, had too many if it was the first time, or it could be something completely unrelated. But the mushroom IDs are correct and they are edible species which are safe for most people.

 

I have a friend that can eat chanterelles except whites (C. subalbidus).

 

Chanterelle mushrooms make me sick, too. Same happened to a friend of mine as well. Neither of us can eat them anymore.

 

Agree that IDs look correct. Lobster mushrooms can also cause reactions and stomach upset in individuals so don’t rule out either species as the possible cause.

 

Never munch on a hunch.

 

Some people aren’t able to tolerate mushrooms that are completely edible for most people. Has she ever had chanterelles and lobster mushrooms before?  (Also could have been something else she was exposed to and totally unrelated to the mushrooms.)

 

Mushroom in the first video does look like a chanterelle, though not 100% ID'able from the video alone. Not sure about the other vids (I don't think hedgehogs, they don't really look like spines underneath), but whatever they are, they are kind of decrepit.

More people are sickened by the bacteria on undercooked mushrooms than by toxic mushrooms. Did you cook the thoroughly before consuming?

https://MushroomObsession.com/

 

Over the years I have read lobster mushroom cause stomach issues in some.

 

If it was the mushrooms then you’d most likely have the same symptoms crop up. How are you feeling?

 

How is she doing today? Did you cook the mushrooms? The last two times I ate Lion's Mane I had abdominal pain and squeezing and nausea even though they were safely grown and ID'd.

 

I’ve been a chef for a long time and not only cooked and served these mushrooms under about any conditions possible, lobster and chanterelle mushrooms shouldn’t really give any discomfort to the eater. My guess is that there was some other sort of contamination involved. Time and temperature would be my first guesses and not properly cleaning the veggies can also add problems. But if done properly there shouldn’t be any issues.

 

So if it was chanterelles and lobster mushrooms they are both edible raw (at least Russula brevipes I’m unsure if the Hypomyces infecting them is different). So undercooking likely isn’t the issue unless there was some contamination of them like bacterial.

 

These mushrooms are both fine with alcohol for most people so unlikely the cause unless your wife has a rare insensitivity to the combo.

 

Mixing mushrooms isn’t an issue other than if you have a reaction you can’t tell which mushroom caused it.

 

The most likely cause here is possible contamination and/or individual sensitivity it one exasperated by her underlying GI issues. Could help to try each one separately in the future to see which caused it if it’s individual and if neither do you can likely point the finger at contamination or something other than the mushrooms entirely.

 

 

반응형

Comment

이전 1 다음