Skip to main content

MySQL MCQs ( Table and Join Operations ) PART 3

Most asked MySQL MCQs focused on Table and Join Operations Output for UGC NET, SET, EMRS, KVS, ISRO, and Assistant Professor exams.


21. Given the following tables, what will be the output of an INNER JOIN?

Customers Table

CustomerID Name City
1 Alice Delhi
2 Bob Mumbai
3 Charlie Kolkata

Orders Table

OrderID CustomerID Product
101 1 Laptop
102 2 Mobile
103 4 Tablet

Query:

SELECT Customers.Name, Orders.Product  
FROM Customers  
INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID;

A) Returns all customers with their respective orders
B) Returns customers who have placed orders
C) Returns all customers, even if they don’t have an order
D) Returns all orders, even if they don’t have a customer

Answer: B) Returns customers who have placed orders
(Output: Alice - Laptop, Bob - Mobile)


22. What will a LEFT JOIN return when there is no matching row in the right table?

A) NULL values for the right table columns
B) Exclude those rows
C) Return only matching rows
D) Throw an error

Answer: A) NULL values for the right table columns


23. What does the following query return?

SELECT C.Name, O.Product  
FROM Customers C  
LEFT JOIN Orders O ON C.CustomerID = O.CustomerID;

A) Only customers who placed an order
B) All customers, with NULL for those who haven't placed an order
C) All orders, even if they don’t have a customer
D) Only orders with matching customers

Answer: B) All customers, with NULL for those who haven't placed an order


24. Which JOIN returns only unmatched rows from both tables?

A) INNER JOIN
B) LEFT JOIN
C) RIGHT JOIN
D) FULL OUTER JOIN

Answer: D) FULL OUTER JOIN


25. Given two tables, what will be the output of a CROSS JOIN?

Employees Table

EmpID Name
1 Raj
2 Anil

Departments Table

DeptID DeptName
101 HR
102 IT

Query:

SELECT Employees.Name, Departments.DeptName  
FROM Employees  
CROSS JOIN Departments;

A) 2 rows
B) 4 rows
C) 1 row
D) No rows

Answer: B) 4 rows (Each employee gets paired with every department)


26. Which SQL clause is used to filter grouped records?

A) WHERE
B) GROUP BY
C) HAVING
D) ORDER BY

Answer: C) HAVING


27. What will be the result of the following query?

SELECT Customers.Name, Orders.Product  
FROM Customers  
RIGHT JOIN Orders ON Customers.CustomerID = Orders.CustomerID;

A) Only customers who placed an order
B) All customers, even if they haven't placed an order
C) All orders, even if they don’t have a customer
D) Only unmatched customers

Answer: C) All orders, even if they don’t have a customer


28. If there are 5 rows in Table A and 3 rows in Table B, how many rows will a CROSS JOIN return?

A) 5
B) 3
C) 8
D) 15

Answer: D) 15 (5 × 3)


29. What will be the output of the following query?

SELECT Customers.Name, Orders.Product  
FROM Customers  
FULL JOIN Orders ON Customers.CustomerID = Orders.CustomerID;

A) MySQL does not support FULL JOIN
B) Returns only matching records
C) Returns only unmatched records
D) Returns an error

Answer: A) MySQL does not support FULL JOIN (It requires UNION of LEFT JOIN and RIGHT JOIN)


30. Which SQL JOIN returns all records from the left table and matching records from the right table?

A) INNER JOIN
B) LEFT JOIN
C) RIGHT JOIN
D) FULL OUTER JOIN

Answer: B) LEFT JOIN



Comments

Popular posts from this blog

Top 5 Safe Chat Apps for Kids with Parental Controls

Now a days kids are growing up with technology at their fingertips. While communication apps help children stay connected with family and friends, safety remains a top concern for parents. Unregulated platforms can expose children to inappropriate content, online predators, and cyberbullying. That’s why choosing a kid-friendly chat app with parental controls is essential. To help parents find the best options, we’ve compiled a list of the top five safest chat apps for kids that offer safe and controlled environment. 1. Messenger Kids (By Meta) Best for: Safe video calls and text messaging with parental supervision Features: Parents approve all contacts No ads or in-app purchases Fun filters, stickers, and games Monitored messaging and activity reports Why It’s Safe: Messenger Kids is designed for children under 13 and requires parental approval for every contact. Parents can monitor chats and control screen time through the Parent Dashboard. Download Messenger Kids 2...

AI from Class 3: India’s Big Leap into the Future of Learning

Imagine that, it's a morning in 2026. In a classroom, a teacher holds up a tablet. Instead of reciting multiplication tables, a group of eight-year-olds watches a tiny animation explaining how computers “learn” from patterns. A curious hand shoots up. “Ma’am, does that mean my phone is smarter than me?” The class bursts into laughter, but the question lingers. That, in essence, is the beginning of India’s new chapter — where Artificial Intelligence is no longer a distant, sci-fi term, but a part of early education. The Turning Point The Central Board of Secondary Education (CBSE) has drafted a plan to introduce AI as a subject from Class 3 to Class 12 , a first in the country’s education history. The proposal, now with NCERT for expert review, aims to roll out by April 2026 . If all goes to plan, teacher training will begin next year, resource books and digital tools will follow, and by the time the next generation steps into school, “AI” will sit alongside English, Science,...

10 Distance Vector and Link-State Routing MCQ

  10 multiple-choice questions  on  Distance Vector and Link-State Routing with explanations, useful for  UGC NET, SET, GATE, ISRO, and other competitive exams . Question 1: Basic Concept of Distance Vector Routing Q1: In a distance vector routing protocol, how do routers share routing information? A) By flooding the entire network with routing updates B) By periodically exchanging routing tables with their immediate neighbors C) By using a link-state database to determine the shortest path D) By dynamically updating paths based on link failure reports Answer: B) By periodically exchanging routing tables with their immediate neighbors Explanation: In Distance Vector Routing, routers share their routing tables with neighbors at regular intervals, leading to a simple but slow convergence mechanism. Question 2: Example of Distance Vector Routing Protocol Q2: Which of the following is an example of a Distance Vector routing protocol? A) OSPF ...