SQL Queries Code Interviews QA 50 plus

Image
Here are SQL-focused interview questions with only the relevant SQL code: 1. Find the second highest salary from an Employee table. SELECT MAX(Salary) AS SecondHighestSalary FROM Employees WHERE Salary < (SELECT MAX(Salary) FROM Employees); Using ROW_NUMBER(): WITH RankedSalaries AS (   SELECT Salary, ROW_NUMBER() OVER (ORDER BY Salary DESC) AS Rank   FROM Employees ) SELECT Salary AS SecondHighestSalary FROM RankedSalaries WHERE Rank = 2; --- 2. Write a query to calculate a running total of sales. SELECT   OrderID,   OrderDate,   Amount,   SUM(Amount) OVER (ORDER BY OrderDate) AS RunningTotal FROM Orders; --- 3. Retrieve customers who placed no orders using a LEFT JOIN. SELECT c.CustomerID, c.CustomerName FROM Customers c LEFT JOIN Orders o ON c.CustomerID = o.CustomerID WHERE o.OrderID IS NULL; --- 4. Write a query to find the top 3 highest salaries. SELECT DISTINCT Salary FROM Employees ORDER BY Salary DESC LIMIT 3; Using DENSE_RANK(): WIT...

Guidewire Claim Insights in Databricks and Tableau - How many claims are there?

 In this blog post, sharing guidewire claims how many claims got created per city  and per state basics


Databricks it is available here : Claim happened from most US State Insights data analytics Template V1.0 - Databricks


SQL Sample code 

select
AX.CITY,
count(AX.CLAIM_NUMBER) as TOTAL_CLAIMS_PER_CITY
from
(select distinct
C.CLAIMNUMBER as CLAIM_NUMBER,
ST.NAME as STATE,
ADDR.CITY
from
guidewire_raw_db.cc_claim C
left join guidewire_raw_db.cc_contact CONT on C.INSUREDDENORMID = CONT.ID
left join guidewire_raw_db.cc_address ADDR on CONT.PRIMARYADDRESSID = ADDR.ID
left join guidewire_raw_db.cctl_state ST on ADDR.STATE = ST.ID ) AX
group by AX.CITY
order by 2 desc

From these SQL Query Resultsets Feed into Tableau Public Edition






This Tableau Public view Available here 

https://public.tableau.com/views/Guidewire_Insurance_Claims_Insights_one/InsuranceClaimsPerCity?:language=en-US&:sid=&:redirect=auth&:display_count=n&:origin=viz_share_link





Comments

Popular posts from this blog

"How to maintain or retain tabs in same tab after button click events or postback?" using JQuery in ASP.NET C#

Login and Registration forms in C# windows application with Back end Microsoft SQL Server for data access