DotNet By Ajay — New: ES2025 cheat-sheet is live!
Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts

May 31, 2026

LeetCode #185: Department Top Three Salaries | SQL Interview Question Explained

Master LeetCode #185 (Department Top Three Salaries)

Master LeetCode #185 (Department Top Three Salaries) with a step-by-step SQL solution using DENSE_RANK(). Learn the approach, query explanation, and interview tips for SQL, .NET, and Data Engineering interviews.

February 14, 2023

How to add the prefix to the ID column with auto increment ID in SQL?

Here, I am taking an example of a Product. We have different types of  products, so I want to generate a new ProductId using a prefix of value like the below:

February 9, 2023

SQL Delete Records within a specific range

SQL Delete Query with BETWEEN condition:

Here i want to delete record from table with in specific range.

September 13, 2022

HackerRank: SQL Basic Select "apanese Cities' Attributes"

Question:
Query all attributes of every Japanese city in the CITY table. The COUNTRYCODE for Japan is JPN.

September 12, 2022

HackerRank: SQL Basic Select BY ID

Question:

Query all columns for a city in CITY with the ID 1661.

September 11, 2022

HackerRank: SQL Basic Select All

Question:

Query all columns (attributes) for every row in the CITY table.

September 10, 2022

HackerRank: SQL Basic Select 2

Question:

Query the NAME field for all American cities in the CITY table with populations larger than 120000. The CountryCode for America is USA.

September 9, 2022

HackerRank: SQL Basic Select 1

QUESTION:

Query all columns for all American cities in the CITY table with populations larger than 100000. The CountryCode for America is USA.

July 12, 2021

How I get SQL ISO8601(SQL 126) DateTime Format

 SQL 126  | yyyy-mm-ddThh:mi:ss.mmm | ISO8601 DateTime Format


Declare @ADate Date,

            @ATime Time


Select @ADate='2021-07-12', @ATime='9:05 AM'


Select @ADate AS ADate, @ATime AS ATime


SELECT CONVERT(VARCHAR, CAST(CONVERT(Varchar(15), @ADate, 112) + ' ' + CONVERT(Varchar(8), @ATime) AS DATETIME), 126) AS [SQL ISO8601 DateTime Format]

October 26, 2016

How to insert Identity values in the Non-Identity column in SQL Server?

Here I am going to discuss how to insert identity value in the non-identity column.

March 17, 2016

SQL Server | SQL Server Agent Jobs currently running on the SQL Server