태그          특정 태그 모두 가져오기 

태그.class    특정 태그내의 특정 클래스 가져오기 

태그#id       특정 태그내의 특정 id 가져오기

 요소1 요소2 모든 자손 요소 가져오기 

 요소1 > 요소2  바로 아래 나오는 자식 요소 

 요소[특성]     attribute가 있는 요소 가져오기 

 요소[특성=값]  속성과 값이 일치하는 요소 

 요소[특성*=값] ~가 들어가는 

 요소[특성$=값] ~로 끝나는 

 요소[특성^=값] ~로 시작하는 

 요소[특성1=값1][특성2=값2] 2개의 특성과 값을 모두 만족하는 요소  

 요소:nth-child(n) 부모 요소를 기준으로 n번째 위치한 요소 

 요소:first-child 부모 요소를 기준으로 첫번째 자식 요소 

 요소:last-child 부모 요소를 기준으로 마지막 자식 요소 

 요소:only-child 부모 요소를 기준으로 자식 요소가 딱 하나인 요소 

 요소:empty 부모 요소를 기준으로 자식을 갖지 않는 요소 

 요소:not(Selector) 다른 선택기를 제외한 요소 

 

:first   첫번째 요소 

:last     마지막 요소 

:even   짝수번째 요소(n-1번째, 0번째부터 시작, 즉 0번째가 짝수) 

:odd   홀수번째 요소 

:nth(n)  n번째 요소 

:eq(index)   주어진 인덱스에 해당하는 요소 

:gt(index)   주어진 인덱스보다 큰 요소 

:lt(index)   주어진 인덱스보다 작은 요소 

:visible  CSS 속성의 display가 none이 아닌 요소 

:hidden  CSS 속성의 display가 none인 요소 

:parent  부모 요소 

:contains(‘Text’)  Text를 포함하는 요소

 

● bind() =>  DOM 요소에 특정 이벤트를 연결(바인딩) 

  unbind()로 이벤트 처리기 제거 가능

● this =>  이벤트 핸들러에서의 this는 DOM을 가리킴 

● $(this) =>  현재 이벤트가 적용된 개체(DOM)를 jQuery 개체로 반환 

● this.id =>  DOM 개체 중 클릭된 요소를 알고자할 때에는 id 속성 사용

● click() 메서드 -  해당 요소에 click 이벤트를 적용

● filter(‘선택기’) =>  선택기에 매치되는 jQuery 집합을 읽어옴 

    end() =>  filter() 적용 전의 상태로 이동하고자할 때 

● toggle(fn1, fn2, fn3, ...)  =>  토글시 필요한 익명 메서드를 n개까지 지정 

● toggleClass(‘CSS클래스’)  =>  CSS 클래스에 대한 토글링 지원 

● addClass()와 removeClass()를 반복 

● hover( mouseover, mouseout ) 

      =>  마우스 오버시와 아웃시에 필요한 기능을 한 개 메서 드로 제공 

● css(key, value) => key : 스타일시트 속성명 ? value : 스타일시트 속성값

 

● 노드 반복 : .each() 

 .each(function(index, 요소))  => jQuery 개체를 반복 탐색

 

 /////////////////////////////////////////////////////////////////////

 ● Form 관련 jQuery 선택기 

 :input   input만 가져오는게 아닌 모든 폼 요소를 검색  input, textarea, select/option  

 :text   <input type=“text” />인 요소 검색    

 :password   <input type=“password” />인 요소 검색    

 :radio   <input type=“radio” />인 요소 검색    

 :checkbox   <input type=“checkbox” />인 요소 검색    

 :submit   <input type=“submit” />인 요소 검색    

 :image   <input type=“image” />인 요소 검색    

 :reset   <input type=“reset” />인 요소 검색    

 :button   <input type=“button” />인 요소 검색    

 :file   <input type=“file” />인 요소 검색   

 :enabled   disabled 속성이 없는 요소 검색  

 :disabled   disabled 속성이 있는 요소 검색  

 :checked   checked 속성이 있는(체크된) 요소 검색  

 :selected   selected 속성이 있는(선택된) 요소 검색

 

  /////////////////////////////////////////////////////////////////////

 

 ● 태그의 속성(Attributes) 접근 : attr() 

    특정 요소의 모양을 변경하려면 해당 요소의 속 성(Attributes)을 변경하면 됨 

  jQuery는 attr() 메서드를 제공함 

   - 매개변수로 제공되는 속성을 읽기 또는 변경 

 

