SQL Queries

Back to home
Logicmojo - Updated March 28, 2022



What are Queries in SQL?

The SQL (Structured Query Language) language is a standard for dealing with relational databases. Given the massive amount of data available, it's critical that we learn how to use queries to acquire the information we need. In this article we discuss Top 30 latest SQL Queries in 2022 , I'll go over a few queries that you should practise if you want to become a Database Administrator, as well as some tips on how to ace your interviews.


Most Commonly Asked SQL Queries in 2022

SELECT UPPER (FirstName)
AS EmpName
FROM Employee

SELECT COUNT (*)
FROM Employee
WHERE Department = 'Technical'

SELECT GETDATE();

SELECT SUBSTRING (FirstName, 1, 4)
FROM Employee

SELECT SUBSTRING (Address, 1, CHARINDEX('(',Address))
FROM Employee

CREATE TABLE NewTable 
AS SELECT *
FROM Employee

SELECT  * 
FROM Employee
WHERE Salary BETWEEN '60000' AND '90000';

SELECT  * 
FROM Employee
WHERE FirstName LIKE 'A%';

SELECT  * 
FROM Employee
ORDER BY Salery DEC LIMIT N;

SELECT  CONCAT(FisrName, ' ', LastName) 
AS FullName
FROM Employee

SELECT COUNT (*), Gender
FROM Employee WHERE Salary BETWEEN '10000' AND '30000'
GROUP BY Gender

SELECT *
FROM Employee ORDER BY LastName DESC , Department ASC

SELECT *
FROM Employee WHERE LastName LIKE '____N'

SELECT *
FROM Employee WHERE FirstName NOT IN ("Pragati", "Renu")

SELECT *
FROM Employee WHERE Address LIKE "DELHI(DEL)%"

SELECT EmpID 
FROM (SELECT rowno, EmpID FROM Employee)
WHERE MOD(rowno,2) = 0;

SELECT EmpID 
FROM (SELECT rowno, EmpID FROM Employee)
WHERE MOD(rowno,2) = 1;

SELECT EmpID, FirstName, Department COUNT(*) 
FROM Employee GROUP BY EmpID, FirstName, Department 
HAVINGCOUNT(*) > 1

SELECT * 
FROM Employee 
WHERE
EmpID = (SELECT MIN(EmpID)
FROM Employee);

SELECT * 
FROM Employee WHERE
EmpID <= (SELECT COUNT(EmpID)/2 From Employee);


logicmojoContact

HAVE A QUESTION? GIVE US A CALL OR CONTACT US - WE'D LOVE TO HEAR FROM YOU

PHONE: +91 80889-75867

WhatsApp : Click Here...

FEEDBACKFORM