This set of RDBMS Interview Questions and Answers focuses on “Modification of Database”.
1. Insert the appropriate key word in the blank in the query ( A is a relation)
delete ______ A
where P < 5;
Explanation: the from key word is specified beside delete clause to indicate the relation from which the tuple needs to be deleted.
2. How many relations can a delete command operate on?
d) Infinitely many
Explanation: The delete command can operate only on one relation. You cannot give commands like delete R1, R2.
3. What is the result of the following query?
DELETE FROM student WHERE marks < (SELECT avg(marks) FROM student);
a) The query deletes all the tuples whose marks are greater than the average marks
b) The query deletes all the tuples whose marks are less than the average marks
c) The query deletes all the values under the marks attribute which are less than the average
d) The query is syntactically wrong and does not execute
Explanation: The query deletes all the tuples from the student relation as per the condition specified in the where clause i.e. wherever the marks are less than average marks.
4. What is the format of entering date into a database while inserting data into it?
Explanation: The correct format for entering date into the database while inserting data is
5. Choose the correct option regarding the following query
INSERT INTO course ('CS-67' , 'course name', 'any' , 5);
a) Data is inserted into the course relation
b) Data is not inserted into the course relation due to incorrect specification
c) Data is inserted into the CS-67 relation
d) Data is not inserted due to the incorrect use of syntax
Explanation: Data is not inserted because, the proper syntax is
insert into <relation name> values (<data>);
6. To change a value in a tuple without changing all the values in the tuple, we use the _____ statement
b) insert some
Explanation: To change a value in a tuple without changing the entire values in the tuple, we use the update statement. Eg: update employee set salary = salary*1.5;
7. What does the following query do?
UPDATE student SET marks = marks*1.10;
a) It increases the marks of all the students by 10%
b) It decreases the marks of all the students by 90%
c) It increases the marks of all the students by 110%
d) It is syntactically wrong
Explanation: The update clause is used to edit a specific value in the tuple. The set command is used to set the value of an attribute in a tuple.
8. State true or false: We cannot write a where clause under an update command
Explanation: Writing a where clause under the update statement enables us to specify a condition for the selection of tuples whose values need to be updated.
9. Scalar Subqueries can be used in the SQL update statement when they are used under the ____ clause
Explanation: SQL subqueries that can occur wherever a value is permitted provided the subquery gives only one tuple with a single attribute are called Scalar subqueries. Scalar Subqueries can be used in the SQL update statement when they are used under the set clause.
10. Which of the following cannot be used to modify the data in a database
Explanation: The drop keyword is used to delete the entire relation leaving no trace of it in the memory. Thus it cannot be used to edit the data in the relation.
Sanfoundry Global Education & Learning Series – RDBMS.
To practice all areas of RDBMS for Interviews, here is complete set of 1000+ Multiple Choice Questions and Answers.