● 태그의 속성(Attributes) 접근 : CSS 

   jQuery는 CSS를 쉽게 적용 또는 삭제할 수 있는 메서드를 제공 

   addClass(), removeClass(), toggleClass() 그리고 hasClass() 

   hasClass() : 특정 class 속성을 가지고 있으면 진행 

   각각의 CSS 요소를 변경할 수 있는 막강 메서드 인 css() 제공

 

● html() - 요소의 HTML을 읽어(get)온다.  

● html(val)   - 요소에 HTML을 설정(set)한다. 

● text() - 일치하는 모든 요소의 텍스트를 붙여서 읽어(get)온다. 

● text(val)   - 요소에 텍스트를 설정(set)한다

 

/////////////////////////////////////////////////////////////////////

 

eq(index)   n번째 인덱스의 요소를 가져옴 

is(“ ”)   지정된 선택기와 맞는 요소 검색 

not(“ ”)   지정된 선택기와 맞는 요소를 제외한 나머지 검색 

end()   현재 실행된 상태의 이전으로 되돌림 

map(callback)   jQuery 개체를 다른 jQuery array로 변경 

append("jquery객체”)  요소의 안에 내용 추가 

insertAfter(“”)   검색된 요소의 뒤에 추가 

wrap(“내용”)   요소를 감싸서 추가 

clone()   요소를 복사 

before(“”)   요소의 앞에 내용 추가 

insertBefore(“”)  검색된 요소의 앞에 추가 

append(“”)   요소의 안에 내용 추가

appendTo(“”)   검색된 요소의 안에 내용 추가 

empty()   DOM내의 모든 요소를 제거/자식 노드 제거 

remove()   DOM에서 요소를 제거 

find()   특정 요소를 찾기  

next([selector])   DOM의 다음 형제 노드를 반환 

prev([selector])   DOM의 이전 형제 노드를 반환 

 

/////////////////////////////////////////////////////////////////////

 

show()  요소 보이기 

show(speed, callback)  요소 보이기(스피드와 콜백함수 지정 가능) 

hide()  요소 숨기기 

hide(speed, callback)  요소 숨기기(스피드와 콜백함수 지정 가능) 

toggle()  토글링(이랬다~ 저랬다) 

toggle(speed, callback)  토글링(스피드와 콜백함수 지정 가능) 

fadeIn(speed, callback)  서서히 나타나기 

fadeOut(speed, callback)  서서히 없어지기 

slideDown(speed, callback)  위에서 아래로 슬라이드 다운됨(보여짐) 

slideUp(speed, callback)  아래서 위로 슬라이드 업됨(사라짐) 

slideToggle(speed, callback)  슬라이드 업/다운에 대한 토글링 

animate()  여러개의 애니메이션 효과를 동시 부여 

stop()  현재 진행중인 애니메이션 효과를 멈춤

'자바스크립트 > jquery' 카테고리의 다른 글

(펌) jquery 사용법  (0) 2015.11.30

select 문  = 데이터 검색

 

select [ALL(*) / distinct] // 원하는 컬럼명(열이름),...  // distinct => 중복제거

from 테이블이름

[where 조건]

[group by {컬럼,,,,}]

[having 조건]

[order by {컬럼,,,,,}[asc(오름), desc(내림)]]

 

1. select * from employees; : employees 테이블에서 전체 컬럼을 보여달라 (테이블 전체내용보기)

2. select 필드명, 필드명, 필드명 from 테이블이름 ; 해당 필드명의 자료만 검색

  

 ** 필드명의 자료가  Number, 날짜 인 경우는 연산이 가능하다 

3. select employee_id, first_name, job_id, salary, salary*12 from employees;

 

 ** 필드명을 별칭으로 사용 수 있다. (단, 진짜변경되는 것은 아님)

 ** 별칭 사용법 ( 1. 필드명 as 별칭,  2. 필드명 별칭)

4. select employee_id, first_name, job_id, salary as 급여, salary*12 연봉 from employees;

 

5. select 필드명,,,,, from 테이블명 where 조건절

  => 조건은 대소문자 구별한다. 문자열과 날짜는 반드시 홑따옴표 한다.

  => 조건절의 구성(where 필드명 연산자 조건 )

 select employee_id, first_name, job_id, salary from employees where salary >= 10000 ;

 select employee_id, first_name, job_id, salary, job_id from employees where job_id = 'IT_PROG' ;

 

   and 조건 : (필드명 연산자 조건 and 필드명 연산자 조건)

               주어진 조건을 모두 만족하는 필드만 검색

              ~부터 ~ 까지의 범위를 포함하는 검색 (where 필드명 between 조건 and 조건)

 

select employee_id, first_name, job_id, salary from employees 

where job_id = 'IT_PROG' and salary >=5000 

select employee_id, first_name, job_id, salary from employees 

where employee_id >=150 and employee_id<=180 ;

select employee_id, first_name, job_id, salary from employees 

where employee_id >=100 and employee_id<=180 and job_id ='IT_PROG';

select employee_id, first_name, job_id, salary, hire_date from employees 

where hire_date >= '89/01/01' and hire_date <= '89/12/31';

select employee_id, first_name, job_id, salary, hire_date from employees 

where hire_date  between '89/01/01' and '89/12/31';

select employee_id, first_name, job_id, salary from employees 

where job_id = 'IT_PROG' or salary >=5000 

 

 or 조건 : (필드명 연산자 조건 or 필드명 연산자 조건)

             주어진 조건들 중 하나라도 만족하는 것이 있으면 모두 검색

   (in 연산자 : 같은 필드에서 or 연산자를 사용할 경우 사용) 

      => in  연산자 형식 : where 필드명 in(조건, 조건....)

select employee_id, first_name, job_id, salary from employees

where job_id = 'IT_PROG' or job_id = 'AD_VP' or job_id = 'FI_ACCOUNT' ;

select employee_id, first_name, job_id, salary from employees 

where job_id  in('IT_PROG','AD_VP','FI_ACCOUNT') ;

 

  ** distinct => 중복제거 

 select distinct 필드명 from 테이블이름 , => O (해당필드의 중복제거 됨)

 select distinct 필드명, 필드명 from 테이블이름 => X (중복제거 안됨), 

 select distinct job_id from employees;

 

  ** like 연산자 : 정확하지 않은 데이터를 찾을 때 

     % : 모든(*) , _ : 어떤 한 글자 ( 전체 글자수까지 맞춰어야 한다.) 

  select employee_id, first_name, job_id, salary from employees where first_name like 'J%'; (시작)

  select employee_id, first_name, job_id, salary,hire_date from employees where hire_date like '89%';

  select employee_id, first_name, job_id, salary from employees where first_name like '%i%'; (포함)

  select employee_id, first_name, job_id, salary from employees where first_name like 'J____';

 

  ** is null 과 in not null

   select *  from employees where COMMISSION_PCT = null => 데이터 못 찾음

   select *  from employees where COMMISSION_PCT is null => 데이터가 null인 경우 찾기

   select *  from employees where COMMISSION_PCT is not null => 데이터가 null인 아닌 경우

 

  정렬 : null => 오름차순일경우 맨 마지막, 내림차순일 경우 맨 처음

  select * from employees order by salary => 오름

  select * from employees order by salary asc => 오름

  select * from employees order by salary desc => 내림

 

////////////////////////////////////////////////////////////////////////////////////////////////////

 

dual : 오라클 가상 테이블

sysdate : 시스템의 오늘 날짜

 

숫자함수

 

ABS : 절대값  예) select 10 , -10 , abs(-10) from dual

 

