-- 고객 테이블 예시
CREATE TABLE Customers (
id INT PRIMARY KEY,
name VARCHAR(100),
email VARCHAR(100),
age INT,
join_date DATE
);
<?xml version="1.0" encoding="UTF-8"?>
<customers>
<customer>
<id>1</id>
<name>John Doe</name>
<email>john@example.com</email>
</customer>
<customer>
<id>2</id>
<name>Jane Smith</name>
<phone>123-456-7890</phone>
</customer>
</customers>
{
"customers": [
{
"id": 1,
"name": "John Doe",
"email": "john@example.com"
},
{
"id": 2,
"name": "Jane Smith",
"phone": "123-456-7890"
}
]
}
오늘은 맑은 날씨입니다.
기온은 20도이며, 습도는 적당합니다.
오후에는 비가 올 수 있습니다.
{
"filename": "vacation.jpg",
"size": "2.5MB",
"resolution": "1920x1080",
"date_taken": "2024-01-15",
"location": "Paris, France"
}
// JDBC를 사용한 정형 데이터 처리 예시
public class StructuredDataExample {
public void processData() {
String sql = "SELECT * FROM customers WHERE age > ?";
try (PreparedStatement pstmt = connection.prepareStatement(sql)) {
pstmt.setInt(1, 30);
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
// 데이터 처리
}
}
}
}
// JSON 처리 예시
public class SemiStructuredDataExample {
public void processJson() {
JSONObject json = new JSONObject();
json.put("name", "John");
json.put("age", 30);
// 데이터 읽기
String name = json.getString("name");
int age = json.getInt("age");
}
}
// 텍스트 파일 처리 예시
public class UnstructuredDataExample {
public void processText() throws IOException {
try (BufferedReader reader = new BufferedReader(
new FileReader("document.txt"))) {
String line;
while ((line = reader.readLine()) != null) {
// 텍스트 분석/처리
}
}
}
}
이러한 데이터 유형들의 주요 차이점과 활용 시 고려사항은 다음과 같습니다:
처리 복잡도:
검색 용이성:
확장성:
데이터 품질 관리:
이러한 특성을 고려하여 적절한 데이터 유형과 저장소를 선택하는 것이 중요합니다.