0% found this document useful (0 votes)
47 views

SQL Server Interview Questions and Answers For Freshers - Sanfoundry

This document provides 10 questions and answers related to basic SQL concepts. The questions cover topics like SQL commands for transactions, queries using WHERE, ORDER BY, BETWEEN, IN and NOT IN clauses, subqueries, and deleting rows from a table. Correct answers are provided along with explanations for each question. The purpose is to help SQL Server interview preparation for freshers.

Uploaded by

Samiksha
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

SQL Server Interview Questions and Answers For Freshers - Sanfoundry

This document provides 10 questions and answers related to basic SQL concepts. The questions cover topics like SQL commands for transactions, queries using WHERE, ORDER BY, BETWEEN, IN and NOT IN clauses, subqueries, and deleting rows from a table. Correct answers are provided along with explanations for each question. The purpose is to help SQL Server interview preparation for freshers.

Uploaded by

Samiksha
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

1/30/24, 2:36 PM SQL Server Interview Questions and Answers for Freshers - Sanfoundry

SQL Server Questions and Answers – Basic SQL –


3
This set of SQL Server Inteview Questions and Answers for freshers focuses on “Basic SQL – 3”.

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.

3. SQL query to find all the cities whose humidity is 95.


a) SELECT city WHERE humidity = 95
b) SELECT city FROM weather WHERE humidity = 95
c) SELECT humidity = 89 FROM weather
d) SELECT city FROM weather
View Answer
Enabling comfortable living
Answer: b
Explanation: The SQL WHERE clause is used to filter the results and apply conditions in a SELECT,
https://www.sanfoundry.com/sqlserver-interview-questions-answers-freshers/ 1/7
1/30/24, 2:36 PM SQL Server Interview Questions and Answers for Freshers - Sanfoundry

INSERT, UPDATE, or DELETE statement.


SPONSORED BY MITSUBISHI ELECTRIC Learn More

advertisement

4. SQL query to find the temperature in increasing order of all cities.


a) SELECT city FROM weather ORDER BY temperature
b) SELECT city, temperature FROM weather
c) SELECT city, temperature FROM weather ORDER BY temperature
d) SELECT city, temperature FROM weather ORDER BY city
View Answer

Answer: d
Explanation: The ORDER BY keyword sorts the records in ascending order by default.

5. What is the meaning of LIKE ‘%0%0%’?


a) Feature begins with two 0’s
b) Feature ends with two 0’s
c) Feature has more than two 0’s
d) Feature has two 0’s in it, at any position
View Answer

Answer: d
Explanation: The LIKE operator is used in a WHERE clause to search for a specified pattern in a
column.

Subscribe Now: SQL Server Newsletter | Important Subjects Newsletters

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

8. Find all the tuples having a temperature greater than ‘Paris’.


a) SELECT * FROM weather WHERE temperature > (SELECT temperature FROM weather WHERE city
= ‘Paris’
b) SELECT * FROM weather WHERE temperature > (SELECT * FROM weather WHERE city = ‘Paris’)
c) SELECT * FROM weather WHERE temperature > (SELECT city FROM weather WHERE city = ‘Paris’)
d) SELECT * FROM weather WHERE temperature > ‘Paris’ temperature
View Answer

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

10. The command to remove rows from a table ‘CUSTOMER’ is __________________


a) DROP FROM CUSTOMER
b) UPDATE FROM CUSTOMER
c) REMOVE FROM CUSTOMER
https://www.sanfoundry.com/sqlserver-interview-questions-answers-freshers/ 4/7
1/30/24, 2:36 PM SQL Server Interview Questions and Answers for Freshers - Sanfoundry

d) DELETE FROM CUSTOMER WHERE


View Answer

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.

Sanfoundry Global Education & Learning Series – SQL Server.

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:

Apply for SQL Server Internship


Check SQL Server Books
Check Information Technology Books
Apply for Programming Internship
Practice Programming MCQs

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

1. SQL Server Questions and Answers – Transaction – 1


2. SQL Server Questions and Answers – Transaction – 2
3. SQL Server Questions and Answers – Modifying Data – 2
4. Database Questions and Answers – Transactions
5. SQL Server Questions and Answers – Basic SQL – 1
6. MySQL Questions and Answers – Performing Transactions
7. SQL Server Questions and Answers – SQL Audit
8. SQL Server Questions and Answers – Basic SQL – 2
9. SQL Server Questions and Answers – Bulk Operations
10. SQL Server Questions and Answers – Error Handling

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

Basic Civil Engineering MCQ Questions


Basic Electrical Engineering MCQ Questions
C Programming Examples
Database Management System MCQ Questions

Subscribe: SQL Server Newsletter

Name

Email

Subscribe

Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to


get free Certificate of Merit. Join our social networks below and stay updated with latest contests,
videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest

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.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram


SanfoundryClasses.

About | Certifications | Internships | Jobs | Privacy Policy | Terms | Copyright | Contact

     

© 2011-2024 Sanfoundry. All Rights Reserved.

https://www.sanfoundry.com/sqlserver-interview-questions-answers-freshers/ 7/7

You might also like