FLOOR : 소수점 아래 버림

        예) select 34.6789, 34.4798, 34.5789,floor(34.6789), floor(34.4798), floor(34.5789) from dual 

 

ROUND : 반올림 (숫자) => 소숫점 첫째자리에서 반올림

        반올림 (숫자, 자릿수) : 

       select round(34.6489,1),round(34.6598,1) from dual // 소숫점 첫째자리까지구함 34.6 // 34.7

       select round(134.6489,-1),round(135.6498,-1) from dual // 130 // 140

 

TRUNC : 버림(숫자, 자릿수)

       select TRUNC(34.6489,1),TRUNC(34.6598,1) from dual // 소숫점 첫째자리까지구함 34.6 // 34.6

       select TRUNC(134.6489,-1),TRUNC(135.6498,-1) from dual // 130 // 130

 

MOD : 나머지 구하기

       SELECT MOD(27,2), MOD(27,5), MOD(27,7) FROM DUAL

       select * from employees where mod(employee_id,2) = 1 ; // 사원번호가 홀수인 사람구하기

 

////////////////////////////////////////////////////////////////////////////////////////////////////

 

날짜 함수

 

sysdate : 시스템 오늘 날짜 , 연산가능

select sysdate, sysdate+100 from dual

 

months_between : 두날짜 사이의 개월 수 구하기

