본문 바로가기

분류 전체보기139

[Apps script] Google Spreadsheet에서 slack 메시지 보내기 업무용으로 구글 스프레드 시트에서 기록된 데이터를 슬랙으로 쏴주고 싶었다. 그런데 자꾸 invalid_payload 에러가 나서 한참을 해맸다. function myFunction() { var slackUrl = "https://hooks.slack.com/services/주소" ; var contents = 내용; var msg = {"text" : contents }; var option = { 'method' : 'post', 'ContentType':'application/json', 'payload': JSON.stringify(msg) }; Logger.log(option) UrlFetchApp.fetch(slackUrl, option); } 처음 찾아본 레퍼런스에서 이것저건 수정하긴 했는데.. 2022. 11. 15.
[excel] 자료해석/NCS 분수비교(나눗셈) 어림산 - 문제 랜덤 생성 시트 자료해석/수리영역의 핵심은 어림산? PSAT 자료해석이나 NCS 수리영역에서 기본 중 하나는 어림산이라 생각한다. 기본적으로 이 시험들의 목적은 짧은 시간에 얼마나 많은 양의 정보를 필요한 만큼 흡수하고 올바른 결론에 도달하는지 보는지이기에 우선은 속도다. 그래서 문제푸는 시간을 1초라도 아껴야하고, 쓸데없이 세밀한 계산보다는 어림산이 기본 스킬이 된다. 어림산은 연습 없이 안된다! 그러나 대부분의 사람은 이런 계산에 익숙하지 않다. 그래서 훈련이 필요한데 다행히도 이러한 훈련에 적합한 여러가지 도구들이 있다. 한창 NCS 준비할 때는 매일 아침마다 비타민이라는 걸 풀었던 기억이 난다. 그런데 풀다보면 똑같은 문제 페이지도 있고, 자리수나 난이도가 비슷하다보니 지루한 느낌도 있었다. 그래서 만든 분수비교.. 2022. 11. 7.
HackerRank SQL - Higher Than 75 Marks Query the Name of any student in STUDENTS who scored higher than Marks. Order your output by the last three characters of each name. If two or more students both have names ending in the same last three characters (i.e.: Bobby, Robby, etc.), secondary sort them by ascending ID. Input Format The STUDENTS table is described as follows: The Name column only contains uppercase (A-Z) and lowercase (a.. 2022. 11. 1.
HackerRank SQL - The Blunder Samantha was tasked with calculating the average monthly salaries for all employees in the EMPLOYEES table, but did not realize her keyboard's key was broken until after completing the calculation. She wants your help finding the difference between her miscalculation (using salaries with any zeros removed), and the actual average salary. Write a query calculating the amount of error (i.e.: avera.. 2022. 11. 1.
[MySQL] 정규 표현식(instr(), like(), replace(), substr()) 정규 표현식이란 정규식 또는 정규 표현식은 문자열에서 일치하는 패턴을 찾아내는 데 쓰이는 형식 언어이다. 정규식에 대한 자세한 내용은 나중에 따로 정리해두겠지만, SQL에서도 쓸 수 있기에 함수만 아래와 같이 정리했다. 정규식 함수 및 연산자 NOT REGEXP 정규식의 부정 REGEXP 문자열이 정규식과 일치하는지 여부 REGEXP_INSTR() 정규식과 일치하는 부분의 문자열의 시작 인덱스 REGEXP_LIKE() 문자열이 정규식과 일치하는지 여부 REGEXP_REPLACE() 문자열이 정규식과 일치하는 부분을 바꾸기 REGEXP_SUBSTR() 문자열이 정규식과 일치하는 부분을 반환 RLIKE 문자열이 정규식과 일치하는지 여부 출처: https://dev.mysql.com/doc/refman/8.0.. 2022. 10. 31.
[MySQL] 없는 시간 표시하기(재귀적 CTE) 시계열(Time Series) 데이터가 아닌 경우 시계열 형태로 시각화를 할 때, 해당 범위에 데이터가 없는 경우 그래프가 아예 누락되게 된다. 이 경우 시각적으로 직관적이지도 않고, 그래서 해석하는데 시간이 더 걸리게 된다. 없는 숫자(e.g. 시간, 분 등) 표시하기 표기가 안되는 값을 강제로 출력하게 하여 없는 항목을 출력하게 만들 수 있다. WITH RECURSIVE my_cte AS ( SELECT 1 AS n UNION ALL SELECT 1+n FROM my_cte WHERE n 2022. 10. 26.
[MySQL] HackerRank SQL - Weather Observation Station 10 Problem Query the list of CITY names from STATION that do not end with vowels. Your result cannot contain duplicates. Input Format The STATION table is described as follows: where LAT_N is the northern latitude and LONG_W is the western longitude. STATION의 테이블에서 모음으로 끝나지 않는 CITY명만 출력하라. 단, 중복은 제외하라. Answer1 SELECT CITY FROM STATION WHERE RIGHT(CITY,1) NOT IN ('a','e','i','o','u') GROUP BY CITY H.. 2022. 10. 20.
[MySQL] 날짜 형식/포맷 변환 함수- DATE_FORMAT DATE_FORMAT 함수 MySQL에서 시간,날짜를 원하는 형태로 표기 방식을 바꿔주는 함수 함수의 구성은 DATE_FORMAT(date,format) 이며, 문자열 date에 값의 형식을 format으로 지정한다. 아래 표에 표시된 지정자를 format문자열에 사용할 수 있다, 가장 많이 쓰는 형태 중 하나인 yyyy-mm-dd 라면, 다음과 같다. (여기서 ins_date라는 날짜/시간형태(yyyy-mm-dd hh:mm:ss인 column) DATE_FORMAT(ins_date, '%Y-%m-%d') SpecifierDescription 지정자 설명 부연 %a Abbreviated weekday name (Sun..Sat) %b Abbreviated month name (Jan..Dec) %c Mo.. 2022. 10. 20.