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;
Explanation:Table name should not start with numerical value as per naming convention in T-SQL.
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;
Select name,course_id from teaches,instructor where instructor_id=course_id;
Select name, course_id from instructor natural join teaches;
Select name ,course_id from instructor;
Select course_id from instructor join teaches;View Answer
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
d) All the field of employee relation
Explanation:Here * is used to select all the fields of the relation.
4. Which of the following statements contains an error?
Select * from emp where empid = 10003;
Select empid from emp where empid = 10006;
c) Select empid from emp;
Select empid where empid = 1009 and lastname = ‘GELLER’;View Answer
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 ?
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
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
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:
Explanation:Backup is required to protect the data.
9. _______________ joins are SQL server default
d) None of the Mentioned
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
Explanation:ALTER Statement will alter the database structure and its related functionalities.
Sanfoundry Global Education & Learning Series – SQL Server.