Database Management System Nptel Assignment 2 Answers
Are you looking for the Nptel Database Management System Assignment 2 Answers 2025 (Jan-Apr 2025 )? You’ve come to the right place! Our detailed and accurate solutions are designed to assist you in mastering the concepts of DBMS, including SQL queries, database design, normalization, and more.
Course Link: Click Here
Nptel Database Management System Assignment 2 Answers( Jan-Apr 2025)
- What is the correct SQL query to update the Quantity values in the OrderDetails table where the current values are greater than 2?
- a) MODIFY OrderDetails where Quantity>2;
- b) UPDATE OrderDetails set Quantity=Quantity-1 where Quantity>2;
- c) UPDATE OrderDetails where Quantity>2;
- d) ALTER OrderDetails set Quantity=Quantity-1 where Quantity>2;
- What is the output of the following SQL query for a bookstore system?
SELECT Category, SUM(Quantity) FROM OrderDetails, BookDetails WHERE OrderDetails.BookID = BookDetails.BookID GROUP BY Category;
- a) Fiction: 5, Science: 7
- b) Fiction: 6, Science: 7
- c) Fiction: 9, Science: 7
- d) Fiction: 5, Science: 6
View Answer
- What is the correct SQL statement to create a VIEW for retrieving Name and Price of all products in the ‘Electronics’ category from the ProductDetails table?
- a) Create Electronics_Products AS SELECT Name, Price FROM ProductDetails WHERE Category = ‘Electronics’;
- b) Create view Electronics_Products AS SELECT Name, Price FROM ProductDetails WHERE Category = ‘Electronics’;
- c) Create view Electronics_Products ON ProductDetails SELECT Name, Price WHERE Category = ‘Electronics’;
- d) Create view Electronics_Products TO ProductDetails SELECT Name, Price WHERE Category = ‘Electronics’;
View Answer
- Which of the following options will be present in the output of the SQL query for the DriverDetails table?
SELECT Location FROM DriverDetails WHERE Location LIKE 'B%' AND Location LIKE 'B%';
- a) Bangalore
- b) Bhopal
- c) Pune
- d) Hyderabad
View Answer
- Which relational algebra operation will generate the given output?
- a) OrderDetails NATURAL JOIN ProductDetails
- b) OrderDetails LEFT OUTER JOIN ProductDetails
- c) OrderDetails RIGHT OUTER JOIN ProductDetails
- d) OrderDetails EQUI JOIN ProductDetails ON OrderDetails.ProductID = ProductDetails.ProductID
View Answer
- Which of the following statements is incorrect?
- a) The INSERT command is used to remove/modify rows in a relation.
- b) The UPDATE command is used to modify data (values in rows) of a relation.
- c) The DELETE command is used to remove all data from a relation.
- d) The DELETE command is used to remove a relation entirely.
View Answer
- What will be the output of the following SQL query on the DriverDetails table?
- What will be the output of the following SQL query on the DriverDetails table?
- What will be the output of the following SQL query on the DriverDetails table?
SELECT * FROM DriverDetails WHERE City IN ('New York', 'Chicago');
- a) DriverID: D001, D003, D004, D006, D007
- b) DriverID: D002, D005
- c) DriverID: D001, D002, D003
- d) DriverID: D005, D008
- What is the correct SQL statement to find the DriverID, Name, and City of drivers with an Age between 25 and 35?
- a) SELECT DriverID, Name, City FROM DriverDetails WHERE Age AS (26, 35);
- b) SELECT DriverID, Name, City FROM DriverDetails WHERE Age IN (25, 35);
- c) SELECT DriverID, Name, City FROM DriverDetails WHERE Age BETWEEN 25 AND 35;
- d) SELECT DriverID, Name, City FROM DriverDetails WHERE Age BETWEEN (25, 35);
Nptel Database Management System Assignment 2 Answers
Session: JUL-DEC 2024
Q1. In a particular messenger application, the instance of Chat Details is as follows:
For the instance, the Total_Text values need to be updated to increase by 500 for those entries whose current values are less than 1000. What is the correct SQL Query for updating the current instance?
a) MODIFY ChatDetails Total_Text=Total_Text+500 where Total_Text<1000;
b) UPDATE ChatDetails set Total_Text=Total_Text+500 where Total_Text<1000;
c) UPDATE ChatDetails Total_Text=Total_Text+500 where Total_Text<1000;
d) ALTER ChatDetails set Total_Text=Total_Text+500 where Total_Text<1000;
Answer: b) UPDATE ChatDetails set Total_Text=Total_Text+500 where Total_Text<1000;
Q2. In a particular messenger application, the instances of ChatDetails and UserDetails are as follows:
What is the output of the following SQL Query?
SELECT COUNT(Address) FROM ChatDetails, UserDetails GROUP BY Address;
a) 4
3
b) 4
8
c) 4
d) 3
Answer: b) 4
8
For answers or latest updates join our telegram channel: Click here to join
These are Nptel Database Management System Assignment 2 Answers
Q3. In a particular messenger application, the instance of UserDetails is as follows:
Which of the options will not be present in the output generated by the SQL query: SELECT Address FROM UserDetails WHERE Address LIKE ‘%’ OR Address LIKE ‘M%’;
a) Agartala
b) Kolkata
c) Mumbai
d) Delhi
Answer: a) ALTER command is used to add remove\modify rows to a relation.
c) DROP command is used to delete all data from a relation.
Q4. Which of the following statements is incorrect?
a) ALTER command is used to add remove\modify rows to a relation.
b) ALTER command is used to add remove\modify attributes to a relation.
c) DROP command is used to delete all data from a relation.
d) DROP command is used to delete a relation.
Answer: a) ALTER command is used to add remove\modify rows to a relation.
For answers or latest updates join our telegram channel: Click here to join
These are Nptel Database Management System Assignment 2 Answers
Q5. Let students (student_id, student name, address, emailid) and enrolment (student_id, dept name, enrolment_date) be two relations in a schema. The primary keys are shown underlined.
Let student_id be a foreign key in enrolment relation referring to students relation. Suppose, there is no violation of the above referential integrity constraint in the corresponding relation instances of students and enrolment.
Which one of the following relational algebra expressions would necessarily produce an empty relation?
a) Istudent_id (enrolment) Istudent_id (students)
b) Istudent_id (students) Istudent_id (enrolment)
c) Istudent_id(enrolment <> students)
d) Istudent_id (enrolment students)
Answer: a) Istudent_id (enrolment) Istudent_id (students)
Q6. Consider the following instance of MountainDetails (MountainName, Altitude, StateName) relation.
What will be the output of the following query?
SELECT MountainName, Altitude
FROM MountainDetails md1
WHERE Altitude = (
SELECT MAX(Altitude) FROM MountainDetails md2 WHERE md1.StateName = md2. StateName);
Answer:
For answers or latest updates join our telegram channel: Click here to join
These are Nptel Database Management System Assignment 2 Answers
Q7. Consider the following instance of MountainDetails (MountainName, Altitude, StateName) relation.
What will be the output of the following query?
SELECT MountainName, Altitude FROM MountainDetails WHERE Altitude > (
SELECT Altitude FROM MountainDetails WHERE StateName = “Uttarakhand”);
Answer:
Q8. Consider the following instance UserDetails of a messenger application
a) SELECT * FROM UserDetails
WHERE Address AS (‘Delhi’, ‘Mumbai’);
b) SELECT * FROM UserDetails WHERE Address IN (‘Delhi’, ‘Mumbai’);
c) SELECT * FROM UserDetails WHERE Address FOR (‘Delhi’, ‘Mumbai’);
d) SELECT * FROM UserDetails WHERE Address TO (‘Delhi’, ‘Mumbai’);
Answer: b) SELECT * FROM UserDetails WHERE Address IN (‘Delhi’, ‘Mumbai’);
For answers or latest updates join our telegram channel: Click here to join
These are Nptel Database Management System Assignment 2 Answers
Q9.Consider the following instance UserDetails of a messenger application:
Identify the correct statement to create an index on SenderID and Address of UserDetails relation named as ‘View_UserDetails’
a) Create View_UserDetails AS UserDetails (Sender ID, Address);
b) Create index View_UserDetails AS UserDetails (Sender ID, Address);
c) Create index View_UserDetails ON UserDetails (Sender ID, Address);
d) Create index View_UserDetails TO UserDetails (SenderID, Address);
Answer: c) Create index View_UserDetails ON UserDetails (Sender ID, Address);
Q10. Consider the following instance UserDetails of a messenger application:
Identify the correct statement to find the SenderID, Receiver ID, and Address of UserDetails table whose Total_Text is in between 700 and 1200.
a) SELECT SenderID, ReceiverID, Address FROM UserDetails WHERE Total_Text AS (700, 1200);
b) SELECT SenderID, ReceiverID, Address FROM UserDetails WHERE Total_Text IN (700, 1200);
c) SELECT SenderID, ReceiverID, Address FROM UserDetails WHERE Total_Text BETWEEN (700, 1200);
d) SELECT SenderID, ReceiverID, Address FROM UserDetails WHERE Total_Text BETWEEN 700 AND 1200;
Answer: d) SELECT SenderID, ReceiverID, Address FROM UserDetails WHERE Total_Text BETWEEN 700 AND 1200;
For answers or latest updates join our telegram channel: Click here to join
These are Nptel Database Management System Assignment 2 Answers
All Weeks of Database Management System: Click here
For answers to additional Nptel courses, please refer to this link: Check here