SQL Puzzle: SQL Advance Query – Sort Products based on Versions

Check the below input & output data, and sort product data based on its versions information. Input data:

Require Output Data:

Create a table with sample data:

Solution:

SQL Puzzle: SQL Advance Query – To find total number of Sundays in a given Year

In this puzzle, You have only two dates value, start-date and end-date. Find a total number of Sundays between given dates. Output: Total 53 Sundays in year 2017

Solution:

SQL Puzzle: SQL Advance Query – Find first 100 Prime numbers in SQL Server

Question: Write a SQL query to find first 100 Prime numbers in SQL Server. Require Output:

Solution:

SQL Puzzle: SQL Advance Query – Draw a Triangle without using any Loop

Check the below two solutions to draw a triangle without using any loop in SQL Server. Require Output:

Solution 1:

Solution 2: Fetch number value from the MASTER..SPT_VALUES table of SQL Server.

[…]

SQL Puzzle: SQL Advance Query – Find the distinct combination from cross Columns

Check the below input data and require output data to find a distinct combination of the cross columns. Create a table with sample data:

Input data:

Expected Output:

Solution 1:

Solution […]

SQL Puzzle: Advance SQL Query – Convert single cell of table into multiple Rows

Check the below input and require output, and convert single cell of a table into multiple Rows. Input:

Output:

Solution 1:

Solution 2:

Please try the different solution for this puzzle […]