Adobe Interview Question | Customers
Question
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
It will take less than 1 minute to register for lifetime. Bonus Tip - We don't send OTP to your email id Make Sure to use your own email id for free books and giveaways
Answers ( 2 )
SELECT Cust_id, order_date, order_id, tran_amt
FROM Orders
WHERE DATEDIFF(day, order_date, get_date()) > 365
ORDER BY tran_amt DESC;
DATEDIFF – to calculate the difference between two date values
GETDATE() returns the current/today’s date
It is Getdate(), not get_date()
In Oracle:-
SELECT cust_id,total_spend FROM (SELECT cust_id, sum(tran_amount) total_spend FROM customer
WHERE ORDER_DATE >= add_months(sysdate,-12)
GROUP BY cust_d
ORDER BY 2 desc
) WHERE rownum <101;
In Oracle:-
SELECT cust_id,total_spend FROM (SELECT cust_id, sum(tran_amount) total_spend FROM customer
WHERE ORDER_DATE >= add_months(sysdate,-12)
GROUP BY cust_d
ORDER BY 2 desc
) WHERE rownum <101;