with temp_01 as ( select d.category_name, to_char ( date_trunc ('month', a.order_date), 'yyyymm') as month_day, sum (amount) as sum_amount, count ( distinct a.order_id) as monthly_ord_cnt from orders a join order_items b on a.order_id = b.order_id join products c on b.product_id = c.product_id join categories d on c.category_id = d.category_id group by d.category_name, to_char ( date_trunc ('month', a.order_date), 'yyyymm') ) select *, sum (sum_amount) over ( partition by month_day order by month_day) as temp1, sum (sum_amount) over ( partition by month_day) as temp2, sum_amount / sum (sum_amount) over ( partition by month_day) as ratio from temp_01 집계 어날리틱 함수는 order by를 사용하면 파티션 내에서 누적합이 되는것으로 알고 있었는데 왜 이렇게 나올까요...? 제가 혹시 놓친게 있는 걸까요
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. select, from, limit 다 완벽하게 작성한 것 같은데 오류가 나서 질문글 찾아보니 limit 뒤에 세미콜론을 안적어서 그렇다는데 저는 적어도 저렇게 나오는데 이유가 뭘까요?
2가지의 풀이 방법을 알 수 있었습니다 -- 1번 풀이 : 서브쿼리 select salary * months as earnings , count(*) from employee where salary * months = (select max(salary*months) from employee) group by earnings -- 2번 풀이 : order by , limit select salary * months as earnings , count(*) from employee group by earnings order by earnings desc limit 1 궁금한 사항은 두가지 방법 중 어느 코드의 성능이 더 좋게 평가 되는지 궁금합니다.
128줄에 return inside에서 inside()를 안하는 이유가 궁금합니다 @higher_order_example 자체가 inside 리턴받은 함수를 자동으로 ()붙여서 실행해주는 것인가요? 136줄에 sample_example()을 안쓰면 121줄에 있는 func 매개변수로 못넣는것인가요???
해당 문제를 풀 때 다음과 같이 코드를 작성했는데요. SELECT City FROM Station WHERE City LIKE 'a%' or 'e%' or 'i%' or 'o%' or 'u%'; 결과물을 보니까 A로 시작하는 CITY만 출력되더라고요. OR로 연결되는 모든 조건에는 컬럼명과 LIKE를 써줘야 하닌데, 'a%' 뒤에 있는 것들은 그렇지 않아서 결과로 출력되지 않은 건가요? AND도 OR처럼 여러 번 쓰면 뒤에 컬럼명과 LIKE를 또 써줘야 하나요?
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 강의 내용을 질문할 경우 몇분 몇초의 내용에 대한 것인지 반드시 기재 부탁드립니다. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 선생님 보스턴 가격예측 데이터 임포트가 안돼요 ㅠㅠ
안녕하세요. 강사님 아래 코드에서 '블랙핑크' 를 검색할 때 Traceback (most recent call last): File "c:\pratice_crolling\심화1_\03_스포츠 뉴스 크롤링.py ", line 52, in <module> print(article_title.text.strip()) ^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'text' 다음과 같은 오류가 뜹니다 ㅠㅠ CSS 선택자, 오타도 모두 맞게 확인이 되는데 왜 저 검색어만 오류가 뜰까요ㅠㅠ? # -*- coding: euc-kr -*- # 네이버에서 손흥민, 오승환과 같은 스포츠 관련 검색어 크롤링하기 import requests from bs4 import BeautifulSoup import pyautogui import time search = pyautogui.prompt("어떤 것을 검색하시겠어요?") response = requests.get(f"https://search.naver.com/search.naver?sm=tab_hty.top&where=news&query={search}&oquery=%EC%98%B7%EC%9C%BC%ED%99%98&tqi=i74G%2FdprvTossZPeMhCssssssko-058644") html = response.text soup = BeautifulSoup(html, "html.parser") articles = soup.select(".info_group") for article in articles: # '네이버뉴스' 가 있는 기사만 추출한다. (<a> 하이퍼링크가 2개 이상인 경우에 해당) links = article.select("a.info") if len(links) >=2 : url = links[1].attrs['href'] response = requests.get(url, headers={'User-agent':'Mozila/5.0'}) html = response.text soup = BeautifulSoup(html, "html.parser") # 스포츠 기사인 경우 if "sports" in url: article_title = soup.select_one("h4.title") article_body = soup.select_one("#newsEndContents") # 본문 내에 불필요한 내용 제거 p태그와 div태그의 내용은 출력할 필요가 없다. 없애주자. p_tags = article_body.select("p") # 본문에서 p 태그인 것들을 추출 for p_tag in p_tags: p_tag.decompose() div_tags = article_body.select("div") # 본문에서 div 태그인 것들을 추출 for div_tag in div_tags: div_tag.decompose() # 연예 기사인 경우 elif "entertain" in url: article_title = soup.select_one(".end_tit") article_body = soup.select_one("#articeBody") # 일반 뉴스 기사인 경우 else: article_title = soup.select_one("#title_area") article_body = soup.select_one("#dic_area") # 출력문 print("==================================================== 주소 ===========================================================") print(url.strip()) print("==================================================== 제목 ===========================================================") print(article_title.text.strip()) print("==================================================== 본문 ===========================================================") print(article_body.text.strip()) #strip 함수는 앞 뒤의 공백을 제거한다. time.sleep(0.3)
강의 따라해도 생성이 안되서 골머리를 앓았는데 -- This script does not create a database. -- Run this script in the database you want the objects to be created. -- Default schema is dbo. 이렇게 적혀있더라고요. 이제 테이블을 자동으로 생성해주지 않아요 테이블 만들고 코드 복붙하면 데이터가 생깁니다. 그럼 이만
기본 학습테이블인 BONUS, DEPT, EMP, SALGRADE 가 요즘 쓰는 SQL Developer 버전에는 없네요.. 그래서 테이블 코드 복사해서 입력하면 자꾸 지정한 월이 부적합합니다. 오류가 뜨는데 해결을 못하고있어서 강의를 못듣고 있습니다 ..ㅠㅠ 해결방법좀 알려주세요.
안녕하세요. 윈도우 11 사용하고 있습니다. 실습 자료를 복원하는데 아래와 같은 문구가 나오면서 안 됩니다 .. 해결방법이 있을까요 ? unrecognized win32 error code: 123pg_restore: error: could not open input file "C:\Users\DS\Documents\???\????_?????_????\data_schema.backup": Invalid argument
안녕하세요. 덕분에 좋은강의 잘 듣고 있습니다. 조인실습1에서 해당 내용 궁금하여 질문드립니다! select절에 다른 컬럼들도 있는데 1,2,3만 지정이 된건 그 컬럼들만 순서를 정하기 위함인가요? 그럼 나머지 컬럼들은 알아서 순서대로 출력된다고 보면 될까요? order by 1,2,3 맨 마지막에 c.fromdate가 들어간 이유는 fromdate 컬럼 기준으로 정렬을 해주기 위함일까요?