This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH Result as( | |
SELECT *, DENSE_RANK() OVER(ORDER BY Salary DESC) AS drank FROM [dbo].[Employees] | |
) | |
SELECT * FROM Result WHERE drank = 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH Result As | |
( | |
SELECT *, ROW_NUMBER() OVER(PARTITION BY [FirstName] ORDER BY [FirstName] ) | |
as RowNum FROM [dbo].[Employees] | |
) | |
SELECT * FROM RESULT where RowNum > 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH Result As | |
( | |
SELECT 1 Num | |
UNION ALL | |
SELECT Num+1 FROM Result WHERE Num < 100 | |
) | |
SELECT * FROM Result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT ProductName, | |
TotalAmout, | |
sum([TotalAmout]) OVER(ORDER BY ProductName) AS RunningTotal | |
FROM | |
(SELECT prod.ProductName, | |
sum(ord.Quantity*ord.UnitPrice) [TotalAmout] | |
FROM [Order Details] ord | |
INNER JOIN Products prod ON ord.ProductID=prod.ProductID | |
GROUP BY prod.ProductName) p |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * INTO #Team FROM | |
( | |
SELECT 1 AS ID,'India' Team | |
UNION ALL | |
SELECT 2 AS ID,'England' Team | |
UNION ALL | |
SELECT 3 AS ID,'Australia' Team | |
UNION ALL | |
SELECT 4 AS ID,'Newzeland' Team | |
UNION ALL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT t.id fromid,t.Team fromteam,t1.id toid,t1.Team toteam | |
INTO #matches | |
FROM #Team t | |
INNER JOIN #Team t1 ON t.id <> t1.id | |
SELECT * FROM #matches |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT m.* FROM #matches m | |
INNER JOIN #matches m1 ON m.fromid = m1.toid AND m.toid = m1.fromid AND m1.fromid <=m1.toid | |
ORDER BY m.toteam |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
# ## Perform Chi-Square test for Bank Churn prediction (find out different patterns on customer leaves the bank) . Here I am considering only few columns to make things clear | |
# ### Import libraries | |
# In[2]: | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let newMobile = new Promise((resolve,reject)=>{ | |
// searching for a new mobile (asynchronous operation) | |
let wishToBuy = true; | |
if(wishToBuy){ | |
resolve({"Product":"iPhone 11","Price":"1L"}); | |
} | |
else{ | |
reject({"reason":"Mobile is not up to expectations"}); |
OlderNewer