일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- dense_rank()
- 공공데이터
- asc
- ERP
- SQL
- desc
- join
- S/4 HANA
- spa
- order by
- %_%
- group by
- DateDiff
- 오블완
- SAP HANA
- over()
- 티스토리챌린지
- limit
- union
- HAVING
- R/3
- SERVICE_KEY_IS_NOT_REGISTERED_ERROR
- 중복 컬럼
- CSV
- between
- left join
- stratascratch
- json
- Where
- r/2
- Today
- Total
목록전체 (20)
RE:cord
Q. Take the specific year and customerID and show the customer's Quantity of orders in that year.create function ff (@year int, @cus_n int)returns intas begin declare @quan varchar select @quan = count(*) from Sales.salesorderheader where year(OrderDate) = @year AND customerID = @cus_n return @quanendselect dbo.ff(2011, 29825) as QuantityOfOrder Q. If you were the Data Analyst in this company,..
What is UDF?The function helps users not to write the same query again.It means recycling.There are two types of Functions.1. Scalar Function - return the one output.2. Table-Valued Function - return various outputs in a table.Basic Formcreate function fufuncname (@prm1 datatype1, @pmr2 datatype..)returns datatypeasbegin return ReturnValueend EX1. function of adding two numberCREATE FUNCTION..

/*1. Leave an action user (with condition 3)2. Groups by country3. Calculation !! (how? -> main query count / sub query count)*/select pa.country, round( (count(case when last_active_date >= '2024-01-01' and sessions >= 5 and listening_hours >= 10 then 1 else null end)/ (select count(*) f..

select distinct user_id, count(*) over (partition by user_id) total_n_order, count(*) over (partition by order_date) total_valuefrom order_summarywhere user_id IN ( select os.user_id from order_summary os join sessions ss on os.user_id = ss.user_id where ss.session_date = os.order_date )order by user_id
Ketty gives Eve a task to generate a report containing three columns: Name, Grade and Mark. Ketty doesn't want the NAMES of those students who received a grade lower than 8. The report must be in descending order by grade -- i.e. higher grades are entered first. If there is more than one student with the same grade (8-10) assigned to them, order those particular students by their name alphabetic..

SELECT account_id, AVG(average_daily_count)FROM (SELECT account_id, count(*) average_daily_count FROM sf_events WHERE date BETWEEN '2021-01-01' AND '2021-01-31' --or.. WHERE date LIKE '2021-01%' GROUP BY account_id) countingGROUP BY account_id
GROUP BY와 PARTITION은 그 용도와 방식에 차이가 있음1. GROUP BYGROUP BY는 데이터를 그룹화해서 집계함으로써, 각 그룹에 대해 하나의 결과를 반환하는 데 사용됩니다. 예를 들어, 특정 컬럼의 값을 기준으로 데이터를 나누고, 그 그룹에 대해 집계 함수(SUM(), AVG(), COUNT() 등)를 적용할 때 사용합니다.예시:sql SELECT ProductID, SUM(OrderQty) AS TotalQtyFROM Sales.SalesOrderDetailGROUP BY ProductID;이 쿼리는 ProductID를 기준으로 데이터를 그룹화한 후, 각 제품별로 주문 수량(OrderQty)의 합계를 계산합니다. 이때 GROUP BY가 ProductID를 기준으로 데이터를 그룹화하고..
-----If not using union...SELECT ProductID, SUM(OrderQty) AS TotalQty, COUNT(OrderQty) NoOfSales, CASE WHEN AVG(OrderQty) 6 THEN 'High quantity' END AS AvgQtyDescribeFROM Sales.SalesOrderDetail AS SOD JOIN Sales.SalesOrderHeader AS SOH ON SOD.SalesOrderID = SOH.SalesOrderIDWHERE SOH.OrderDate BETWEEN '2012-05-01' AND '2012-05-31'GROUP BY SOD.ProductIDORDER BY AVG(OrderQty) DESC -----If using..