본문 바로가기
728x90
반응형

DB23

[MongoDB - Python] Python으로 mongoDB에 데이터 쓰고 읽기 1. python에서 mongoDB용 library를 설치한다. python -m pip install pymongo 확인해보기 from pymongo import MongoClient from pymongo.cursor import CursorType host = "localhost" port = "27017" mongo = MongoClient(host, int(port)) print(mongo) 2. python에서 mongoDB CRUD를 위한 Class를 작성한다. class DBHandler: def __init__(self): host = "localhost" port = "27017" self.client = MongoClient(host, int(port)) def insert_item_.. 2022. 2. 15.
[MongoDB] MongoDB 설치하기 1. MongoDB 다운로드 https://www.mongodb.com/try/download/community MongoDB Community Download Download the Community version of MongoDB's non-relational database server from MongoDB's download center. www.mongodb.com 2. 설치 한 뒤 - 설치 시 mongoDB Compass(UI)도 같이 설치하면 편하다(자동 설치됨) 3. cmd 창에서 해당 폴더로 이동 후 data folder 생성 cd C:/Program Files/MongoDB/Server/5.0/bin mkdir C:/data/db mongod 차례로 입력하면 여러가지 설정 및 저장된.. 2022. 2. 15.
[MariaDB]CRUD 현재 Create Read Update : update 를 수행해보기 위해서 위의 데이터에 임의로 TEST04를 INSERT 한 뒤, 이를 TEST03으로 바꿔보자. Delete 2021. 2. 16.
Type of Triangle Write a query identifying the type of each record in the TRIANGLES table using its three side lengths. Output one of the following statements for each record in the table: Equilateral: It's a triangle with 3 sides of equal length. 정삼각형 Isosceles: It's a triangle with 2 sides of equal length. 이등변 삼각형 Scalene: It's a triangle with 3 sides of differing lengths. 그냥 삼각형 Not A Triangle: The given valu.. 2020. 6. 19.
Employee Salaries 문제 : Write a query that prints a list of employee names (i.e.: the name attribute) for employees in Employee having a salary greater than 2000 per month who have been employees for less than months. Sort your result by ascending employee_id. SELECT name FROM Employee WHERE months 2000 ORDER BY employee_id asc; Rose Patrick Lisa Amy Pamela Jennifer Julia Kevin Paul Donna Michell.. 2020. 6. 19.
Employee Names 문제 : Write a query that prints a list of employee names (i.e.: the name attribute) from the Employee table in alphabetical order. SELECT name FROM Employee ORDER BY name asc; 2020. 6. 19.
Higher Than 75 Marks 문제 : Query the Name of any student in STUDENTS who scored higher than Marks. Order your output by the last three characters of each name. If two or more students both have names ending in the same last three characters (i.e.: Bobby, Robby, etc.), secondary sort them by ascending ID. SELECT Name FROM STUDENTS WHERE Marks > 75 ORDER BY RIGHT(NAME, 3), ID ASC; Stuart Kristeen Christene Amina Aamina.. 2020. 6. 19.
HackerRank_16. Weather Observation Station 10 문제 : Query the list of CITY names from STATION that do not end with vowels. Your result cannot contain duplicates. SELECT distinct CITY FROM STATION WHERE SUBSTR(CITY, -1, 1) NOT IN ('a', 'e', 'i', 'o', 'u'); Kissee Mills Loma Mar Sandy Hook Tipton Arlington Turner Slidell Negreet Chignik Lagoon Hanna City Albany Monument Manchester Prescott Graettinger Sturgis Highwood Bowdon Tyler Watkins Repu.. 2020. 6. 12.
HackerRank_15. Weather Observation Station 9 문제 : Query the list of CITY names from STATION that do not start with vowels. Your result cannot contain duplicates. SELECT distinct CITY FROM STATION WHERE SUBSTR(CITY, 1, 1) NOT IN ('a', 'e', 'i', 'o', 'u'); Kissee Mills Loma Mar Sandy Hook Tipton Turner Slidell Negreet Glencoe Chelsea Chignik Lagoon Pelahatchie Hanna City Dorrance Monument Manchester Prescott Graettinger Cahone Sturgis Highwo.. 2020. 6. 11.
HackerRank_14. Weather Observation Station 8 문제 : Query the list of CITY names from STATION which have vowels (i.e., a, e, i, o, and u) as both their first and last characters. Your result cannot contain duplicates. SELECT distinct CITY FROM STATION WHERE SUBSTR(CITY, 1, 1) IN ('a', 'e', 'i', 'o', 'u') AND SUBSTR(CITY, -1, 1) IN ('a', 'e', 'i', 'o', 'u'); Upperco Aguanga East China East Irvine Amo Eleele Oconee Amazonia Aliso Viejo Anderso.. 2020. 6. 11.
728x90
반응형