목록BF 2024 (107)

* 여러 개의 SQL 문을 합쳐서 하나의 SQL 문으로 만들어주는 방법 ( 주의. 칼럼의 개수가 같아야함 ) select * from table1 UNION | UNION ALL select * from table2 1) UNION : 중복된 값을 제거하여 알려준다 2) UNION ALL : 중복된 값도 모두 보여준다 * UNION 기본 문법

** concat : 여러 문자열을 합치거나 연결해주는 함수 select concat('string1','string2',....) ** alias : 칼럼이나 테이블 이름이 너무 길거나 어려울 때 편의상 별칭 생성 , as는 생략도 가능 ** 칼럼에 별칭 생성 select column as alias from tablename; job_title 이라는 칼럼을 jt 라는 별칭으로 설정했다 원 테이블을 확인해보니 원래의 칼럼 명은 바뀌지 않았다. concat 활용 , 별칭 칼럼 명으로 concat 된 데이터들이 출력된다 select join 에서 alias 활용해보기 ** 테이블에 별칭 생성 select column1, column2 .. from tablename as alias; ** DISTINCT..

* join 이란? 두 개 이상의 테이블을 결합하는 것 ** INNER JOIN : 두 테이블의 공통영역을 선택하는 조인 방식 select * from table A inner join table B on tableA.column = tableB.column where condition; ** LEFT JOIN : 두개의 테이블에서 공통영역을 포함해, 왼쪽 테이블의 다른 데이터를 포함하는 조인방식 ** RIGHT JOIN : 두개의 테이블에서 공통영역을 포함해, 오른쪽 테이블의 다른 데이터를 포함하는 조인방식 * left join & right join 은 공통영역을 제외하고 어떤 영역의 데이터를 보여줄 것인지에 대한 차이 select * from tableA left join tableB on tabl..

2022.03.15 화 * 2000년대 데이터마이닝 시장처럼 2010년대 빅데이터 열풍도 거품인가? -> 정부 주도의 빅데이터 성장 -> 데이터 뉴딜 정책 ( DNA, data network ai ) -> 공공 데이터 활성화 * 빅데이터 분석의 미래 고려사항 및 분석가의 자세 * 개인정보 관련 이슈 -> 데이터 3법 ( 개인정보보호법, 정보통신망법, 신용정보법 ) * 마이 데이터 시범사업 * 국가에서 데이터 분석가 인력 양성중 ( 여러 바우처, 교육 지원 등 ). * 빅데이터 분석기사 자격증 ( 국가인증 국가 자격증 ) , adp adsp는 국가인증 민간 자격증 * 빅데이터 지도화 , 모든 공공기관이 보유한 공공데이터를 전수조사하고 현황을 보여주는 국가데이터 맵 구축 > 공공데이터 개방 3만개 이상 **..

* AND : 조건을 모두 만족하는 경우 참 * OR : 하나의 조건이라도 만족하는 경우 참 * NOT : 조건을 만족하지 않는 경우 참 -> WHERE NOT ( age > 30 ) -> NOT 을 조건절 앞에 사용 * BETWEEN : 조건값이 범위 사이에 있으면 참 -> column BETWEEN value1 AND value2 * IN : 조건값이 목록에 있으면 참 -> where column IN ('val') -> IN (괄호를 꼭 쳐주지 않으면 sytnax error 발생 ) * LIKE : 조건값이 패턴에 맞으면 참 -> where column LIKE pattern -> * and 조건 예제 * 예제 1 ) and or 을 섞었을 경우 and가 우선순위가 높다. 굳이 괄호가 필요는 없다 ..

* A B 와 A != B 는 둘다 같지 않다는 의미 * 34 살인 이종연 프로, 조영선 선수를 제외한 프로들이 출력된다 * 여러가지 사용해본다 .. 사실 비교 연산자에서 굳이 유의할 내용은 없는것 같다

* 테이블 생성 시 해당 옵션들을 설정해준다 * null 을 허용할 것인가? NO -> not null 로 표현 * key 값은 무엇인가 ? Primary key 표시가 된 상태 * default , 기본값을 ''설정해준다 * extra ( auto_increment ) , id 에서 자동으로 값을 1 증가시킬 것이다 * 생성한 테이블 확인 * 예시는 언제나 그렇듯 , 최애 스포츠 볼링으로.. kpba 홈페이지의 회원 정보에서 확인한 정보들을 넣어준다 * 조영선 선수만 실업팀 선수이기 때문에.. 나무위키 정보를 참조했다 * 인제 값들을 넣어준다 insert into celeb values (~~~) ; * 테이블 확인 show tables; select * from celeb; ** Order by 는,..

** update 명령어는 데이터를 수정할 수 있다 * update tablename set column1 = value1, column2 = value2 , ... where condition; - where을 명시하지 않으면 모든 데이터가 변경된다 * 예시 * Delete from database where condition;

** select 문은 테이블의 데이터를 조회하는 명령어이다 , 제일 많이 쓰고 , 더 복잡해진 형태로 사용하게 된다 * select column1, column2,... from tablename; 우선은 desc table 로 , 어떤 칼럼들이 있는지 확인한다 가져올 칼럼 값들을 선택한다, 해당 값들만 출력된다 * 모든 컬럼에 대한 데이터를 조회 select * from tablename; ** select ~ from ~ where condition; 으로 조건을 충족하는 데이터를 조회할 수 있다

연습할 환경을 구축해본다 sample db 라는 데이터 베이스 생성 , show databases; 로 생성 확인 use sampledb; 로 해당 데이터 베이스로 이동 dml_practice 라는 테이블 생성 , show tables; 로 생성 확인 desc dml_practice 로 칼럼과 데이터 타입 확인 ** Insert , 데이터 추가하기 * insert into tablename(column1, column2, ... ) values ( value1, value2, ... ) ; insert 한 데이터 확인해보기 * insert into tablename(column1, column2, ... ) -> 모든 칼럼에 값을 넣을 경우 insert into tablename 만 해도 정상 시행 va..

** table의 이름을 mytable 에서 newtable로 변경해보자 alter table tablename rename newtablename; ** age라는 실수형 포맷을 가진 칼럼추가하기 alter table tablename add column age double; * desc ( describe ) table; 으로 확인하기 ** column 의 자료형 변경하기 ( alter ~ modify column ~ ) alter table tablename modify column columnname type; ** column 이름 변경하기 alter table tablename change column old_column name new_columnname new_datatype; ** col..

* db 하나 생성 * 다국어 및 이모티콘 지원 -> default character set utf8mb4 create database practicedb default character set utf8mb4; * 생성 후 데이터 베이스 확인 , show databases; * 저번에 지우지 않은 testdb 삭제, drop database testdb; * Table 이란? > 데이터베이스 안에서 실제 데이터가 저장되는 형태이고, 행과 열 형태로 구성된 데이터 모음 * Table 생성 CREATE TABLE tablename( columname datatype, columname datatype, ... ); * id ( int ) 와 name(varchar(16)) 칼럼을 가지는 mytable 이라는..