노벨상은 10월에 일주일에 걸쳐 발표되며 시상식은 12월 10일인 오늘(호주에서는 이미 내일입니다) 열립니다. 흥미로운 이야기가 있습니다. C. V. 라만 (의 라만 효과) 예약 스톡홀름행 티켓 수상에 대한 확신이 있었기 때문에 발표 전부터 12월 10일 시상식에 참석할 수 있었습니다!
이 데이터 세트는 다음 "멋진 JSON 데이터 세트" 리포지토리에서 가져왔습니다. https://github.com/jdorfman/awesome-json-datasets
노벨상 데이터 세트에는 세 개의 데이터 파일이 있습니다:
- 수상자 - 각 수상자의 프로필이 포함되어 있습니다.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
{ "born": "1888-11-07", "bornCity": "Tiruchirappalli", "bornCountry": "India", "bornCountryCode": "IN", "died": "1970-11-21", "diedCity": "Bangalore", "diedCountry": "India", "diedCountryCode": "IN", "firstname": "Sir Chandrasekhara Venkata", "gender": "male", "id": "37", "prizes": [ { "affiliations": [ { "city": "Calcutta", "country": "India", "name": "Calcutta University" } ], "category": "physics", "motivation": "\"for his work on the scattering of light and for the discovery of the effect named after him\"", "share": "1", "year": "1930" } ], "surname": "Raman" } |
- 국가 - 국가 목록 및 국가 코드
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
{ "code": "AR", "name": "Argentina" }, { "code": "AU", "name": "Australia" }, { "code": "AT", "name": "Austria" }, |
- 상 - 연도별 각 상 목록과 수상자를 그룹으로 묶어 표시합니다.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
{ "category": "physics", "laureates": [ { "firstname": "Sin-Itiro", "id": "84", "motivation": "\"for their fundamental work in quantum electrodynamics, with deep-ploughing consequences for the physics of elementary particles\"", "share": "3", "surname": "Tomonaga" }, { "firstname": "Julian", "id": "85", "motivation": "\"for their fundamental work in quantum electrodynamics, with deep-ploughing consequences for the physics of elementary particles\"", "share": "3", "surname": "Schwinger" }, { "firstname": "Richard P.", "id": "86", "motivation": "\"for their fundamental work in quantum electrodynamics, with deep-ploughing consequences for the physics of elementary particles\"", "share": "3", "surname": "Feynman" } ], "year": "1965" } |
수상작 문서에는 수상자 문서에서 개별 수상자 문서로 연결되는 ID가 있습니다. 노벨상 수상자를 살펴봅시다. 먼저, 수상자 정보가 복수형이며 배열로 저장되어 있다는 것을 알 수 있습니다. 한 사람이나 단체가 두 개 이상의 상을 수상할 수 있습니다. 누가 두 개 이상의 상을 수상했는지 살펴봅시다.
과제 1. 노벨상을 두 번 이상 수상한 사람은 몇 명인가요?
쿼리 1: 수상자 배열의 중첩을 해제하여 개별 수상자의 개체를 가져온 다음 배열의 길이를 결정하고 필터링하기만 하면 됩니다. 수상작당 하나의 항목이 있습니다. 배열 처리 및 UNNEST 작업에 대한 자세한 내용은 문서를 참조하세요: N1QL에서 JSON 배열로 작업하기.
|
1 2 3 4 5 6 7 |
select llist.firstname || " " || IFMISSING(llist.surname, ""), array_length(llist.prizes) numnobel from laureate l unnest l.laureates llist where array_length(llist.prizes) > 1; |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
[ { "$1": "Marie Curie, née Sklodowska", "numnobel": 2 }, { "$1": "John Bardeen", "numnobel": 2 }, { "$1": "Linus Carl Pauling", "numnobel": 2 }, { "$1": "Frederick Sanger", "numnobel": 2 }, { "$1": "Comité international de la Croix Rouge (International Committee of the Red Cross) ", "numnobel": 3 }, { "$1": "Office of the United Nations High Commissioner for Refugees (UNHCR) ", "numnobel": 2 } ] |
과제 2: 노벨상 수상자를 가장 많이 배출한 국가를 알아보세요.
쿼리 2: 수상자의 중첩을 해제하고 bornCountry 필드를 기준으로 그룹화하기만 하면 됩니다.
|
1 2 3 4 5 6 7 8 9 |
select llist.bornCountry, Count(1) totalPrizes from laureate l unnest l.laureates llist group by llist.bornCountry order by totalPrizes desc |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
[ { "bornCountry": "USA", "totalPrizes": 269 }, { "bornCountry": "United Kingdom", "totalPrizes": 84 }, { "bornCountry": "Germany", "totalPrizes": 63 }, { "bornCountry": "France", "totalPrizes": 52 }, { "totalPrizes": 33 }, { "bornCountry": "Sweden", "totalPrizes": 29 }, |
국가나 출신이 없는 우승자가 33명이나 된다니... 무슨 일이 벌어지고 있는 걸까요?
|
1 2 3 4 5 6 7 |
select llist.firstname || " " || IFMISSING(llist.surname, ""), llist.gender from laureate l unnest l.laureates llist where llist.bornCountry is missing; |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
{ "$1": "Institut de droit international (Institute of International Law) ", "gender": "org" }, { "$1": "Bureau international permanent de la Paix (Permanent International Peace Bureau) ", "gender": "org" }, { "$1": "Comité international de la Croix Rouge (International Committee of the Red Cross) ", "gender": "org" }, ... |
국제 조직인 것 같고, 태어난 국가 데이터가 누락된 몇 명의 수상자가 있습니다.
과제 3: 인도에서 몇 명이 왔나요?
질문 3: 노벨상은 1901년부터 수여되었지만 인도는 1947년에 독립했습니다. 1947년까지 인도는 '영국령 인도'라는 국호를 사용했습니다. 확장 검색을 해 보겠습니다.
|
1 2 3 4 5 6 7 8 9 10 11 12 |
select llist.firstname, llist.surname, llist.bornCountry as xborncountry, llist.diedCountry as ydiedcountry, llist.gender as zgender from laureate l unnest l.laureates llist where llist.bornCountry = "India" or lower(llist.bornCountry) like "%india%" or llist.diedCountry = "India" |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
[ { "firstname": "Sir Chandrasekhara Venkata", "surname": "Raman", "xborncountry": "India", "ydiedcountry": "India", "zgender": "male" }, { "firstname": "Abdus", "surname": "Salam", "xborncountry": "India (now Pakistan)", "ydiedcountry": "United Kingdom", "zgender": "male" }, { "firstname": "Subramanyan", "surname": "Chandrasekhar", "xborncountry": "India (now Pakistan)", "ydiedcountry": "USA", "zgender": "male" }, { "firstname": "Ronald", "surname": "Ross", "xborncountry": "India", "ydiedcountry": "United Kingdom", "zgender": "male" }, { "firstname": "Har Gobind", "surname": "Khorana", "xborncountry": "India", "ydiedcountry": "USA", "zgender": "male" }, { "firstname": "Mother Teresa", "xborncountry": "Ottoman Empire (now Republic of Macedonia)", "ydiedcountry": "India", "zgender": "female" }, { "firstname": "Rudyard", "surname": "Kipling", "xborncountry": "British India (now India)", "ydiedcountry": "United Kingdom", "zgender": "male" }, { "firstname": "Rabindranath", "surname": "Tagore", "xborncountry": "India", "ydiedcountry": "India", "zgender": "male" }, { "firstname": "Amartya", "surname": "Sen", "xborncountry": "India", "zgender": "male" }, { "firstname": "Muhammad", "surname": "Yunus", "xborncountry": "British India (now Bangladesh)", "zgender": "male" }, { "firstname": "Venkatraman", "surname": "Ramakrishnan", "xborncountry": "India", "zgender": "male" }, { "firstname": "Kailash", "surname": "Satyarthi", "xborncountry": "India", "zgender": "male" } ] |
놀라운 결과! 잘 알려진 인도 노벨상 수상자 외에도 러디어드 키플링을 비롯한 영국의 유명한 수상자 몇 명이 인도에서 태어났습니다. 인도에서 태어나지 않고 인도에서 사망한 수상자는 단 한 명뿐입니다: 바로 마더 테레사입니다.
카테고리를 알아보세요.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
select lp.category, COUNT(1) prizecount from laureate l unnest l.laureates llist unnest llist.prizes lp where llist.bornCountry = "India" or lower(llist.bornCountry) like "%india%" or llist.diedCountry = "India" or lower(llist.diedCountry) like "%india%" group by lp.category order by prizecount DESC |
|
1 2 3 4 5 6 7 |
category prizecount peace 3 physics 3 literature 2 medicine 2 economics 1 chemistry 1 |
과제 4: 카테고로피로 노벨상 수상 상위 7개국의 누적 그래프 만들기
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
select llist.bornCountry as xborncountry, lp.category ycategory, COUNT(1) zprizecount, SUM(COUNT(1)) OVER(partition by llist.bornCountry) z1countrytot, SUM(COUNT(1)) OVER( partition by llist.bornCountry order by lp.category ) z1ctrycatcount from laureate l unnest l.laureates llist unnest llist.prizes lp group by llist.bornCountry, lp.category order by z1countrytot desc, ycategory |
결과(간결성을 위해 하위 집합)

이를 통해 상위 7개국을 누적 열 그래프로 만들고 카테고리별로 상금을 표시해 보겠습니다.

이 모든 데이터 조작은 재미와 학습을 위한 것입니다. 하지만 이 우승자들이 만들어낸 진보와 평화는 국경이 없습니다.
다운로드할 수 있습니다. 데이터 세트 그리고 카우치베이스. 그런 다음 자신만의 흥미로운 질문을 하고 답하세요!