Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 구현
- Matrix
- greedy
- Counting
- sorting
- Class
- hash table
- Math
- 코딩테스트
- Method
- geometry
- Number Theory
- 코테
- bit manipulation
- string
- Data Structure
- implement
- simulation
- two pointers
- 자바
- database
- Binary Search
- SQL
- dynamic programming
- java
- array
- Stack
- 파이썬
- Binary Tree
- Tree
Archives
- Today
- Total
코린이의 소소한 공부노트
[LeetCode/Easy] 627. Swap Salary 본문
1. Input
1) Table: Salary (pk: id)

2. Output
1) 직원들의 성별을 바꾼 결과를 출력
- f는 m으로, m은 f로
- update는 1번만 사용
- select문 사용 금지
3. Example

4. Code
1) 첫 코드(2023/05/25)
update Salary set sex= if(sex='m', 'f', 'm');
2) 다른 사람의 코드 중 다소 신박했다고 생각한 코드(2023/05/25)
UPDATE Salary SET sex = CHAR(ASCII('f') + ASCII('m') - ASCII(sex))
'코딩테스트 풀이 > SQL' 카테고리의 다른 글
[LeetCode/Easy] 1327. List the Products Ordered in a Period (0) | 2023.06.11 |
---|---|
[LeetCode/Easy] 1141. User Activity for the Past 30 Days I (0) | 2023.06.08 |
[LeetCode/Easy] 619. Biggest Single Number (0) | 2023.05.25 |
[LeetCode/Easy] 511. Game Play Analysis I (0) | 2023.05.23 |
[LeetCode/Easy] 2356. Number of Unique Subjects Taught by Each Teacher (0) | 2023.05.02 |