SQL Server Interview Questions and Answers For Freshers - Sanfoundry
SQL Server Interview Questions and Answers For Freshers - Sanfoundry
1. Which of the following command makes the updates performed by the transaction permanent in
the database?
a) ROLLBACK
b) COMMIT
c) TRUNCATE
d) DELETE
View Answer
Answer: b
Explanation: Commit command is used to permanently save any transaction into the database.
2. Which TCL command undo all the updates performed by the SQL in the transaction?
a) ROLLBACK
b) COMMIT
c) TRUNCATE
d) DELETE
View Answer
Answer: b
Explanation: Rollback is used for undoing the work done in the current transaction. This
command also releases the locks if any hold by the current transaction.
advertisement
Answer: d
Explanation: The ORDER BY keyword sorts the records in ascending order by default.
Answer: d
Explanation: The LIKE operator is used in a WHERE clause to search for a specified pattern in a
column.
https://www.sanfoundry.com/sqlserver-interview-questions-answers-freshers/ 2/7
1/30/24, 2:36 PM SQL Server Interview Questions and Answers for Freshers - Sanfoundry
6. Find the names of these cities with temperature and condition whose condition is neither sunny
nor cloudy.
a) SELECT city, temperature, condition FROM weather WHERE condition NOT IN (‘sunny’, ‘cloudy’)
b) SELECT city, temperature, condition FROM weather WHERE condition NOT BETWEEN (‘sunny’,
‘cloudy’)
c) SELECT city, temperature, condition FROM weather WHERE condition IN (‘sunny’, ‘cloudy’)
d) SELECT city, temperature, condition FROM weather WHERE condition BETWEEN (‘sunny’, ‘cloudy’);
View Answer
Answer: a
Explanation: The IN operator allows you to specify multiple values in a WHERE clause.
7. Find the name of those cities with temperature and condition whose condition is either sunny or
cloudy but temperature must be greater than 70.
a) SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition =
‘cloudy’ OR temperature > 70
b) SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition =
‘cloudy’ OR temperature > 70
c) SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition =
‘cloudy’ AND temperature > 70
d) SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition =
‘cloudy’ AND temperature > 70
View Answer
Answer: c
Explanation: The AND operator displays a record if both the first condition AND the second
condition are true. The OR operator displays a record if either the first condition OR the second
condition is true.
advertisement
https://www.sanfoundry.com/sqlserver-interview-questions-answers-freshers/ 3/7
1/30/24, 2:36 PM SQL Server Interview Questions and Answers for Freshers - Sanfoundry
Answer: a
Explanation: Subquery—also referred to as an inner query or inner select—is a SELECT statement
embedded within a data manipulation language (DML) statement or nested within another
subquery.
9. Find all the cities with temperature, condition and humidity whose humidity is in the range of 63
to 79.
a) SELECT * FROM weather WHERE humidity IN (63 to 79)
b) SELECT * FROM weather WHERE humidity NOT IN (63 AND 79)
c) SELECT * FROM weather WHERE humidity BETWEEN 63 AND 79
d) SELECT * FROM weather WHERE humidity NOT BETWEEN 63 AND 79
View Answer
Answer: c
Explanation: The BETWEEN operator is used to select values within a range.
advertisement
Answer: d
Explanation: The SQL DELETE Query is used to delete the existing records from a table. You can
use WHERE clause with the DELETE query to delete selected rows.
To practice all areas of SQL Server for freshers attending interviews, here is complete set of 1000+
Multiple Choice Questions and Answers.
« Prev - SQL Server Questions and Answers – » Next - SQL Server Questions and Answers –
Basic SQL – 2 Joins
Related Posts:
advertisement
Recommended Articles:
https://www.sanfoundry.com/sqlserver-interview-questions-answers-freshers/ 5/7
1/30/24, 2:36 PM SQL Server Interview Questions and Answers for Freshers - Sanfoundry
advertisement
Additional Resources:
SQL Server MCQ Questions
Visual Basic MCQ Questions
Basic Chemical Engineering MCQ Questions
C Programs on File Handling
Oracle Database MCQ Questions
Popular Pages:
RDBMS MCQ Questions
https://www.sanfoundry.com/sqlserver-interview-questions-answers-freshers/ 6/7
1/30/24, 2:36 PM SQL Server Interview Questions and Answers for Freshers - Sanfoundry
Name
Subscribe
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is
Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on
development of Linux Kernel, SAN Technologies, Advanced C, Data
Structures & Alogrithms. Stay connected with him at LinkedIn.
https://www.sanfoundry.com/sqlserver-interview-questions-answers-freshers/ 7/7