프로그래머스 문제 - 순서쌍의 개수, 문자열안에 문자열
(String method)
contains(CharSequence s)
Returns true if and only if this string contains the specified sequence of char values.
https://docs.oracle.com/javase/8/docs/api/
문자열에 포함이 되었는지 확인하는 메소드
return str1.contains(str2) ? 1 : 2;
str1를 포함하고 있으면 1, 아니면 2를 리턴하도록 함
contains()
라는 메소드가 있는지 몰라서 for문과 if문과 stream도 써보려고 노력하고 결국 검색해서 알아냈다.# world에서 데이터 가져와서 my_city에 넣어
insert into my_city select name, population from world.city;
drop table my_city; # 테이블 삭제 속도가 빠름.
create table my_city (id int auto_increment primary key, city_name char(35), population int);
desc my_city; # 테이블 구조 조회
insert into my_city select null, name, population from world.city; #id auto_increment
# 테이블을 남겨두고 내용은 삭제 모든 행을 삭제 . delete보다 빠름
truncate table my_city;
insert into my_city(city_name, population) select name, population from world.city; #id auto_increment
# 값 변경
update my_city set city_name = '서울' where city_name = 'Seoul';