728x90
728x90
- cross join // 거의 안씀 select sawon_name, buser_name from sawon, buser; select sawon_name,buser_name from sawon cross join buser; -- ANSI SQL 표준 - inner join 양쪽 테이블 모두에 자료가 있는 경우에만 출력 select * from buser; insert into buser values(50,'축구부', '파주','031-234-5678'); - 축구부 삽입 select * from sawon; alter table sawon modify buser_num number(4) null; -- 부서 번호 4를 null..
-- ( ) > 산술 ( *, / > + , - ), 관계연산자 > 논리 > is null, like, int > bet -- between > not >> and > or - 문자함수 (select) select lower('Hello'), upper('Hello') from dual; -- 대소문자로 변경 select initcap('hello world') from dual; - 첫글자 대문자 select concat ('Hello', 'world') from dual; -- 2개 붙이기 select substr('Hello world', 3) from dual; -- He 삭제 select substr('Hello world..
같은 타입의 여러 변수를 하나의 묶음으로 다루는 것을 '배열'이라고 한다. 많은 양의 데이터를 저장하기 위해 그 데이터의 숫자만큼 변수를 선언해야 한다면 매우 불편하기 때문인다. 타입 뒤에 붙이는 방법이 있고 변수 이름 뒤에 붙이는 방법이 있다. 1) 타입[] 변수 이름: int[ ] score : String[] name; 2) 타입 변수이름[ ]; int score[ ]; String name[ ]; 배열을 선언한 다음에는 배열을 생성해야 됨. 1) 형태 타입[ ] 변수이름; // 배열을 선언(배열을 다루기 위한 참조변수 선언) int[ ] score = new int[5] // int 타입의 값 5개를 저장할 수 있는 배열 2) 선언과 생성..
-- select [distinct] db명. 소유자명. 테이블명.칼럼명 [as 별명] -- [into 테이블명] from 테이블명... -- where 조건... order by 기준키 [asc / desc] select * from buser; select * from sawon; alter session set nls_date_format='YYYY-MM-DD'; select sawon_no,sawon_name,sawon_pay from sawon; select sawon_pay,sawon_no,sawon_name from sawon; select sawon_no as 사번, sawon_name as 직원명, sawon_pay 연봉 from s..
create table 테이블명(칼럼명 int primary key, 칼럼명 varchar2(10)); create sequence my_seq increment by 1 start with 0 minvalue 0 maxvalue 1000; insert into aa values(my_seq.nextval,'이기자'); insert into aa values(my_seq.nextval,'이기자'); create table bb(code int primary key,name varchar2(10)); insert into bb values(my_seq.nextval, '김..
조건문 - if, switch 조건문은 조건식과 문장을 포함하는 블럭{}으로 구성되어 있으며, 조건식의 연산결과에 따라서 실행할 문장이 달라져서 프로그램 실행의 흐름을 변경할 수 있다. 아래 파일을 받으면 아래의 텍스트를 txt로 바꾼 것을 볼 수 있다. 가장 기본적인 조건문이며 조건식과 괄호 { } 로 이뤄져 있다. if의 조건식이 만일 참(true)라면 괄호 { } 안의 문장을 수행하라는 의미다. scrore = 80; if (score > 60 ) { System.out.println("합격입니다"); } if-else는 if 구문에 else가 추가된 것으로 if의 조건이 false의 경우 else의 조건을 수행하라는 의미다. if (input==0) { Sy..
select * from 테이블 명 DML(조작) : insert, update, delete, select DCL(제어) : grant, deny DDL(생성) : create, alter, drop ... 형식 : create table 테이블명(칼럼명) 자료형 : varchar2, char, number, date, timestamp, clob, blob.... create table test(no number, name varchar2(10)); describe test; select * from tab; create table test(no number primary key, -- 중복을 허용하지 않음, 동일한 자료를 입력..
연산자는 연산을 수행하는 기호로서 수학을 생각해보자 +는 덧셈, -는 뺄셈 등이 있다. JAVA 역시 다양한 종류의 연산자가 있지만 사칙연산부터 시작해서 익숙해지다 보면 별 어려움이 없을 것이다. 수학 문제를 풀려면 덧셈이나 뺄셈이 필요한 것처럼 JAVA 역시 연산자와 피연산자가 있다. 연산자 : 연산을 수행하는 기호 ( +, - , / , * 등) 피연산자 : 연산의 대상 (변수,상수,리터럴,수식 등) 예시 코드를 들면 아래와 같다. x = 5; x * 5 - 3; // 곱셈, 나눗셈을 우선 처리하기 때문에 사실상 (5 * 5) -3가 된다. 22; 문제는 저렇게 하면 결과 값이 그 어디에도 저장되지 않는다. x는 단지 계산식에 사용되었을 뿐이다. 그래서 제대로..