SQL Server Questions and Answers – Modifying Data – 1

This set of SQL Server Multiple Choice Questions & Answers (MCQs) focuses on “Modifying Data – 1”.

1. The query given below will give an error. Which one of the following has to be replaced to get the desired output?

SELECT ID, name FROM 1_Order WHERE instructor=1;

a) _Order
b) 2Order
c) 3Order
d) Instructor
View Answer

Answer: a
Explanation: Table name should not start with numerical value as per naming convention in T-SQL.
advertisement
advertisement

2. The following query can be replaced by which one of the following?

SELECT name, course_id
FROM instructor, teaches
WHERE instructor_ID= teaches_ID;

a)

Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!
SELECT name,course_id 
FROM teaches,instructor
WHERE instructor_id=course_id;

b)

advertisement
SELECT name, course_id 
FROM instructor NATURAL JOIN teaches;

c)

advertisement
SELECT name ,course_id 
FROM instructor;

d)

SELECT course_id 
FROM instructor JOIN teaches;
View Answer
Answer: b
Explanation: Join clause joins two tables by matching the common column.
 
 

3. Select * from employee where salary>10000 and dept_id=101;
Which of the following fields are displayed as output?
a) Salary, dept_id
b) Employee
c) Salary
d) All the field of employee relation
View Answer

Answer: d
Explanation: Here * is used to select all the fields of the relation.

4. Which of the following statements contains an error?
a)

SELECT * FROM emp 
WHERE empid = 10003;

b)

SELECT empid 
FROM emp 
WHERE empid = 10006;

c) Select empid from emp;
d)

SELECT empid 
WHERE empid = 1009 AND lastname = ‘GELLER’;
View Answer
Answer: d
Explanation: This query do not have from clause which specifies the relation from which the values has to be selected.
 
 

5. Insert into employee _________ (1002,Joey,2000);
In the given query which of the keyword has to be inserted?
a) Table
b) Values
c) Relation
d) Field
View Answer

Answer: b
Explanation: Value keyword has to be used to insert the values into the table.

6. To delete a database ___________ command is used.
a) Delete database database_name
b) Delete database_name
c) drop database database_name
d) drop database_name
View Answer

Answer: c
Explanation: This will delete the database with its structure.

7. The ________________ is essentially used to search for patterns in target string.
a) Like Predicate
b) Null Predicate
c) In Predicate
d) Out Predicate
View Answer

Answer: a
Explanation: Like matches the pattern with the query.

8. Which is a duplicate copy of a file program that is stored on a different storage media than the original location?
a) Concurrency
b) Deadlock
c) Backup
d) Recovery
View Answer

Answer: c
Explanation: Backup is required to protect the data.

9. _______________ joins are SQL server default.
a) Outer
b) Inner
c) Equi
d) None of the Mentioned
View Answer

Answer: b
Explanation: Inner query joins only the rows that are matching.

10. To alter a database ___________ command is used.
a) ALTER database database_name
b) ALTER database_name
c) ALTER database database_name
d) ALTER database_name
View Answer

Answer: c
Explanation: ALTER Statement will alter the database structure and its related functionalities.

Sanfoundry Global Education & Learning Series – SQL Server.

To practice all areas of SQL Server, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
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 - Founder & CTO at Sanfoundry
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.