본문 바로가기

전체 글

[Day30][JDBC] 회원관리 및 글쓰기 / 글조회 / 글변경 / 글삭제 회원관리 및 글쓰기/글조회/글변경/글삭제 프로그램을 만들어 보자. (SQL)JDBC_MYORAUSER create table jdbc_tbl_member (no number ,userid varchar2(20) not null ,passwd varchar2(20) not null ,name varchar2(40) not null ,adress varchar2(200) ,birthday varchar2(20) -- 생년월일 ,gender number(1) -- 1 : 남 / 2 : 여 ,registerday date default sysdate ,point number default 0 -- 글쓰기를 1개 할 때마다 point는 10점씩 증가 ,status number(1) default 1 -- 1 : .. 더보기
[Day29][JDBC] Select where / Delete / 수동commit / PreparedStatement Ⅰ. select where -- Package(jdbc.day01.sql)에 Class(JdbcTest04SelectWhere) Class(JdbcTest03Select) 복사하여 생성 (Eclipse)package jdbc.day01.sql; import java.sql.*; import java.util.Scanner; public class JdbcTest04SelectWhere { public static void main(String[] args) { Connection conn = null; Statement stmt = null; ResultSet rs = null; Scanner sc = new Scanner(System.in); try { Class.forName("oracle.jdbc.. 더보기
[Day28][Java] HashMap / HashSet / LinkedHashSet / properties / Eclipse와 sqldeveloper 연결(JDBC) / Sequence HashMap에서 모든 회원 정보 조회 두 번째 방법 HashMapTest while(it.hasNext()) { String key = it.next(); System.out.println(key); } -- hasNext() : it에서 현재 it가 가지고 있는 여러 String 데이터 중 하나를 끄집어내서 존재하는지를 알아보는 것이다. 만약 존재하면 true, 존재하지 않으면 false이다. -- next() : 실제로 키값인 String 값을 끄집어낸다. -- 한 번 실행할 때 it에서 다 끄집어내서 key에 저장했기 때문에 it에는 더이상 남아있지 않게 되고, 다시 한 번 실행을 하게 되면 아무것도 출력되지 않는다. HashMapTest Iterator it2 = keySets2.iterator.. 더보기
[Day27][Java] Collection / Generic / auto Boxing / auto unBoxing / ArrayList / LinkedList / HashMap Ⅰ. Collection -- Package(my.day16.collection)와 Class(ListTest)를 생성 ▷ 배열(Array)과 자료구조(Collection)의 차이점? -- 배열(Array)은 오로지 동일한 데이터 타입만 들어가는 저장소이다. 배열(Array)은 그 크기가 한번 정해지면 크기를 변경할 수 없다. -- 자료구조(Collection)은 동일한 타입의 객체가 아니더라도 객체타입이기만 하면 모두 들어가는 저장소이다. 자료구조(Collection)은 저장되는 크기가 자동적으로 늘어난다. ListTest Vector vt = new Vector(5, 3); -- 초기용량이 5이고 객체가 더 들어오면 용량은 3만큼씩 증가한다. ListTest System.out.println("벡터 .. 더보기
[Day26][Oracle] Multi Table JOIN / NON-EQUI JOIN / SELF JOIN / Stored VIEW Ⅰ. Multi Table JOIN(다중 테이블 조인) -- 3개 이상의 테이블(뷰)을 가지고 조인 시켜 주는 것이다. 부서번호, 부서명, 국가명, 부서주소, 사원번호, 사원명, 기본급여를 나타내 보세요. 부서번호 : departments.department_id (P.K), employees.department_id (F.K) 부서명 : departments 국가명 : countries 부서주소 : locations 사원번호, 사원명, 기본급여 : employees HR select * from departments; HR select * from locations; -- departments.location_id (F.K)와 locations.location_id (P.K)를 연결고리로 사용한다. H.. 더보기
[Day25] [Oracle] SET Operator / UNION / UNION ALL / INTERSECT/ MINUS / JOIN Ⅰ. SET Operator(SET 연산자) A = { a, x, b, e, g } B = { c, d, a, b, y, k, m} 1. UNION -- 합집합 -- A ∪ B = { a, b, c, d, e, g, k, m, x, y } 2. UNION ALL -- { a, x, b, e, g, c, d, a, b, y, k, m} -- 속도는 빠르지만 중복이 있고 정렬되지 않는다. 3. INTERSECT -- 교집합 -- A ∩ B = { a, b } 4. MINUS -- 차집합 -- A - B { x, e, g } -- B - A { c, d, y, k, m} ▷ UNION -- UNION은 서로 다른 테이블(뷰)의 행(ROW)과 행(ROW)을 합칠 때 사용하는 연산자이다. HR insert int.. 더보기
[Day24][Oracle] cube / grouping sets / truncate / 누적 / SUB Query / Sub Query 를 사용하여 테이블 복사 / Pairwise Query(쌍 서브쿼리) 1. cube HR select department_id, count(*) from employees group by rollup(department_id); select decode(grouping(department_id), 0, nvl(to_char(department_id), '인턴') , '전체') AS 부서번호 , decode(grouping(GENDER), 0, GENDER , '전체') AS 성별 , count(*) AS 인원수 , round(count(*)/(select count(*) from employees)*100, 1) AS "퍼센티지(%)" from ( select department_id , case when substr(jubun, 7, 1) in ('1', '3') the.. 더보기
[Day23][Oracle] 그룹함수(집계함수) / group by / having 절 / rollup / grouping Ⅰ. 그룹함수(집계함수) 1. sum : 합계 2. avg : 평균 3. max : 최대값 4. min : 최소값 5. count : select 되어서 나온 결과물의 행의 개수 6. variance : 분산 -- 분산의 제곱근이 표준편차이다. (평균에서 떨어진 정도) 7. stddev : 표준편차 -- 표준편차의 제곱승이 분산이다. (평균과의 차액) HR select salary, sum(salary) from employees; -- salary 값은 107개, sum 값은 1개이기 때문에 테이블 모양이 다르므로 오류 발생 HR select sum(salary), avg(salary), max(salary), min(salary), count(salary) from employees; HR selec.. 더보기