select months_between(sysdate,'96/06/26')/12 from dual

select floor( months_between(sysdate,'96/06/26')/12) from dual

select trunc( months_between(sysdate,'96/06/26')/12) from dual

 

next_day : 해당 요일의 가장 가까운 날짜를 반환(지나간 요일을 찾지는 않음)

next_day(날짜, 요일) : 요일 => 일요일 = 1

select next_day(sysdate,'일요일'),next_day(sysdate,1),next_day('14/08/18',1) from dual

 

last_day : 해당 월의 마지막 날짜 반환

          select last_day(sysdate) from dual 

////////////////////////////////////////////////////////////////////////////////////////////////////

 형변환 함수

  

  NVL : null 값을 다른 값으로 변환 시킴

  NVL(널값, 변환시킬값) 

   select  COMMISSION_PCT, NVL(COMMISSION_PCT,0) from employees

간단한 프로젝트 하나가 끝났다. 처음에는 전자정부기반에서 자바로 작업할줄 알았는데 디자인이 완성되있는 오픈소스를 가져다가 쓰신다고해서 PHP로 작업했다. 거의 완성되있는 오픈소스라 간단하게만 수정하고 한글화 작업후에 인수인계할 예정이다. 

 프로젝트 예상기간은 1달반정도 됬는데 예상보다 일찍 끝나서 현재는 방송통신대 공부를 하고있다 이번에는 학점좀 재대로 받아야되는데.... 생각보다 자주공부하기가 힘들다. 회사에서 작업할일이 많이 생기면 그거대로 그거공부도 해야하고 대학공부도 해야하는데 여기서 개인프로젝트나 스터디를 할 여력이없는거같다.... 물론 하라고하면 할 수는 있지만 여기서 스터디를하면 내시간이 과연 있을까싶기도하다.

'일상' 카테고리의 다른 글

최근근황  (0) 2016.10.18
리뷰] Martin Fowler - Refactoring  (0) 2016.08.18
포트폴리오 제작시작!  (0) 2016.07.13
개발공부 진행상황  (0) 2016.06.21
워드프레스 프로젝트  (0) 2016.01.13

+ Recent posts