일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- 전자정부표준프레임워크
- String Functions and Operators
- MySQL
- Data and Time Functions
- Date and Time Function
- 오라클
- Sring Functions and Operators
- String Function and Operators
- 방화벽
- Tibero
- HTTP
- 윈도우
- SVN
- 전자정부 표준프레임워크
- 티베로
- String Functions and Date Operators
- Oracle
- Date and Time Functions
- Today
- Total
목록D (178)
웹이야기
오라클 11g를 설치하고 예제쿼리를 실행하기 위해서는 hr 계정을 활성화시켜줘야 한다. hr 계정을 활성화시키는 방법은 아래와 같다. SQL> alter user hr account unlock ; 사용자가 변경되었습니다. SQL> alter user hr identified by hr123456 ; 사용자가 변경되었습니다. hr계정으로 로그인을 해서 아래와 같이 테이블 목록을 확인해볼 수 있다. SQL> SELECT * FROM TAB ORDER BY TNAME ASC ; COUNTRIES DEPARTMENTS EMPLOYEES EMP_DETAILS_VIEW JOBS JOB_HISTORY LOCATIONS REGIONS 와 같은 테이블이 존재한다. 동일한 방법으로 scott 계정도 활성화시킬 수 있다...
1. About SQL Operators Operators manipulate individual data item called operands or agruments. Operators are represented by special characters or by keywords. 2. Unary and Binary Operators 단항연산자, 이항연산자 The two general classes of operators are: unary : A unary operator operates on only one operand. A unary operator typically appers with its operand in this format: operator operand binary : A bina..
Flow Control Operators 제어 흐름 함수 ??? Name Description CASE CASE operator IF() If/else construct IFNULL() Null if/else construct NULLIF() Return NULL if expr1 =expr2 1) CASE CASE value WHEN [compare_value] THEN result [WHEN [compare_value] THEN result ...] [ELSE result] END CASE WHEN [condition] THEN result [WHEN [condition] THEN result ...] [ELSE result] END mysql> SELECT CASE 1 WHEN 1 THEN 'one'..
Assignment Operators 지정 연산자쯤 되겠지? Name Description := Assign a value = Assign a value(as part of a SET statement, or as part of the SET clause in an UPDATE statement) 1) := Assignment operator 흠.. 거의 사용을 안해봐서... 그냥 예제만 mysql> SELECT @var1 :=1 , @var2 ; +-----------+-------+ | @var1 :=1 | @var2 | +-----------+-------+ | 1 | NULL | +-----------+-------+ 1 row in set, 1 warning (0.01 sec) mysql> SE..
Logical Operators 논리연산자쯤 되겠지. Name Description AND, && Logical AND NOT, ! Legates value OR, || Logical OR XOR Logical XOR In SQL, all alogical operators evaluates to TRUE, FALSE, or NULL (UNKNOWN). In MySQL, these are implemented as 1(TRUE), 0(FALSE), and NULL. Most of this is common to different SQL database aserver, although some servers may return any nonzero value for TRUE. MySQL evaluates a..
Comparison Operators Name Description > Greater than operator >= Greater than or equal operator 0 mysql> SELECT '0' =0; --> 1 mysql> SELECT '0.0' =0; --> 1 mysql> SELECT '0.01' =0; --> 0 mysql> SELECT '.01' =0.01; --> 1 mysql> SELECT 'A' ='a'; --> 1 2. NULL-safe equal This operator performs an equality comparison like the = operator, but returns 1 rather than NULL if both operands are NULL. and ..
SET Operators 를 집합 연산자라고 하는 것 같다. 집합 연산자의 종류 1. UNION - All distinct rows selected by either query - 합집합, 결과값의 중복 제거 2. UNION ALL - All rows selected by either query, including duplicates - 합집합, 결과값의 중복 허용 3. INTERSECT - All distinct rows selected by both queries - 교집합, 결과값의 중복 제거 4. INTERSECT ALL - All rows selected by both queries including duplicates - 교집합, 결과값의 중복 허용 5. MINUS - All distinct ..
SQL Operator Precedence Operator Operation +, -(as unary operator), PRIOR, CONNECT_BY_ROOT, COLLATE Idetity, negation location in hierarchy *, / Multiplication, devision +, -(as binary operators), || Addition, substraction, concatenation SQL conditions are evaluated after SQL operators sql>SELECT 1+2*3 FROM DUAL ; --> 7
3개의 쿼리중에서 알아서 사용 ~~ select * from tab ; select * from all_tables where owner ='scott' ; select * from user_tables ;
auto_increment 값을 변경하는 쿼리 mysql> ALTER TABLE tbl_name AUTO_INCREMENT =100; mysql> create table test11 (idx int auto_increment primary key, content text) ; Query OK, 0 rows affected (0.08 sec) mysql> insert into test11 (content) values ('test'); Query OK, 1 row affected (0.00 sec) mysql> alter table test11 auto_increment=100; Query OK, 0 rows affected (0.02 sec) Records: 0 Duplicates: 0 Warnings:..
MySQL 에서 테이블의 인덱스를 보기 위한 구문 mysql> SHOW INDEX FROM tbl_name mysql> show index from COMTNSYSTEMCNTC ; +-----------------+------------+--------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+------------+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part |..
MySQL character-set 을 확인하는 방법이다. 한글이 잘 들어가기 위한 조건을 확인한다. 1. 한글이 잘 안들어가는 경우의 캐릭터 셋 mysql> show variables like '%char%'; +--------------------------+----------------------------------------+ | Variable_name | Value | +--------------------------+----------------------------------------+ | character_set_client | euckr | | character_set_connection | euckr | | character_set_database | latin1 | | chara..

