This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<web-app xmlns="http://java.sun.com/xml/ns/javaee" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee | |
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" | |
version="3.0"> | |
<!-- Processes application requests --> | |
<servlet> | |
<servlet-name>appServlet</servlet-name> | |
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.tistory.luahius; | |
public class Math { | |
public int MyMath(int x, int y){ | |
return x+y; | |
} | |
public static void main(String[] args){ | |
Math m = new Math(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- mysql connector 추가 --> | |
<dependency> | |
<groupId>mysql</groupId> | |
<artifactId>mysql-connector-java</artifactId> | |
<version>5.1.40</version> | |
</dependency> | |
<!-- 스프링에서 JDBC 사용을 위한 spring-jdbc --> | |
<dependency> | |
<groupId>org.springframework</groupId> | |
<artifactId>spring-jdbc</artifactId> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<beans:beans xmlns="http://www.springframework.org/schema/mvc" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:beans="http://www.springframework.org/schema/beans" | |
xmlns:context="http://www.springframework.org/schema/context" | |
xmlns:tx="http://www.springframework.org/schema/tx" | |
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd | |
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd | |
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd | |
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- DB 생성 | |
CREATE DATEABASE library DEFAULT CHARSET euckr;; | |
-- 사용자 계정 생성 및 권한 부여 | |
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON library.* TO 'userid'@'localhost' IDENTIFIED BY 'userpw'; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- mysql 테이블 형식 추출 쿼리 | |
SELECT | |
t1.table_name, ORDINAL_POSITION, column_name 'Column Name', COLUMN_TYPE 'COLUMN TYPE', column_key 'Key', | |
case | |
when is_nullable = 'YES' THEN 'Y' | |
when is_nullable = 'NO' THEN 'N' | |
END AS 'Null able', | |
column_default 'Default Value', column_comment 'Comment',t1.table_comment,extra 'Extra' | |
FROM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 지역 | |
CREATE TABLE region ( | |
region_no INT NOT NULL PRIMARY KEY AUTO_INCREMENT, | |
region_name VARCHAR (30) NOT NULL | |
)DEFAULT CHARSET=euckr COMMENT '지역'; | |
-- 도서관 | |
CREATE TABLE library( | |
library_no INT NOT NULL PRIMARY KEY COMMENT '도서관 일련번호', | |
region_no INT NOT NULL COMMENT '지역 번호', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- MySQL null check | |
SELECT IFNULL(컬럼명,'치환값') 보여질컬럼명 | |
FROM 테이블명; | |
-- MS-SQL null check | |
SELECT ISNULL(컬럼명,'치환값') 보여질컬럼명 | |
FROM 테이블명; | |
-- ORACLE null check | |
SELECT NVL(컬럼명,'치환값') 보여질컬럼명 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- MySQL,MS-SQL | |
INSERT 테이블명(컬럼명) | |
SELECT 테이블명2.컬럼명 | |
FROM 테이블명2 | |
WHERE 조건 | |
-- MS-SQL (INTO일 경우 테이블명 테이블이 자동 생성되며 값 insert) | |
SELECT 컬럼명 | |
INTO 테이블명 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |