728x90 쿼리문2 [SQL 스터디] 5일차 SUBSTRING(), REPLACE(), POSITION(), COALESCE() SUBSTRING(): 문자열 일부분을 보기 위함 SELECT SUBSTRING('This is test data' FROM 1 FOR 4) test_data_extracted; REPLACE(): 특정 문자열을 원하는 문자로 변환 SELECT department, REPLACE(department, 'Clothing', 'Attire') modified_data FROM departments; POSITION(): 문자열에서 지정한 문자열의 위치를 반환(IN table명 같이 쓰임) SELECT POSITION('@' IN email) FROM employees COALESCE(): NULL 값인 컬럼을 원하는 문자로 일괄 변경 SELECT COALESCE(email, 'NONE') as email F.. 2020. 3. 5. [SQL 스터디] 3일차 ORDER BY(DESC, ASC), DISTINCT, LIMIT, as ORDER BY: 정렬 구문 (DESC 오름차순, ASC 내림차순) DISTINCT: 중복 제거 LIMIT: 보여주는 데이터 개수 한계치 as: 테이블 명 변경 시 사용 1. Write a query to display the names of those students that are between the ages of 18 and 20. SELECT * FROM students WHERE age BETWEEN '18' AND '20' 2. Write a query to display all of those students that contain the letters "ch" in their name or their name ends with the letters "nd". SELECT * FROM s.. 2020. 3. 3. 이전 1 다음 반응형