이 빠른 시작에서는 비즈니스 논리 설명자를 통해 개발자가 SQL, ORM(Object-Relational 매핑) 프레임워크 또는 데이터베이스에서 직접 구현된 복잡한 애플리케이션 논리를 이해하고 작업하는 방법을 알아봅니다. 도우미는 SQL 코드, ORM 모델 또는 기존 데이터베이스 스키마를 분석하여 기본 비즈니스 규칙을 설명하고 실행 가능한 설명서를 제공합니다.
시작하기
데이터베이스에 연결되어 있고 MSSQL 확장으로 활성 편집기 창이 열려 있는지 확인합니다. 이 연결을 사용하면 채팅 참가자가 @mssql 데이터베이스 환경의 컨텍스트를 이해할 수 있으므로 정확하고 컨텍스트 인식 제안을 사용할 수 있습니다. 데이터베이스 연결이 없으면 채팅 참가자는 의미 있는 응답을 제공하는 스키마 또는 데이터 컨텍스트가 없습니다.
다음 예제에서는 AdventureWorksLT2022 홈페이지에서 다운로드할 수 있는 샘플 데이터베이스를 사용합니다.
최상의 결과를 위해 사용자 고유의 환경에 맞게 테이블 및 스키마 이름을 조정합니다.
@mssql 접두사가 채팅에 포함되어 있는지 확인하세요. 예를 들어, @mssql을 입력한 후에 질문이나 프롬프트를 작성합니다. 이렇게 하면 채팅 참가자가 SQL 관련 지원을 요청하는 것을 이해할 수 있습니다.
GitHub Copilot를 사용하여 비즈니스 논리 이해
GitHub Copilot는 데이터베이스 코드, ORM 모델 및 애플리케이션 쿼리에 포함된 비즈니스 규칙을 이해하고 설명하는 데 도움이 될 수 있습니다. 저장 프로시저에서 LINQ 쿼리 및 Sequelize 식에 이르기까지 GitHub Copilot는 복잡한 논리에 더 쉽게 액세스할 수 있도록 자연어 인사이트를 제공합니다.
다음은 채팅 참가자를 통해 요청할 수 있는 일반적인 사용 사례 및 예제입니다.
T-SQL 논리 설명
GitHub Copilot를 사용하여 저장 프로시저에서 인라인 조건문에 이르는 T-SQL(Transact-SQL) 논리를 이해하고 설명합니다. 할인 규칙, 절차 논리 또는 최적화 조건을 검토하든 GitHub Copilot는 T-SQL에서 구현된 비즈니스 규칙을 분석하고 문서화할 수 있습니다.
저장 프로시저 설명
Explain what the `SalesLT.uspGetCustomerOrderHistory` stored procedure does and suggest ways to optimize it.
저장 프로시저 디버그
Debug the `SalesLT.uspGetTopSellingProducts` stored procedure and suggest improvements.
코드 조각에서 비즈니스 논리 설명
Analyze the following SQL code snippet from my current database. Document the business rules implemented in this discount application process, including conditions for eligibility, discount rate adjustments, and any limits imposed on the discount amount. Also, provide actionable insights or suggestions to improve clarity or performance if necessary.
DECLARE @OrderTotal AS DECIMAL (10, 2) = 1500.00;
DECLARE @DiscountCode AS NVARCHAR (20) = 'DISCOUNT10';
DECLARE @DiscountPct AS DECIMAL (5, 2) = CASE WHEN @OrderTotal > 1000.00 THEN 5.0 ELSE 0.0 END;
IF @DiscountCode = 'DISCOUNT10'
BEGIN
SET @DiscountPct = CASE WHEN @DiscountPct < 10.0 THEN 10.0 ELSE @DiscountPct END;
END
DECLARE @DiscountAmount AS DECIMAL (10, 2) = (@OrderTotal * @DiscountPct / 100.0);
IF @DiscountAmount > 200.00
BEGIN
SET @DiscountAmount = 200.00;
END
SELECT @OrderTotal AS OrderTotal,
@DiscountPct AS DiscountPercentage,
@DiscountAmount AS DiscountAmount;
ORM 논리 설명
SQLAlchemy 쿼리 설명
Explain what the following SQLAlchemy query does:
from sqlalchemy import func
top_customers = (
session.query(SalesOrderHeader.CustomerID, func.count().label("OrderCount"))
.group_by(SalesOrderHeader.CustomerID)
.order_by(func.count().desc())
.limit(10)
)
Entity Framework LINQ 쿼리 설명
What does this Entity Framework LINQ query do? Describe how it groups customers by tier based on their total purchases.
var customerTiers = context.SalesOrderHeaders
.GroupBy(o => o.CustomerID)
.Select(g => new {
CustomerID = g.Key,
TotalSpent = g.Sum(o => o.TotalDue),
Tier = g.Sum(o => o.TotalDue) >= 10000 ? "Gold" :
g.Sum(o => o.TotalDue) >= 5000 ? "Silver" : "Bronze"
});
Prisma 쿼리에서 비즈니스 논리 설명
Analyze the logic of this Prisma query and explain how it determines which products are considered "low inventory".
const lowInventoryProducts = await prisma.product.findMany({
where: {
SafetyStockLevel: {
lt: 50
}
},
select: {
ProductID: true,
Name: true,
SafetyStockLevel: true
}
});
Sequelize 쿼리 설명 및 주석 달기
Review and explain what this Sequelize query does. Add inline comments to clarify how it calculates total revenue per customer and filters for customers with significant spending:
const results = await SalesOrderHeader.findAll({
attributes: ['CustomerID', [sequelize.fn('SUM', sequelize.col('TotalDue')), 'TotalSpent']],
group: ['CustomerID'],
having: sequelize.literal('SUM(TotalDue) > 5000')
});
제품 목록에 대한 SQLAlchemy 쿼리 생성
Using SQLAlchemy, generate a query to list products that have never been ordered and ask GitHub Copilot to explain the join logic and filtering behavior.
Prisma 쿼리를 사용하여 고객 정보 검색
In Prisma, write a query that retrieves customers who placed an order in the last 30 days. Explain what the following Prisma query does. Add inline comments to clarify how the date filtering works and how recent orders are determined:
쿼리를 통한 비즈니스 의도 이해
GitHub Copilot는 개발자가 쿼리의 작동 방식뿐만 아니라 쿼리가 존재하는 이유를 이해하는 데 도움이 됩니다. 이 설명에는 데이터 필터, 그룹화 및 집계의 실제 용도가 포함됩니다. 이러한 설명은 온보딩하는 동안 특히 유용하므로 개발자는 SQL 및 ORM 코드에 포함된 보고서, 논리 게이트 또는 시스템 메트릭 뒤에 있는 목표를 파악할 수 있습니다.
T-SQL 쿼리에서 비즈니스 목표 설명
Describe the business goal of the following SQL query. What insight is it trying to surface?
SELECT TOP 10 CustomerID,
COUNT(*) AS OrderCount
FROM SalesLT.SalesOrderHeader
GROUP BY CustomerID
ORDER BY OrderCount DESC;
T-SQL 쿼리의 의도 요약
Summarize what this query is intended to achieve from a business perspective.
SELECT ProductID,
SUM(LineTotal) AS TotalSales
FROM SalesLT.SalesOrderDetail
GROUP BY ProductID
HAVING SUM(LineTotal) > 10000;
저장 프로시저에서 비즈니스 논리 설명
Analyze the `SalesLT.uspGetCustomerOrderHistory` stored procedure and describe the business logic it implements.
Entity Framework LINQ 쿼리에서 비즈니스 논리 설명
Explain this Entity Framework LINQ query and describe what business logic it implements:
var highValueCustomers = context.SalesOrderHeaders
.Where(o => o.TotalDue > 1000)
.GroupBy(o => o.CustomerID)
.Select(g => new { CustomerID = g.Key, OrderCount = g.Count() })
.OrderByDescending(x => x.OrderCount)
.Take(10)
.ToList();
Sequelize 쿼리에서 비즈니스 가정 설명
Using Sequelize, explain what this query does and describe any business assumptions it makes:
const customerRevenue = await SalesOrderHeader.findAll({
attributes: ['CustomerID', [sequelize.fn('SUM', sequelize.col('TotalDue')), 'TotalSpent']],
group: ['CustomerID'],
having: sequelize.literal('SUM(TotalDue) > 5000')
});
사용자 경험 공유
MSSQL 확장에 대한 GitHub Copilot를 구체화하고 개선하는 데 도움이 되도록 다음 GitHub 문제 템플릿을 사용하여 피드백을 제출합니다. GitHub Copilot 피드백
피드백을 제출할 때 다음을 포함하는 것이 좋습니다.
테스트된 시나리오 – 스키마 만들기, 쿼리 생성, 보안, 지역화와 같이 집중한 영역을 알려주세요.
잘 작동하는 기능 – 원활하거나 도움이 되거나 예상을 초과한 모든 경험을 설명합니다.
문제 또는 버그 – 문제, 불일치 또는 혼란스러운 동작을 포함합니다. 스크린샷 또는 화면 녹화는 특히 유용합니다.
개선 제안 - 유용성 향상, 적용 범위 확장 또는 GitHub Copilot의 응답 향상을 위한 아이디어를 공유합니다.