This set of RDBMS Multiple Choice Questions & Answers (MCQs) 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;
a) all
b) from
c) with
d) in
View Answer
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?
a) 0
b) 1
c) 2
d) Infinitely many
View Answer
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
View Answer
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?
a) YYYY-MM-DD
b) “YYYY-MM-DD”
c) ‘YYYY-MM-DD’
d) “DD-MM-YYYY”
View Answer
Explanation: The correct format for entering date into the database while inserting data is
‘YYYY-MM-DD’.
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
View Answer
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
a) insert
b) insert some
c) update
d) alter
View Answer
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
View Answer
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
a) True
b) False
View Answer
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
a) where
b) with
c) set
d) end
View Answer
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
a) update
b) insert
c) delete
d) drop
View Answer
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, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Practice Computer Science MCQs
- Check Computer Science Books
- Check RDBMS Books
- Apply for Computer Science Internship