SQL Server Questions and Answers For Freshers - Sanfoundry
SQL Server Questions and Answers For Freshers - Sanfoundry
2. With SQL, how do you select all the records from a table named “Persons” where the value of the
column “FirstName” ends with an “a”?
a) SELECT * FROM Persons WHERE FirstName=’a’
b) SELECT * FROM Persons WHERE FirstName LIKE ‘a%’
c) SELECT * FROM Persons WHERE FirstName LIKE ‘%a’
d) SELECT * FROM Persons WHERE FirstName=’%a%’
View Answer
Answer: c
Explanation: The SQL LIKE clause is used to compare a value to similar values using wildcard
operators.
3. With SQL, how can you return all the records from a table named “Persons” sorted descending by
“FirstName”?
a) SELECT * FROM Persons SORT BY ‘FirstName’ DESC
b) SELECT * FROM Persons ORDER FirstName DESC
c) SELECT * FROM Persons SORT ‘FirstName’ DESC
d) SELECT * FROM Persons ORDER BY FirstName DESC
View Answer
Answer: d
Mitsubishi
Explanation: The SQL SELECT Electric
statement queries data from tables in the database.READ MORE
sponsored by: Mitsubishi Electric
https://www.sanfoundry.com/sqlserver-questions-answers-freshers/ 1/7
1/30/24, 1:25 PM SQL Server Questions and Answers for Freshers - Sanfoundry
advertisement
4. With SQL, how can you return the number of not null records in the “Persons” table?
a) SELECT COUNT() FROM Persons
b) SELECT COLUMNS() FROM Persons
c) SELECT COLUMNS(*) FROM Persons
d) SELECT COUNT(*) FROM Persons
View Answer
Answer: a
Explanation: COUNT(column_name) is used to count the number of rows of a table where column
name is a column that does not allow NULL values.
Answer: a
Explanation: The ALTER TABLE statement is used to add, delete, or modify columns.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!
Answer: b
Explanation: The SQL UPDATE Query is used to modify the existing records in a table. You can use
WHERE clause with UPDATE query to update selected rows otherwise all the rows would be
affected.
Answer: a
Explanation: The SQL UNION operator is used to combine the result sets of 2 or more SELECT
statements. It removes duplicate rows between the various SELECT statements.
advertisement
https://www.sanfoundry.com/sqlserver-questions-answers-freshers/ 3/7
1/30/24, 1:25 PM SQL Server Questions and Answers for Freshers - Sanfoundry
Answer: c
Explanation: The SELECT DISTINCT statement is used to return only distinct (different) values.
Answer: a
Explanation: The ORDER BY keyword sorts the records in ascending order by default.
advertisement
10. How can you change “Hansen” into “Nilsen” in the “LastName” column in the Persons table?
a) UPDATE Persons SET LastName=’Hansen’ INTO LastName=’Nilsen’
b) MODIFY Persons SET LastName=’Nilsen’ WHERE LastName=’Hansen’
c) MODIFY Persons SET LastName=’Hansen’ INTO LastName=’Nilsen’
d) UPDATE Persons SET LastName=’Nilsen’ WHERE LastName=’Hansen’
View Answer
Answer: d
Explanation: In its simplest form, the syntax for the UPDATE statement when updating one table
is:UPDATE table SET column1 = expression1,column2 = expression2,… WHERE conditions.
To practice all areas of SQL Server for Freshers, here is complete set of 1000+ Multiple Choice
Questions and Answers.
https://www.sanfoundry.com/sqlserver-questions-answers-freshers/ 4/7
1/30/24, 1:25 PM SQL Server Questions and Answers for Freshers - Sanfoundry
« Prev - SQL Server Questions and Answers – » Next - SQL Server Questions and Answers –
Basic SQL – 1 Basic SQL – 3
Related Posts:
advertisement
Recommended Articles:
1. SQL Server Questions and Answers – Basic SQL – 1
2. SQL Server Questions and Answers – Basic SQL – 3
3. SQL Server Questions and Answers – Modifying Data – 2
4. SQL Server Questions and Answers – DML Triggers
5. SQL Server Questions and Answers – Access With Sql Server
6. SQL Server Questions and Answers – Windowing
7. SQL Server Questions and Answers – Reporting Services – 2
8. SQL Server Questions and Answers – SQL Audit
9. SQL Server Questions and Answers – User Defined Functions – 1
10. SQL Server Questions and Answers – Bulk Operations
https://www.sanfoundry.com/sqlserver-questions-answers-freshers/ 5/7
1/30/24, 1:25 PM SQL Server Questions and Answers for Freshers - Sanfoundry
advertisement
Additional Resources:
SQL Server MCQ Questions
Visual Basic MCQ Questions
LISP MCQ Questions
Oracle Database MCQ Questions
Basic Chemical Engineering MCQ Questions
Popular Pages:
Basic Civil Engineering MCQ Questions
Automata Theory MCQ Questions
Vector Biology and Gene Manipulation MCQ Questions
C# Programs on LINQ
Basic Electrical Engineering MCQ Questions
https://www.sanfoundry.com/sqlserver-questions-answers-freshers/ 6/7
1/30/24, 1:25 PM SQL Server 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-questions-answers-freshers/ 7/7