일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- STR
- If
- iNT
- LOWER
- len
- DART
- index
- FOR
- decorator
- Sorted
- 위코드
- Python
- or
- sum
- Algorithm
- map
- and
- join
- slice
- list
- count
- MAX
- 파이썬
- WECODE
- SQL
- lambda
- range
- js
- enumerate
- split
- Today
- Total
목록SQL (69)
코드로 우주평화
You are working for a local school, and you are responsible for collecting tuition from students. You have a list of all students, some of them have already paid tution and some haven't. Write a select statement to get a list of all students who haven't paid their tuition yet. The list should include all the data available about these students. students table schema name (string) age (integer) s..
Task Given three integers a ,b ,c, return the largest number obtained after inserting the following operators and brackets: +, *, () In other words , try every combination of a,b,c with [*+()] , and return the Maximum Obtained Consider an Example : With the numbers are 1, 2 and 3 , here are some ways of placing signs and brackets: 1 * (2 + 3) = 5 1 * 2 * 3 = 6 1 + 2 * 3 = 7 (1 + 2) * 3 = 9 So th..
Given the following table 'decimals': ** decimals table schema ** id number1 number2 Return a table with one column (mod) which is the output of number1 modulus number2. Solution: SELECT MOD(number1, number2) FROM decimals; MOD is a function that calculates the remainder when number1 and number2 are divided.
Given a demographics table in the following format: ** demographics table schema ** id name birthday race you need to return the same table where all letters are lowercase in the race column. Solution: SELECT id, name, birthday, LOWER(race) as race FROM demographics;
For this challenge you need to create a simple SELECT statement that will return all columns from the people table WHERE their age is over 50 people table schema id name age You should return all people fields where their age is over 50 and order by the age descending NOTE: Your solution should use pure SQL. Ruby is used within the test cases to do the actual testing. Solution: SELECT * FROM peo..
RDB란? 관계형 데이터베이스는 엄격하게 정의된 스키마를 요구하는 테이블 기반 데이터 구조입니다. 엄격한 스키마로 데이터 중복이 없고, 데이터를 유지보수하는데 효율적입니다. 다만, 시스템이 커지면 join문이 복잡해지고 성능 향상을 하려면 스케일 업만 가능하여 비용이 크게 발생합니다. *스키마(schema)는 데이터베이스에서 자료의 구조, 자료의 표현 방법, 자료 간의 관계를 형식 언어로 정의한 구조입니다. -위키- 그렇다면 NoSQL은 무엇일까요? NoSQL은 테이블 구조가 아닌 비정형 데이터를 저장할 수 있습니다. 유연하고 자유로운 데이터 구조이나 데이터 수정시 모든 컬렉션에서 수정이 필요하기 때문에 update가 적고 조회가 많은 경우에 유리합니다. 이 둘은 언제 사용하는게 좋을까요? RDB 데이터..
오늘 한 것 SQL 물리 삭제와 논리 삭제에 대해 스터디 모임에서 발표하고 블로그에 정리 글을 올렸다. 2022.02.03 - [Dev/DB] - 물리삭제와 논리삭제를 코드로 구현해 보았다. git에 대해 공부하고 아직 생소한 것은 따로 메모에 정리해두었다. 2022.02.03 - [Dev/Etc] - git 개념 정리 성장한 점 SQL을 설명하기위해 간단하게 서버 API와 SQL문 코드를 만들었는데 2시간 정도 소요되었다. 간단한 앱을 스스로 처음부터 만들 수 있게 되었다는 점이 놀랍다. 기존에 쓰던 git에 대한 쓰임새와 모르던 기능을 제대로 알게되었다. 익숙해지기 위해 평소에 자주 사용해보자. 노력할 점 SQL의 '서브쿼리'나 '조인'에 대해서는 더 공부해야 한다. 오늘 이력서 피드백 세션이 있었는..
삭제에는 두 가지 방법이 있다. 물리삭제는 실제 데이터베이스에서 제거하는 것이고, 논리삭제는 같은 테이블에 '삭제플레그'의 값을 변경하여 실제 삭제된 것과 동일하게 처리하는 방식이다.(이 외에도 논리삭제의 방법은 다양하다) 코드로 구현해 본다면? 깃헙 링크 (깃헙 링크에 들어가면 코드를 모두 볼 수 있다.) @app.route("/snack/", methods=["DELETE", "PUT"]) def delete(id): if request.method == "DELETE": SnackDelete.delete_physics(id) elif request.method == "PUT": SnackDelete.delete_logical(id) result_value = SnackDelete.select_all..
목표 파일 시스템을 활용하여 수신 데이터를 저장해두었다가 벌크로 DB에 저장하는 로직 구현하기 문제 파일 시스템으로 csv파일에 데이터를 입력해야 함 DB에 벌크로 입력하는 코드를 작성해야 함 csv에서 DB로 벌크 입력한 후 해당 파일의 내용은 삭제해야 함 최신 데이터 100개를 가져오는 로직을 구현해야 함 행동 csv파일을 생성하고 데이터를 입력하는 로직 구현함 sql문으로 벌크 저장하는 로직 구현함 csv의 전체 데이터를 읽어 들여 DB에 입력하는 기능 구현함 DB에서 최근 데이터 100개 불러오는 로직 구현함 고민 csv 데이터를 요청 때마다 초기화 해주지 않으면 DB로 중복해서 저장될 우려가 있음 csv 전체 데이터를 한 번에 저장하기 때문에 요청과는 별개로 불필요한 부하가 생길 수 있음 앞으로..