전체 글
-
PHP 기본 문법데이터베이스/SQL 2023. 12. 28. 17:02
PHP 코드의 확정명은 *.php로 사용 php 기본 틀 php 주석 변수와 출력 // 실행 결과 100안녕하세요?MariaDB PHP의 변수 이름은 몇 가지 규칙을 따라야 함 제일 앞에 $가 붙어야 함 문자와 숫자, 언더바(_)를 사용할 수 있지만 숫자로 시작할 수 없음 ex) $abc (O), $abc123 (O), $_abc123 (O), $123 (X), $123abc (X) 대소문자를 구별함 ex) $abc와 $ABC는 다른 변수 데이터 형식 PHP 데이터 형식은 정수(int), 실수(double), 문자열(string), 불형(boolean), 객체(object), 배열(array) 등이 있음 문자열 문자열은 큰 따옴표 혹은 작은 따옴표를 사용해도 되지만 큰 따옴표로 묶고, 그 내부에 필요할 ..
-
쿼리 작성 실습데이터베이스/MongoDB 2023. 12. 28. 13:50
실습 예제 준비 1. 사이트에서 다운받기 https://github.com/Karoid/mongodb_tutorials GitHub - Karoid/mongodb_tutorials: 몽고디비 실습을 위한 자료 몽고디비 실습을 위한 자료. Contribute to Karoid/mongodb_tutorials development by creating an account on GitHub. github.com 2. cmd 창에서 입력 (git이 다운로드되어 있어야 함) > git clone https://github.com/Karoid/mongodb_tutorials.git > cd mongodb_tutorials > cd car_accident > mongoimport -d car_accident -c a..
-
배열 연산자데이터베이스/MongoDB 2023. 12. 28. 13:50
# 데이터 입력 db.inventory2.insertMany([ { item: 'journal', qty: 25, tags: ['blank', 'red'] }, { item: 'notebook', qty: 50, tags: ['red', 'blank'] }, { item: 'paper', qty: 100, tags: ['red', 'blank', 'plain']}, { item: 'planner', qty: 75, tags: ['blank', 'red'] }, { item: 'postcard', qty: 45, tags: ['blue']}]) # red 문자열이 들어있는 도큐먼트 모두 검색됨 db.inventory2.find({tags: 'red'}, {_id: 0}) { item: 'journal', ..
-
문자열 연산자데이터베이스/MongoDB 2023. 12. 28. 11:54
◎ $regex 연산자 값이 정규 표현식과 맞는 도큐먼트를 선택 $regex 연산자는 옵션 값을 설정할 수 있어 다른 연산자와는 형식이 조금 다름 # 연산자의 형식 3가지 { : {$regex: /pattern/, $options: ''} } { : {$regex: 'pattern', $options: ''} } { : {$regex: /pattern/} } 옵션 설명 i 대소문자 무시 m 정규식에서 앵커(^)를 사용할 때 값에 \n이 있다면 무력화 x 정규식 안에 있는 공백을 모두 무시 s 점(.)을 사용할 때 \n을 포함해서 매치 자리에는 표의 네 가지 문자를 넣을 수 있음 ◎ $text 연산자 $text 연산자는 해당 컬렉션의 텍스트 인덱스 안에서만 작동 db.stores.insertMany( [ ..
-
-
배열 연습 문제데이터베이스/MongoDB 2023. 12. 15. 16:06
1. 첫 번째 과목이 수학이고, 점수가 85보다 큰 학생 찾기 db.class.find({grades:{$elemMatch:{subject:'수학', score:{$gt:85}}}}).pretty() db.class.find({'grades.subject': "수학", 'grades.score': {$gte : 85}}) { _id: 1, name: '반장', grades: [ { subject: '수학', score: 88 }, { subject: '과학', score: 90 } ] } { _id: 2, name: '부반장', grades: [ { subject: '수학', score: 88 }, { subject: '과학', score: 90 } ] } 2. 두 번째 과목에서 과학 점수가 90점 이상..
-
XAMPP 설치데이터베이스/SQL 2023. 12. 14. 17:22
https://sourceforge.net/projects/xampp/files/XAMPP%20Windows/7.2.13/ XAMPP - Browse /XAMPP Windows/7.2.13 at SourceForge.net Making Paperless Happen to Move Your Company Forward Preserve and bring visibility to all your physical documents in a digital environment sourceforge.net 경고창 떠도 걍 무시, Programs Files (x86)에 설치할 수 없다는 뜻 설치 후 환경 설정 최종 설정 끝 이후에는 컴퓨터를 재부팅해도 Apache 서비스 자동 시작 ~재부팅~ 메모장 켜기 입력 후 C..
-
MongoDB 문제 예제 2데이터베이스/MongoDB 2023. 12. 14. 15:02
* Practice1 Database, Movies Collection 사용) 3. Query / Find Documents(1) 모든 도큐먼트 찾기 */ use Practice1 db.movies.find() /* 출력 */ switched to db Practice1 { _id: ObjectId("6572d0649eb2afcbf945d552"), title: 'Avatar' } { _id: ObjectId("6572d0649eb2afcbf945d553"), title: "Pee Wee Herman's Big Adventure" } { _id: ObjectId("6572d0649eb2afcbf945d554"), title: 'The Hobbit: An Unexpected Journey', writer:..