이클립스 상에서 오라클을 연결하여 프로젝트를 진행하기 위해서는 JDBC driver 를 다운로드 받아서 라이브러리에 추가해줘야 하는데. 1. Oracle JDBC driver 다운로드 페이지로 이동 https://www.oracle.com/database/technologies/appdev/jdbc-downloads.html JDBC and UCP Downloads page No results found Your search did not match any results. We suggest you try the following to help find what you're looking for: Check the spelling of your keyword search. Use synonyms for ..
MySQL Regular Expression Syntax 1. ^ Match the beginning of a string mysql> SELECT REGEXP_LIKE('fo\nfo', '^fo$'); -> 0 mysql> SELECT REGEXP_LIKE('fofo', '^fo'); -> 1 2. $ Match the end of a string. mysql> SELECT REGEXP_LIKE('fo\no', '^fo\no$'); -> 1 mysql> SELECT REGEXP_LIKE('fo\no', '^fo$'); -> 0 3. . Match any character (including carriage return and newline, although to match these in the mid..
MySQL 8.0에서는 REGEXP_LIKE(), 그 이전버전에서는 REGEXP()로 이용할 수 있다. mysql>SELECT * FROM COMTCCMMNDETAILCODE WHERE REGEXP_LIKE(CODE, '^b') ; mysql>SELECT * FROM COMTCCMMNDETAILCODE WHERE code REGEXP '^b' ; 위 2개는 동일하다. REGEXP_LIKE(expr, pat[, match_type]) 와 같이 사용할 수 있다. match_type 으로는 c, i, m, n, u 를 사용할 수 있다. c : Case sensitive matching. i : Case-insensitive matching. 따로 명시하지 않으면 i가 기본으로 적용되는 듯하다. m : Mult..
MySQL5.7 에서는 아래와 같은 함수를 지원한다. NOT REGEXP : Negation of REGEXP REGEXP : Whether string matches regular expression RLIKE : Whether string matches regular expression 자세한 내용은 MySQL 홈페이지를 참조한다. https://dev.mysql.com/doc/refman/5.7/en/regexp.html MySQL :: MySQL 5.7 Reference Manual :: 12.7.2 Regular Expressions 12.7.2 Regular Expressions Table 12.13 Regular Expression Functions and Operators Name Desc..
1. _ - single character 2. % - 임의의 character(including zero character) 3. =, 를 사용하지 말고 LIKE, or NOT LIKE 를 사용 예제) mysql>SELECT CODE_ID, CODE, CODE_DC FROM COMTCCMMNDETAILCODE WHERE CODE LIKE '_M%'; - 정확히 6글자인 것만 검색(_를 6번 써준다) mysql>SELECT CODE_ID, CODE, CODE_DC FROM COMTCCMMNDETAILCODE WHERE CODE LIKE '______'; MySQL에서는 정규표현함수를 지원해서 위의 내용으로 되지 않는 것들을 처리할 수 있다.
MySQL에서 NULL에 관한 몇가지 1. NULL means "a missing unknown value" 2. 연산자로 IS NULL, IS NOT NULL을 사용한다. mysql> SELECT 1 IS NULL, 1 IS NOT NULL ; +-----------+---------------+ | 1 IS NULL | 1 IS NOT NULL | +-----------+---------------+ | 0 | 1 | +-----------+---------------+ 1 row in set (0.00 sec) 3. 산술연산자를 사용할 수 없다. =, , 같은 산술연산자를 사용할 수 없다. 산술연산자 arithmetic comparison operator 와의 비교는 항상 NULL 이기 때문에 사용..
1. MySQL 날짜 더하기 DATE_ADD() SELECT DATE_ADD(NOW(), INTERVAL 1 SECOND); SELECT DATE_ADD(NOW(), INTERVAL 1 MINUTE); SELECT DATE_ADD(NOW(), INTERVAL 1 HOUR); SELECT DATE_ADD(NOW(), INTERVAL 1 DAY); SELECT DATE_ADD(NOW(), INTERVAL 1 WEEK); SELECT DATE_ADD(NOW(), INTERVAL 1 MONTH); SELECT DATE_ADD(NOW(), INTERVAL 1 YEAR); 아래와 같이 사용도 가능하기 때문에 DATA_SUB() 기능도 할 수 있다. SELECT DATE_ADD(NOW(), INTERVAL -1 SE..
MySQL 년, 월, 일, 요일 구하는 함수 1. 년 YEAR(날짜) 2. 월 MONTH(날짜) 3. 일 DAYOFMONTH(날짜) 4. 요일 DAYOFWEEK(날짜) 5. DAYOFYEAR(날짜) DAYOFYEAR(날짜) mysql>SELECT YEAR(CURDATE()), MONTH(CURDATE()), DAYOFMONTH(CURDATE()), DAYOFWEEK(CURDATE()) ; +-----------------+------------------+-----------------------+----------------------+ | YEAR(CURDATE()) | MONTH(CURDATE()) | DAYOFMONTH(CURDATE()) | DAYOFWEEK(CURDATE()) | +------..