자식, 부모 노드 탐색 javascript에서는 자식이나 부모 노드를 탐색하는 프로퍼티를 제공한다.childNodes- 자식노드를 탐색. NodeList객체를 결과로 반환 - 요소노드, 텍스트노드 둘다 탐색firstChild- 첫번째 자식을 탐색- 요소노드, 텍스트노드 둘다 탐색 lastChild- 마지막 자식을 탐색- 요소노드, 텍스트노드 둘다 탐색children- 자식노드를 탐색. HTMLCollection객체를 결과로 반환- 요소노드만 탐색firstElementChild- 첫번째 자식 요소노드 반환lastElementChild- 마지막 자식 요소노드 반환parentNode- 자기 바로 위의 부모 요소노드를 탐색. childNodes 결과 : 0:text, 1:ul, 2:text, 3:div, ..
노드에 대하여.. Document Object Model(문서객체모델)은 HTML페이지에서 문서의 구조를 나타내며 이를 조작 및 제어할 수 있는 방법을 제시한다. 일반적인 HTML태그이며, DOM에서는 이것을 노드라고 한다.노드에는 다음 4개가 있다. document - 최상위(root) 노드. - 최상위 이기 때문에 아래 3가지 요소,속성,텍스트 노드에 접근하기 위해서는 document노드를 통하여야 한다. div, ul, li - 요소 노드. - 부모 노드와 자식노드를 가질 수 있다. first, second - 애트리뷰트(속성) 노드.- 부모노드를 가질 수 없다.- 이 노드에 접근하려면 해당 노드의 요소노드에 접근 필요 javascript, React.js, Vue.js..
GROUP BY 절에서 사용하며 소계 및 총계 결과를 보여주는 함수 -사용방법 ROLLUP(A) ROLLUP(A,B,....) [CLOTHES_ORDER (주문 테이블)] HTML 삽입 미리보기할 수 없는 소스 - ROLLUP(A) 일 경우 HTML 삽입 미리보기할 수 없는 소스 위와 같이 ROLLUP(A)처럼 매개변수가 하나라면 A컬럼의 값이 그룹핑 된 결과가 주르륵 나오고 마지막에 총계가 나온다. - ROLLUP(A, B) 일 경우 HTML 삽입 미리보기할 수 없는 소스 - ROLLUP(A, B, C) 일 경우 HTML 삽입 미리보기할 수 없는 소스 - ROLLUP( (A, B) ) 일 경우 (함수 안에 괄호) HTML 삽입 미리보기할 수 없는 소스 ROLLUP( (A, B, C) ) 3개의 인자가 ..
ROLLUP 이 한방향으로 그룹화를 했다면CUBE 는 양방향 그룹화를 해서 소계 총계를 낸다. ROLLUP(A,B,C) 이A,B,CA,BA총계순으로 데이터 그룹화를 해서 소계 및 총계를 보여준다면... CUBE(A,B,C) 는A,B,CA,BA,CAB,CBC총계와 같은 결과를 보여준다. 전 양쪽 방향으로 그룹해서 소계총계를 보여준다고 생각하면 된다. - CUBE(A) /* * CUBE의 인자가 하나일 때는 ROLLUP이 인자가 하나일 때와 같은 결과가 나온다. */SELECT TO_CHAR(CO_DATE, 'mm/dd'),count(*) FROM CLOTHES_ORDERGROUP BY CUBE(CO_DATE)TO_CHAR(CO_DATE,'MM/DD')COUNT(*) 1002/27402/2830..
리눅스에서 디렉터리를 생성하는 mkdir 명령을 이용해 collections라는 디렉터리를 만들고 vi 명령으로 test1.txt 파일을 만들었다. ls 명령을 이용해서 목록을 출력해보면 다음과 같이 나타나는데 drwxr-xr-x 2 newUser newUser 4096 Nov 23 23:21 collections -rw-r--r-- 1 newUser newUser 0 Nov 23 23:22 test1.txt 행에 나열된 목록 표시들을 하나씩 알아본다면 drwxr-xr-x 2 newUser newUser 4096 Nov 23 23:21 collections 파일 또는 디렉토리 허가권 링크된 수 소유중 사용자 소유중 그룹 용량 날짜 파일 또는 디렉토리명 허가권의 제일 앞자리에 있는 문자는 파일인지 디렉토리..
○ 유저 추가 명령어 useradd [옵션] 유저명 옵션 설명 -d 홈 디렉토리 지정시 사용 -g 그룹 지정. 지정할 그룹이 생성되어 있어야 됨 -G 기본그룹 외에 추가로 그룹에 포함시킬 경우 사용 -c 유저에 대한 설명 지정 -s 유저가 사용할 쉘을 지정 시스템의 사용자(유저)를 확인하려면 /etc/passwd 파일을 열어보면 된다. - /etc/passwd 파일의 한 부분 # newUser:x:1001:1001::/home/newUser:/bin/bash newUser라는 사용자를 생성했더니 위와 같은 라인이 추가되어 있다. 순서대로 아이디:패스워드:유저아이디(uid):그룹아이디(gid):설명:홈디렉토리:쉘 을 나타내며 유저 생성시 -c를 이용해 설명을 적지 않아서(필요가 없으니) 빈칸으로 되어 있다..
user 생성 create user '아이디'@'localhost' identified by '비밀번호'; user 권한 부여 grant select, insert, update, delete, create, drop, alter on 지정DB이름.*to '아이디'@'localhost'; all privileges : 모든 권한 / *.* : 모든DB / with grant option : 권한위임가능 예: grant all privileges on *.* to 'project'@'%' with grant option; user 권한 보기 show grants for '아이디'@'localhost(또는%)'; 권한 적용하기 flush privileges; 모든 user 보기 use mysql; selec..
프로시저는 프로그램의 함수와 같은 개념으로 SQL명령어의 조합으로 새로운 함수를 만들어 저장 해 놓고 사용하는 것이다. > 삭제 DROP PROCEDURE IF EXISTS INSERT_BOARD; //프로시저를 생성하기 전에 INSERT_BOARD라는 프로시저가 있으면 삭제한다. > 생성 CREATE PROCEDURE INSERT_BOARD(PREGION INT(11), PWRITER VARCHAR(30), PTITLE VARCHAR(200)) BEGIN INSERT INTO BOARD(REGION, WRITER, TITLE) VALUES (PREGION,PWRITER,PTITLE); END; //보라색의 PREGION, PWRITER 등의 변수는 외부에서 함수를 호출할 때 넣어줄 인자의 타입을 결정 ..
웹서핑을 하다가 게시판 글이 과거는(어제기준) 날짜로 표기되고 금일은 시간으로 데이터가 표시되는 것을 보고 현재 공부하면서 만들고 있는 게시판의 쿼리를 바꿔보았다. (물론 뇌입원님의 은총을 받아서..) 기존에는 그냥 무책임하게 (년도 일자 오전오후 시간) 다 보여주는 형태였는데 이렇게 바꿔주니 한결 나아보인다. 애초에 화면 레이아웃이 엉망인지라(CSS를 잘몰라서 이곳저곳 오픈소스를 막 적용하다보니....) 다른 사람이 본다면 거기서 거기라고 느낄 것 같다... MYSQL에서 날짜 형식바꾸기 DATE_FORMAT(DATE,'형식문자'); //이렇게 하면된다. 아래는 형식문자에 들어갈 수 있는 문자들의 표이다. select NO, CASE WHEN DATE_FORMAT(REG_DATE,'%y.%m.%d') ..
무결성 제약조건은 데이터베이스 내의 데이터의 정확성을 유지하면서 바람직하지 않은 데이터가 저장되는 것을 방지하는 것을 말합니다. NOT NULL 제약 조건 - NULL값이 들어가며 안되는 칼럼에 설정합니다. UNIQUE 제약 조건 - 이 제약 조건은 유일하게 구분해야 하는 칼럼에 적용합니다. - NULL 데이터가 삽입되는 것을 허용합니다. PRIMARY KEY 제약 조건 - 이 제약 조건은 유일하게 구분해야 하는 칼럼에 적용합니다. - NULL 데이터가 삽입되는 것을 불허합니다. FORIGHT
인덱스란? 인덱스란 SQL 조회의 처리 속도 향상을 위해 칼럼에 생성하는 객체 새로운 인덱스 생성하기 CREATE INDEX 인덱스명 ON 테이블이름(칼럼명); 테이블의 인덱스 확인하기 SHOW INDEX FROM 테이블이름; 인덱스 제거 DROP INDEX 인덱스명; 인덱스를 무조건 사용한다고 해서 검색속도가 빨라지는 것은 아니다. 맹목적인 인덱스 지정시 성능 저하의 요인이 될 수 있다.(보통 한 테이블에 4~5개 이상의 인덱스를 지정하는건 권장하는 방법이 아니다) 인덱스를 사용해야 할 경우 - 테이블 행의 수가 많을 때 - 검색 결과가 전체 데이터의 5%이내 일때 - 컬럼에 대하여 변경보다 검색이 잦을 때 - WHERE문에 해당 컬럼이 많이 사용 될 때 - 컬럼값이 다양한 값을 지녔을 때 인덱스를 사..
테이블의 구조를 변경하는 ALTER문 ADD : 테이블에 칼럼을 추가합니다. MODIFY : 테이블의 칼럼 속성을 변경합니다. DROP : 테이블의 해당 칼럼을 삭제합니다. 형식 ALTER TABLE 테이블이름 ADD (칼럼이름,데이터타입,....); 사용 예 ALTER TABLE MEMBER MODIFY (NAME VACHAR(20)); //칼럼의 데이터 크기를 변경한다. ALTER TABLE MEMBER DROP COLUMN NAME; //테이블의 칼럼을 지운다. 테이블을 삭제하는 DROP문 사용 예 DROP TABLE MEMBER; //MEMBER라는 테이블을 지운다. 테이블의 모든 레코드를 삭제하는 TRUNCATE문 사용 예 TRUNCATE TABLE MEMBER; //MEMBER라는 테이블을
뷰는 가상테이블 이다. 하나의 테이블이라곤 말할 순 없고, 일단 뷰를 생성해두고 필요 시 호출하게 되면 뷰에 있는 쿼리가 내부적으로 실행되고 데이터를 가져오게 된다. 뷰를 왜 사용하는가? - SQL문의 재사용과 복잡한 쿼리문 작업을 단순화 시키려고. - 테이블 검색의 전체결과가 아닌 일부만 보거나 활용하려고. - 다른 사용자로부터 데이터를 보호하려고. 뷰는 자체적으로 아무런 데이터를 포함하지 않는다. 그냥 다른 테이블들에서 데이터를 가져와 볼 수 있도록 해줄 뿐. 그렇기 때문에 뷰 가상테이블을 보려고 할 때마다 그에 따른 쿼리를 실행하기 때문에 여러 조인문이나 뷰를 중첩하여 사용한 경우 제대로 튜닝하지 않으면 성능이 저하될 우려가 있음. 뷰의 규칙 - 뷰의 명칭은 테이블과 마찬가지로 고유해야함. - 만들..
TINYINT 부호있는 수는 -128에서 127까지, 부호 없는 수는 0에서 255까지 표현할 수 있다. 1 바이트 ※디폴트는 부호있는거(SIGNED), UNSIGNED를 붙이면 부호없는것~ SMALLINT 부호있는 수는 -32768에서 32767까지, 부호 없는 수는 0에서 65535까지 표현할 수 있다. 2 바이트 ※디폴트는 부호있는거(SIGNED), UNSIGNED를 붙이면 부호없는것~ MEDIUMINT 부호있는 수는 -8388608부터 8388607까지, 부호없는 수는 0에서 16777215까지의 수를 표현할 수 있다. 3 바이트 ※디폴트는 부호있는거(SIGNED), UNSIGNED를 붙이면 부호없는것~ INT [unsigned] 부호있는 수는 -2147483648부터 2147483647까지, 부..