데이터 분석 공부/SQL
-
[SQL][해커랭크] Draw The Triangle 1 / SET @, REPEAT데이터 분석 공부/SQL 2024. 5. 17. 12:52
https://www.hackerrank.com/challenges/draw-the-triangle-1/problem?isFullScreen=true Draw The Triangle 1 | HackerRankDraw the triangle pattern using asterisks.www.hackerrank.com 문제P(R) represents a pattern drawn by Julia in R rows. The following pattern represents P(5):* * * * * * * * * * * * * * *Write a query to print the pattern P(20). 풀이 SET @NUMBER = 21;SELECT REPEAT('* ', @NUMBER := @NUMBER..
-
[SQL][해커랭크] The PADS / 문자열 출력데이터 분석 공부/SQL 2024. 5. 14. 16:37
https://www.hackerrank.com/challenges/the-pads/problem?isFullScreen=true The PADS | HackerRankQuery the name and abbreviated occupation for each person in OCCUPATIONS.www.hackerrank.com 이 문제는 크게 두 쿼리로 나누어서 풀게 되어 있습니다. 쿼리 1 ) 사람이름(직업의 첫글자 따오기) 쿼리 2 ) 직업 별로 몇 명의 사람이 있는지 카운트하여 문장과 함께 출력하기 [ Output ]Your Output (stdout)Aamina(D)Ashley(P)Belvet(P)Britney(P)Christeen(S)Eve(A)Jane(S)Jennifer(A)Jenny(S..
-
[SQL][해커랭크] weather observation station 9, 10 / 정규표현식, 와일드카드데이터 분석 공부/SQL 2024. 5. 13. 12:24
https://www.hackerrank.com/challenges/weather-observation-station-9/problem?isFullScreen=true Weather Observation Station 9 | HackerRankQuery an alphabetically ordered list of CITY names not starting with vowels.www.hackerrank.com 모음으로 시작하지 않는 CITY 명을 중복 없이 추출해야 하는 문제입니다. 풀이 1 ) % 와일드카드 사용하기SELECT DISTINCT CITY FROM STATION WHERE CITY not like 'a%'AND CITY not like 'e%'AND CITY not like 'i%'AND..
-
mysql start 시 cannot change directory to /nonexistent: No such file or directory 오류 해결데이터 분석 공부/SQL 2024. 4. 22. 15:02
오류 상황 root@LAPTOP-VJDJ5BIJ:~/workspace# service mysql start * Starting MySQL database server mysqld su: warning: cannot change directory to /nonexistent: No such file or directory 오류 원인 : Windows에 MySQL 워크벤치를 기설치하였고, 우분투(WSL) 서버에서 MySQL Server에 접속하려고 하였더니 윈도우와 WSL에서 같은 포트를 사용하려고 했기 때문에 서버 내에서 SQL이 실행되지 않음. 오류 해결 방법 : 우분투 WSL에 MySQL 실행 시 기본적으로 127.0.0.1 주소에 포트 번호 3306으로 접속하게 되어 있는데, 접속 포트 번호를 330..
-
우분투 SQL 설치 및 환경설정, Sqlalchemy데이터 분석 공부/SQL 2024. 4. 11. 17:01
# mysql 설치 sudo apt install mysql-server # mysql 동작 상태 확인 sudo service mysql status # 시작/중지/상태/재시작 sudo service mysql start[stop/status/restart] # MySQL 서비스가 시스템 부팅 시에 자동으로 시작되도록 설정 sudo systemctl enable mysql # 계정 설정 # root 권한으로 mysql 접속 sudo mysql -uroot -p # MySQL 데이터베이스에 등록된 모든 사용자와 해당 사용자가 접근할 수 있는 호스트를 조회합니다. select user, host from mysql.user; # 데이터베이스를 사용할 신규 유저 생성 create user [유저명]@'%' i..