전체 글

공부한 것, 배운 것들을 기록합니다
https://leetcode.com/problems/department-highest-salary/ Department Highest Salary - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com DENSE RANK() 를 사용하여 출력하기 우선 DENSE RANK()와 RANK()의 차이점 output을 기준으로 보면, 다음과 같이 Salay가 내림차순으로 정렬이 되어 있다. - RANK() 함수 : Max 1위, Randy와 Joe 2위, 그리고 Will ..
https://leetcode.com/problems/department-highest-salary/ Department Highest Salary - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 처음 짠 쿼리 SELECT Top.Name AS Department, E1.Name AS Employee, E1.Salary FROM Employee AS E1 INNER JOIN (SELECT D.Name, E.DepartmentId, MAX(Salary) AS S..
https://leetcode.com/problems/consecutive-numbers/ Consecutive Numbers - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Input : Table Logs Output : 처음 쿼리 : SELECT L1.Num AS ConsecutiveNums FROM Logs AS L1 INNER JOIN Logs AS L2 ON L1.Id+1 = L2.id INNER JOIN Logs AS L3 ON L1.Id + 2 ..
The Report - BETWEEN 범위 조건으로 JOIN 하기 report NOT : Names of those students who received a grade lower than 8. → if the grade is lower than 8, use "NULL" Ordering by grade in descending, than alphabetically More than one student with the same grade (1-7), ordering by marks in ascending order SELECT CASE WHEN G.grade >= 8 THEN S.Name ELSE NULL END AS Name, G.grade, S.Marks FROM Students S, Grades G..
파이썬 표준 라이브러리는 C로 구현된 시퀀스를 제공한다 1) 자료형에 따른 분류 컨테이너 시퀀스(Container Sequence): 객체에 대한 참조. 서로 다른 자료형의 항목을 담을 수 있음. list, tuple, collections.deque 규일 시퀀스(Flat Sequence): 자신의 메모리 공간에 각 항목의 값. 단 하나의 자료형만 담을 수 있음. str, bytes, bytearray, memoryview, array.array 2) 가변성에 따른 불류 가변 시퀀스 : list, bytearray, array.array, collections.deque, memoryview 불변 시퀀스 : tuple, str, bytes 지능형 리스트(list comprehension) colors =..
1. 문자열 표현 __repr__() 특별 메서드는 객체를 문자열로 표현하기 위해 repr() 내장 메서드에 의해 호출된다. __repr__() 메서드가 반환한 문자열은 명확해야 하며, 가능하면 표현된 객체를 재생성하는 데 필요한 소스 코드와 일치해야 한다. __repr__()와 __str__()을 비교하면, __str__() 메서드는 str() 생성자에 의해 호출되며 print()에 의해 암묵적으로 사용된다. __str__()은 사용자에게 보여주기 적당한 형태의 문자열을 반환해야 한다. 이 두 메서드 중 하나만 구현해야 하면 __repr__() 메서드를 구현하는 것을 추천한다. 파이썬 인터프리터는 __str__() 메서드가 구현되어 있지 않을 때의 대책으로 __repr__() 메서드를 호출하기 때문이다..
Hanna 한나
평범하듯, 흔하지 않게