SQL JOB ASSIGNMENT MCQ

Question 1 : You have a table named “Inventory” with columns “ProductID,” “ProductName,” “QuantityInStock,” and “LastRestockDate.” Retrieve the product names of items that need restocking. An item needs restocking if its quantity in stock is less than 10, and the last restock date is more than 30 days ago. What SQL query should you use? 

Options : 

a. SELECT ProductName FROM Inventory WHERE QuantityInStock< 10 AND LastRestockDate < NOW()+ INTERVAL 30 DAY;

b. SELECT ProductName FROM Inventory WHERE QuantityInStock > 10 AND LastRestockDate > NOW()+ INTERVAL 30 DAY;

c. SELECT ProductName FROM Inventory WHERE QuantityInStock< 10 AND LastRestockDate > NOW()- INTERVAL 30 DAY;

d. SELECT ProductName FROM Inventory WHERE QuantityInStock< 10 AND LastRestockDate < NOW()- INTERVAL 30 DAY;

Answers : d. SELECT ProductName FROM Inventory WHERE QuantityInStock< 10 AND LastRestockDate < NOW()- INTERVAL 30 DAY;

Question 2 : Moderate Consider the following relational schema: Suppliers (sid:integer, sname:string, saddress:string) Parts (pid:integer, pname:string, pcolor:string) Catalog (sid:integer, pid:integer, pcost:real)

What is the result of the following query?

(SELECT Catalog.pid from Suppliers, Catalog

WHERE Suppliers.sid = Catalog.pid)

MINUS

(SELECT Catalog.pid from Suppliers, Catalog

WHERE Suppliers.sname <> ‘sachin’ and Suppliers.sid = Catalog.sid) 

 

Options : 

a. pid of Parts available in catalog supplied by Sachin

b. pid of Parts available in catalogs supplied by all except sachin

c. pid of Parts supplied by all except sachin

d. pid of Parts supplied only by sachin

Answers : b. pid of Parts available in catalogs supplied by all except sachin

 

Question 1 :

 

Options : 

a.

b.

c.

d.

Answers : 


Question 1 :

 

Options : 

a.

b.

c.

d.

Answers : 


Leave a Reply