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.

[…]