(학) (공) (디)11 02.05(10일차) DB를 자바와 연동해보았다. 2024. 2. 6. 01.31(9일차) -자바연동해서 데이터구축 import java.sql.*; import java.util.*; public class DB { static Connection conn = null; static Statement stmt = null; static ResultSet rs = null; static String URL = "jdbc:mysql://localhost:3306/koreaitacademy"; public static void loadConnect() { try { if(stmt != null) stmt.close(); if(conn != null) conn.close(); }catch(Exception e) { System.out.println("오류 : "+e); } try { conn = DriverManager.g.. 2024. 2. 5. 01.29(8일) show databases; use union_sample; show tables; # 차집합 -> 테이블 간의 교집합(inner join)을 제외하고 기준이 되는 테이블에 있는 데이터(레코드)만 보이게 하는 것 # 서브쿼리를 이용한 방식 select str from a where str not in( select distinct str from b); # 조인을 이용한 방식 select a.str from a left join b on a.str = b.str where b.str is null; # 첫 번째 실습 # 1 select no from tableA where no not in( select distinct no from tableB); # 2 select id from tableA wher.. 2024. 1. 30. 01.27(7일차) select (select 1); use world; # 단일행 서브쿼리 -> 서브쿼리의 결과가 1개 select name, headofstate from country where code = (select code from country where name = 'Sweden'); # 다중행 서브쿼리 -> 서브쿼리의 결과가 여러개 select name, headofstate from country where name in (select name from country where name like('S%')); select * from city where countrycode = ( select countrycode from city where name = 'seoul'); # 첫 번째 실습 # 1 sel.. 2024. 1. 27. 이전 1 2 3 다음