SQL Queries Pitanja
SQL Queries Pitanja
SQL Queries Pitanja
Hello friends! in this post, we will see some of the most common SQL queries
asked in interviews. Whether you are a DBA, developer, tester, or data analyst,
these SQL query interview questions and answers are going to help you.
In fact, I have been asked most of these questions during interviews in the
different phases of my career.
If you want to skip the basic questions and start with some tricky SQL queries
then you can directly move to our SQL queries interview questions for the
experienced section.
Consider the below two tables for reference while trying to solve the SQL
queries for practice.
Table – EmployeeDetails
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
EmpId FullName ManagerId DateOfJoining City
Table – EmployeeSalary
421 P1 12000 0
For your convenience, I have compiled the top 10 questions for you. You can try
solving these questions and click on the links to go to their respective answers.
1. SQL Query to fetch records that are present in one table but not in
another table.
2. SQL query to fetch all the employees who are not working on any project.
3. SQL query to fetch all the Employees from EmployeeDetails who joined
in the Year 2020.
4. Fetch all employees from EmployeeDetails who have a salary record in
EmployeeSalary.
5. Write an SQL query to fetch a project-wise count of employees.
6. Fetch employee names and salaries even if the salary value is not
present for the employee.
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
7. Write an SQL query to fetch all the Employees who are also managers.
8. Write an SQL query to fetch duplicate records from EmployeeDetails.
9. Write an SQL query to fetch only odd rows from the table.
10. Write a query to find the 3rd highest salary from a table without top or
limit keyword.
Or, you can also jump to our below two sections on interview questions for
freshers and experienced professionals.
Content
Here is a list of top SQL query interview questions and answers for fresher
candidates that will help them in their interviews. In these queries, we will focus
on the basic SQL commands only.
Ques.1. Write an SQL query to fetch the EmpId and FullName of all the
employees working under the Manager with id – ‘986’.
Ans. We can use the EmployeeDetails table to fetch the employee details with a
where clause for the manager-
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Ques.2. Write an SQL query to fetch the different projects available from
the EmployeeSalary table.
Ans. While referring to the EmployeeSalary table, we can see that this table
contains project values corresponding to each employee, or we can say that we
will have duplicate project values while selecting Project values from this table.
So, we will use the distinct clause to get the unique values of the Project.
SELECT DISTINCT(Project)
FROM EmployeeSalary;
SELECT COUNT(*)
FROM EmployeeSalary
WHERE Project = 'P1';
Ques.4. Write an SQL query to find the maximum, minimum, and average
salary of the employees.
Ans. We can use the aggregate function of SQL to fetch the max, min, and
average values-
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
SELECT Max(Salary),
Min(Salary),
AVG(Salary)
FROM EmployeeSalary;
Ques.5. Write an SQL query to find the employee id whose salary lies in
the range of 9000 and 15000.
Ans. Here, we can use the ‘Between’ operator with a where clause.
Ques.6. Write an SQL query to fetch those employees who live in Toronto
and work under the manager with ManagerId – 321.
Ans. Since we have to satisfy both the conditions – employees living in ‘Toronto’
and working in Project ‘P2’. So, we will use AND operator here-
Ques.7. Write an SQL query to fetch all the employees who either live in
California or work under a manager with ManagerId – 321.
Ans. This interview question requires us to satisfy either of the conditions –
employees living in ‘California’ and working under Manager with ManagerId –
321. So, we will use the OR operator here-
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
SELECT EmpId, City, ManagerId
FROM EmployeeDetails
WHERE City='California' OR ManagerId='321';
Ques.8. Write an SQL query to fetch all those employees who work on
Projects other than P1.
Ans. Here, we can use the NOT operator to fetch the rows which are not
satisfying the given condition.
SELECT EmpId
FROM EmployeeSalary
WHERE NOT Project='P1';
SELECT EmpId
FROM EmployeeSalary
WHERE Project <> 'P1';
For the difference between NOT and <> SQL operators, check this link –
Difference between the NOT and != operators.
Ques.9. Write an SQL query to display the total salary of each employee
adding the Salary with Variable value.
Ans. Here, we can simply use the ‘+’ operator in SQL.
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
SELECT EmpId,
Salary+Variable as TotalSalary
FROM EmployeeSalary;
Ques.10. Write an SQL query to fetch the employees whose name begins
with any two characters, followed by a text “hn” and ends with any
sequence of characters.
Ans. For this question, we can create an SQL query using like operator with ‘_’
and ‘%’ wild card characters, where ‘_’ matches a single character and ‘%’
matches ‘0 or multiple characters.
SELECT FullName
FROM EmployeeDetails
WHERE FullName LIKE ‘__hn%’;
Ques.11. Write an SQL query to fetch all the EmpIds which are present in
either of the tables – ‘EmployeeDetails’ and ‘EmployeeSalary’.
Ans. In order to get unique employee ids from both tables, we can use the
Union clause which can combine the results of the two SQL queries and return
unique rows.
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
tables.
Ans. SQL Server – Using INTERSECT operator-
MySQL – Since MySQL doesn’t have INTERSECT operator so we can use the
subquery-
SELECT *
FROM EmployeeSalary
WHERE EmpId IN
(SELECT EmpId from ManagerSalary);
Ques.13. Write an SQL query to fetch records that are present in one table
but not in another table.
Ans. SQL Server – Using MINUS- operator-
MySQL – Since MySQL doesn’t have a MINUS operator so we can use LEFT
join-
SELECT EmployeeSalary.*
FROM EmployeeSalary
LEFT JOIN
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
ManagerSalary USING (EmpId)
WHERE ManagerSalary.EmpId IS NULL;
Ques.14. Write an SQL query to fetch the EmpIds that are present in both
the tables – ‘EmployeeDetails’ and ‘EmployeeSalary.
Ans. Using subquery-
Ques.15. Write an SQL query to fetch the EmpIds that are present in
EmployeeDetails but not in EmployeeSalary.
Ans. Using subquery-
Ques.16. Write an SQL query to fetch the employee’s full names and
replace the space with ‘-’.
Ans. Using the ‘Replace’ function-
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Ques.17. Write an SQL query to fetch the position of a given character(s)
in a field.
Ans. Using the ‘Instr’ function-
Ques.18. Write an SQL query to display both the EmpId and ManagerId
together.
Ans. Here we can use the CONCAT command.
Ques.19. Write a query to fetch only the first name(string before space)
from the FullName column of the EmployeeDetails table.
Ans. In this question, we are required to first fetch the location of the space
character in the FullName field and then extract the first name out of the
FullName field.
For finding the location we will use the LOCATE method in MySQL and
CHARINDEX in SQL SERVER and for fetching the string before space, we will
use the SUBSTRING OR MID method.
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
SELECT MID(FullName, 1, LOCATE(' ',FullName))
FROM EmployeeDetails;
Ques.20. Write an SQL query to uppercase the name of the employee and
lowercase the city values.
Ans. We can use SQL Upper and Lower functions to achieve the intended
results.
Ques.21. Write an SQL query to find the count of the total occurrences of a
particular character – ‘n’ in the FullName field.
Ans. Here, we can use the ‘Length’ function. We can subtract the total length of
the FullName field from the length of the FullName after replacing the character
– ‘n’.
SELECT FullName,
LENGTH(FullName) - LENGTH(REPLACE(FullName, 'n', ''))
FROM EmployeeDetails;
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Ques.22. Write an SQL query to update the employee names by removing
leading and trailing spaces.
Ans. Using the ‘Update’ command with the ‘LTRIM’ and ‘RTRIM’ functions.
UPDATE EmployeeDetails
SET FullName = LTRIM(RTRIM(FullName));
Ques.23. Fetch all the employees who are not working on any project.
Ans. This is one of the very basic interview questions in which the interviewer
wants to see if the person knows about the commonly used – Is NULL operator.
SELECT EmpId
FROM EmployeeSalary
WHERE Project IS NULL;
SELECT FullName
FROM EmployeeDetails
WHERE EmpId IN
(SELECT EmpId FROM EmployeeSalary
WHERE Salary BETWEEN 5000 AND 10000);
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Ques.25. Write an SQL query to find the current date-time.
Ans. MySQL-
SELECT NOW();
SQL Server-
SELECT getdate();
Oracle-
Ques.26. Write an SQL query to fetch all the Employee details from the
EmployeeDetails table who joined in the Year 2020.
Ans. Using BETWEEN for the date range ’01-01-2020′ AND ’31-12-2020′-
Also, we can extract the year part from the joining date (using YEAR in MySQL)-
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
SELECT * FROM EmployeeDetails
WHERE YEAR(DateOfJoining) = '2020';
Ques.27. Write an SQL query to fetch all employee records from the
EmployeeDetails table who have a salary record in the EmployeeSalary
table.
Ans. Using ‘Exists’-
For project-wise count, we will be using the GROUP BY clause and for sorting,
we will use the ORDER BY clause on the alias of the project count.
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Ques.29. Write a query to fetch employee names and salary records.
Display the employee details even if the salary record is not present for
the employee.
Ans. This is again one of the very common interview questions in which the
interviewer just wants to check the basic knowledge of SQL JOINS.
Here, we can use the left join with the EmployeeDetail table on the left side of
the EmployeeSalary table.
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
“ For more questions on SQL Joins, you can also check our top
SQL Joins Interview Questions.
Here is a list of some of the most frequently asked SQL query interview
questions for experienced professionals. These questions cover SQL queries on
advanced SQL JOIN concepts, fetching duplicate rows, odd and even rows, nth
highest salary, etc.
Ques. 31. Write an SQL query to fetch all the Employees who are also
managers from the EmployeeDetails table.
Ans. Here, we have to use Self-Join as the requirement wants us to analyze the
EmployeeDetails table as two tables. We will use different aliases ‘E’ and ‘M’ for
the same EmployeeDetails table.
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
SELECT DISTINCT E.FullName
FROM EmployeeDetails E
INNER JOIN EmployeeDetails M
ON E.EmpID = M.ManagerID;
To learn more about Self Join along with some more queries, you can watch the
below video that explains the self-join concept in a very simple way.
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Ques.33. Write an SQL query to remove duplicates from a table without
using a temporary table.
Ans. Here, we can use delete with alias and inner join. We will check for the
equality of all the matching records and then remove the row with a higher
EmpId.
Ques.34. Write an SQL query to fetch only odd rows from the table.
Ans. In case we have an auto-increment field e.g. EmpId then we can simply
use the below query-
In case we don’t have such a field then we can use the below queries.
Using Row_number in SQL server and checking that the remainder when
divided by 2 is 1-
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
FROM EmployeeSalary
)E
WHERE E.RowNumber % 2 = 1;
SELECT *
FROM (
SELECT *, @rowNumber := @rowNumber+ 1 rn
FROM EmployeeSalary
JOIN (SELECT @rowNumber:= 0) r
)t
WHERE rn % 2 = 1;
Ques.35. Write an SQL query to fetch only even rows from the table.
Ans. In case we have an auto-increment field e.g. EmpId then we can simply
use the below query-
In case we don’t have such a field then we can use the below queries.
Using Row_number in SQL server and checking that the remainder, when
divided by 2, is 1-
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
)E
WHERE E.RowNumber % 2 = 0;
SELECT *
FROM (
SELECT *, @rowNumber := @rowNumber+ 1 rn
FROM EmployeeSalary
JOIN (SELECT @rowNumber:= 0) r
)t
WHERE rn % 2 = 0;
Ques.36. Write an SQL query to create a new table with data and structure
copied from another table.
Ans.
Ques.37. Write an SQL query to create an empty table with the same
structure as some other table.
Ans. Here, we can use the same query as above with the False ‘WHERE’
condition-
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Ques.38. Write an SQL query to fetch top n records.
Ans. In MySQL using LIMIT-
SELECT *
FROM EmployeeSalary
ORDER BY Salary DESC LIMIT N;
SELECT TOP N *
FROM EmployeeSalary
ORDER BY Salary DESC;
Ques.39. Write an SQL query to find the nth highest salary from a table.
Ans. Using Top keyword (SQL Server)-
SELECT Salary
FROM Employee
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
ORDER BY Salary DESC LIMIT N-1,1;
Ques.40. Write SQL query to find the 3rd highest salary from a table
without using the TOP/limit keyword.
Ans. This is one of the most commonly asked interview questions. For this, we
will use a correlated subquery.
In order to find the 3rd highest salary, we will find the salary value until the inner
query returns a count of 2 rows having the salary greater than other distinct
salaries.
SELECT Salary
FROM EmployeeSalary Emp1
WHERE 2 = (
SELECT COUNT( DISTINCT ( Emp2.Salary ) )
FROM EmployeeSalary Emp2
WHERE Emp2.Salary > Emp1.Salary
)
SELECT Salary
FROM EmployeeSalary Emp1
WHERE N-1 = (
SELECT COUNT( DISTINCT ( Emp2.Salary ) )
FROM EmployeeSalary Emp2
WHERE Emp2.Salary > Emp1.Salary
)
This concludes our post on frequently asked SQL query interview questions
and answers. I hope you practice these questions and ace your database
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
interviews.
If you feel, we have missed any of the common interview questions on SQL
then do let us know in the comments and we will add those questions to our list.
Kuldeep Rana
Kuldeep is the founder and lead author of ArtOfTesting. He is skilled in
test automation, performance testing, big data, and CI-CD. He brings
his decade of experience to his current role where he is dedicated to
educating the QA professionals. You can connect with him on LinkedIn.
Interview, SQL
Alex levenson
December 27, 2019 at 5:57 pm
Reply
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
havilapersis
December 30, 2022 at 10:38 pm
Reply
Paula
January 14, 2020 at 3:21 pm
Reply
Kuldeep Rana
January 20, 2020 at 3:35 pm
Hi Geet, thanks for pointing out, please let us know, what you find wrong
in this query.
Reply
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
RAMESH MAHATO
February 14, 2020 at 12:03 pm
Reply
Kuldeep Rana
February 14, 2020 at 12:09 pm
Reply
shraddha upadhyay
April 17, 2020 at 7:46 pm
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
and anyone sugest me the most asking sql queries in mnc
Reply
Snehasish Choudhury
September 23, 2020 at 1:01 pm
SELECT TOP 1 *
FROM (SELECT TOP 2 * FROM Table1 ORDER BY RowID DESC) X
ORDER BY RowID
Reply
Arpit
July 24, 2021 at 2:26 pm
Reply
Srinivas
July 12, 2022 at 11:43 am
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
with cte as
(
select *,ROW_NUMBER() over(order by id desc) as rownum
from Employee1
)
select *
from cte where rownum =2
Reply
Shravanthikumar
September 20, 2022 at 5:33 pm
Movie table
Creat table ” movie ” {
“id” int(110 not null default ‘0’,
“name” varchar(100)default null,
“year” int(11) default null,
” rank” flaot default null,
primary key (” id”)
Considering the above table how many movies does the dataset have
for the year 1982 ! write ur query below
Reply
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Pankaj Chettri
September 28, 2022 at 5:57 pm
SELECT COUNT(*)
FROM movie
WHERE year = 1982
Reply
shreyansh
September 12, 2022 at 7:29 pm
In MySQL
Reply
Aishwarya
October 14, 2022 at 1:35 am
In Question no. 39
Put N=2 and
ORDER BY asc
You will get second lowest salary
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Reply
sunil
December 6, 2022 at 1:23 pm
Reply
havilapersis
December 30, 2022 at 10:41 pm
with ctek
as
(
select*row_number() over(order by id desc) as rowno from emp
)
select*from ctek
where rowno=2
select*from emp
Reply
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Amit
May 10, 2020 at 6:59 pm
Very good
Reply
amit singh
October 15, 2020 at 6:29 pm
Reply
Kuldeep Rana
October 15, 2020 at 6:43 pm
Reply
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Shravanthikumar
September 20, 2022 at 5:32 pm
Movie table
Creat table ” movie ” {
“id” int(110 not null default ‘0’,
“name” varchar(100)default null,
“year” int(11) default null,
” rank” flaot default null,
primary key (” id”)
Considering the above table how many movies does the dataset have
for the year 1982 ! write ur query below
Reply
Hi Kuldeep,
Appreciate your efforts…
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Reply
Kuldeep Rana
October 31, 2020 at 3:07 pm
Hi Mithilesh,
Reply
Darlene
February 27, 2022 at 4:23 am
Reply
April Drake
September 30, 2021 at 1:05 am
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
This confused me too
Reply
Phil
February 12, 2021 at 4:21 am
Hi Kuldeep,
Great and fun article! A word of warning about the first answer to
question 26. Not sure about SQL Server, but definitely in Oracle using
BETWEEN with dates could get you in trouble. In “BETWEEN
‘2020/01/01’AND ‘2020/12/31′”, those dates are interpreted with a
timestamp of 00:00. So with the latter date, it’ll only retrieve those hired
until 2020/12/30 (or 2020/12/31 at exactly 00:00), and it would miss
anyone hired after 00:00 on 2020/12/31 (so a person hired at 09:00 on
12/31 would be missed. Plus there are lots of additional complexities
with doing something like BETWEEN ‘2020/01/01’AND ‘2020/12/31
23:59:59’. So in my experience, to get everyone hired in 2020, you’re
better off using:
AND dateOfJoining >= ‘2020/01/01’
AND dateOfJoining < '2021/01/01'
…or just use the extract function like in your second answer 🙂
Reply
Kuldeep Rana
February 12, 2021 at 12:14 pm
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Thanks a lot, Phil.
Reply
Roshan Pandey
March 6, 2021 at 7:20 am
Thanks for it
Reply
Aruna
March 9, 2021 at 5:10 pm
Reply
Prakarsh Tiwari
May 2, 2021 at 1:46 am
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
WHERE Emp2.Salary > Emp1.Salary
SELECT Salary
FROM EmployeeSalary Emp1
WHERE 2 = (
SELECT COUNT( DISTINCT ( Emp2.Salary ) )
FROM EmployeeSalary Emp2
WHERE Emp2.Salary > Emp1.Salary
)
Reply
Pankaj Chettri
September 28, 2022 at 6:03 pm
Reply
Nagraj Panchal
May 16, 2021 at 6:32 pm
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
For nth highest salary- SQL Server
SELECT Salary
FROM EmployeeSalary Emp1
WHERE N-1 = (
SELECT COUNT( DISTINCT ( Emp2.Salary ) )
FROM EmployeeSalary Emp2
WHERE Emp2.Salary > Emp1.Salary
)
Reply
Kuldeep Rana
May 17, 2021 at 2:31 pm
You don’t have to directly use ‘n’. You need to replace ‘n’ with a
number e.g. if you want to find the 3rd highest salary, n would be 3.
Reply
Roopa
May 25, 2021 at 7:42 am
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
For nth highest salary,
Select Salary
From EmployeeSalary
Order By `Salary` Desc limit n-1,1;
Select Salary
From EmployeeSalary
Order By `Salary` Desc limit 2,1;
Reply
Vishal Bhadauria
June 17, 2021 at 2:07 am
But by this query, list will be printed from 3rd to minimum. Right ?
Reply
Tapas Das
September 29, 2021 at 1:23 pm
Try this:
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Reply
Deneen Curling
May 28, 2021 at 7:18 am
Reply
Kunal
May 29, 2021 at 5:19 pm
Hi Kuldeep,
Really useful and on point article, Great help at interviews. Thanks
Reply
Shanky rajput
June 9, 2021 at 1:34 pm
Hi, Can you please provide me the Create query for the above table and
also provide me the create a query of ManagerSalary with insert data.
Reply
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Rahul
June 19, 2021 at 8:04 pm
Hi kuldeep, Thanks for the effort you put in creating this blog. It’s very
nice.
I just want to add one more sql query problem which i was asked in my
Oracle Interview.
Reply
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Kuldeep Rana
June 21, 2021 at 10:27 pm
Thanks a lot, Rahul. These types of questions will definitely help other
readers. Keep contributing :-).
Reply
Akashdeep Kashyap
November 3, 2021 at 12:13 am
Reply
Vidya
July 28, 2021 at 12:59 pm
Display list of employee having first name David or Diana without using
like, in and or operater.please answer
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Reply
Suryakant Maharana
October 2, 2021 at 3:06 pm
Thanks kuldeep for such a good article and sharing valuable sql
questions and answers which will help a lot for interview
preparation.Hats off you.
Reply
Jeremiah
October 11, 2021 at 4:26 am
Reply
Richa yadav
October 16, 2021 at 12:53 pm
Reply
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Richa yadav
October 16, 2021 at 12:43 pm
hi kuldeep sir,
In my pc SQL does not support TOP keyword but it support LIMIT
keyword. rest of the queries is nicely understandable.
Reply
rohit
October 23, 2021 at 7:30 pm
Reply
sam
January 4, 2022 at 7:36 pm
Hi All,
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Question1:-
transaction table has 5 columns (transaction_id, customer_id,
transation_date, product_id, transaction_amount)
Question2:-
transaction table has 5 columns (transaction_id, customer_id,
transation_date, product_id, transaction_amount)
product table has 2 columns (product_id, product_name)
write query to list all the product which are never sold
write query to list all the product which are most sold
Question3:-
transaction table has 5 columns (transaction_id, customer_id,
transation_date, product_id, transaction_amount)
product table has 2 columns (product_id, product_name)
Write query to fetch customer id, first transaction date, last transaction
date, the difference in transaction amount, and difference in transaction
date
Thanks
Reply
Pooja
April 19, 2022 at 9:29 pm
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Reply
Gayathri
June 29, 2022 at 7:49 pm
Reply
Reply
Pavan kumar
September 5, 2022 at 2:45 pm
Reply
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com
Gopi
September 15, 2022 at 3:41 pm
Reply
Mehar
December 6, 2022 at 6:32 pm
Reply
Convert web pages and HTML files to PDF in your applications with the Pdfcrowd HTML to PDF API Printed with Pdfcrowd.com