SQL Query Interview Questions
SQL Query Interview Questions
Questions
Created By:
1
Copyright pTutorial All Rights Reserved
These SQL queries interview questions are important for fresher and experienced
programmer also.
2. Create a table with four field rollNo, name, city, marks in appropriate
datatype.
CREATE TABLE student
(
rollNo INT,
2
Copyright pTutorial All Rights Reserved
3
Copyright pTutorial All Rights Reserved
7. Fetch the rollNo using alias name ID from the student table.
SELECT rollNo ID FROM student;
SELECT rollNo AS StudentID FROM student;
4
Copyright pTutorial All Rights Reserved
11. Count the total number of entries or total number of student in student
table using alias name TotalStudent.
SELECT COUNT(*) AS TotalStudent FROM student;
12. Count the total number of unique city from student table using alias name
UniqueCity.
SELECT COUNT(DISTINCT city) AS UniqueCity FROM student;
5
Copyright pTutorial All Rights Reserved
13. Fetch name of student from student table after removing white spaces (left
and right) .
SELECT TRIM(NAME) FROM student;
14. Fetch the name of student and the length of name as length from student
table
SELECT NAME,LENGTH(NAME) FROM student;
6
Copyright pTutorial All Rights Reserved
If you ever think SQL queries is not explained clearly or think we should add a
specific SQL Query suggest me at [email protected]. We will add this as soon as
possible for better experience.
7
Copyright pTutorial All Rights Reserved