SQL

0
  • SQL
SELECT product_id, SUM(sale_amount) as total_sales
FROM sales 
GROUP BY product_id
ORDER BY total_sales DESC;
SELECT FLOOR()
  • 마이그레이션
    : IT 마이그레이션은 데이터나 소프트웨어를 한 시스템에서 다른 시스템으로 이동하는 것
from pymongo import MongoClient

client=MongoClient("mongodb://~")
db=client["memo_db"];

collection =db["memos"];

def create_memo(title:str,content:str):
	memo={
    	"title":title,
        "content":content
    }
    result=collection.insert_one(memo)
    print(f"Inserted memo with id(result.inserted_id)")

def read_memos():
	memos= collection.find();
    for memo in memons:
    	print(memo)
	
def update_memo(memo_id, title:str, content:str):
	collection.update_one(
    	{"_id": memo_id},
        {"$set": {"title":title, "content":content}}
    )
    print(f"Updated memo with id {memo_id}")

def delete_memo(memo_id):
	collection.delete_one({"_id":memo_id})
    print(f"Deleted memo with id {memo_id}")
from pymongo import MongoClient

client=MongoClient("mongodb://{주소}")

db=client["friend_db"]

collection =db["friends"]

def add_friends(name:str,phone_number:str):
	friend={
    	"name":name,
        "phone_number":phone_number
    }
    result=collection.insert_one(friend)
    print(f"Inserted friend with id {result.inserted_id}")

def list_friends():
	friends=collection.find()
    for friend in friends:
    	print(friend)
        
def delete_friend(friend_id):
	collction.delete_one({"_id":friend_id})
    print(f"Deleted friend with id ${friend_id}")
    
def search_friend_by_name(name:str):
	friends = collection.find({"name":name})
    for friend in friends:
    	print(friend)
profile
제대로 꾸준하게 / 블로그 이전 => https://dailybit.co.kr

0개의 댓글