MySQL Database Quiz Questions

Course Name:MySQL
Chapter Name:Chapter 7 - DQL (Data Query Language)
Lesson Content Link:INNER JOIN
Current Quiz Count:30
Progress
0%
Q1
True / False

In MySQL, an INNER JOIN returns rows when there is at least one match in both tables.

Q2
True / False

In MySQL, the INNER JOIN keyword can be used to combine more than two tables.

Q3
True / False

MySQL INNER JOIN and MySQL JOIN are functionally equivalent.

Q4
True / False

In MySQL, using INNER JOIN without specifying a condition will result in a syntax error.

Q5
True / False

In MySQL, INNER JOIN can be used with the USING keyword to specify columns with the same name in both tables.

Q6
True / False

MySQL INNER JOIN returns NULL values when there are no matching rows in one of the tables.

Q7
True / False

In MySQL, using an INNER JOIN on tables with no common columns will result in a cross join.

Q8
True / False

MySQL can optimize INNER JOIN operations using indexes on the joined columns.

Q9
True / False

In MySQL, INNER JOIN operations can be nested within subqueries to filter results

Q10
True / False

When performing an INNER JOIN in MySQL, the order of the tables in the JOIN clause does not affect the result.

Q11
Single Choice

Which of the following MySQL keywords is used to combine rows from two or more tables, based on a related column between them?

Q12
Single Choice

What will be the result of the following SQL query if there are matching rows in both tables?

SQL Code
SELECT employees.name, departments.department_name
FROM employees
INNER JOIN departments
ON employees.department_id = departments.department_id;
Q13
Single Choice

Which MySQL query correctly performs an INNER JOIN between the tables orders and customers to retrieve all order details along with customer names?

Q14
Single Choice

What does the following SQL query return?

SQL Code
SELECT p.product_name, c.category_name
FROM products p
INNER JOIN categories c
ON p.category_id = c.category_id
WHERE c.category_name = 'Electronics';
Q15
Single Choice

Consider the tables students and courses. How can you retrieve the names of students along with the course names they are enrolled in, excluding students not enrolled in any course?

Q16
Single Choice

Which SQL query will return all customers along with their orders, but only if they have placed at least one order?

Q17
Single Choice

Given the tables employees and projects, how would you write a query to retrieve the names of employees who are currently working on projects, including the project names and the start date of the project?

SQL Code
SELECT e.employee_name, p.project_name, ep.start_date
FROM employees e
INNER JOIN employee_projects ep ON e.employee_id = ep.employee_id
INNER JOIN projects p ON ep.project_id = p.project_id;
Q18
Single Choice

How can you modify the following SQL query to include employees who might not be assigned to any project?

SQL Code
SELECT e.employee_name, p.project_name
FROM employees e
INNER JOIN projects p ON e.employee_id = p.manager_id;
Q19
Single Choice

Which query correctly performs an INNER JOIN on the orders, products, and customers tables to list customer names, product names, and order dates?

SQL Code
SELECT c.customer_name, p.product_name, o.order_date
FROM orders o
INNER JOIN customers c ON o.customer_id = c.customer_id
INNER JOIN products p ON o.product_id = p.product_id;
Q20
Single Choice

You have two tables, students and exams. The students table contains a list of students and the exams table contains a list of exams taken by the students. Write a query to find the names of students who have taken at least one exam, along with their scores.

SQL Code
SELECT s.student_name, e.exam_score
FROM students s
INNER JOIN exams e ON s.student_id = e.student_id;
Q21
Multiple Choice

Which SQL query uses INNER JOIN to combine records from the 'employees' and 'departments' tables based on a common 'department_id'?

SQL Code
SELECT e.employee_id, e.name, d.department_name
FROM employees e
INNER JOIN departments d ON e.department_id = d.department_id;
Q22
Multiple Choice

Identify the correct SQL query that uses INNER JOIN to list all orders with their corresponding customer names from the 'orders' and 'customers' tables.

SQL Code
SELECT o.order_id, o.order_date, c.customer_name
FROM orders o
INNER JOIN customers c ON o.customer_id = c.customer_id;
Q23
Multiple Choice

Which SQL query uses INNER JOIN to retrieve a list of products along with their respective category names from the 'products' and 'categories' tables?

SQL Code
SELECT p.product_id, p.product_name, c.category_name
FROM products p
INNER JOIN categories c ON p.category_id = c.category_id;
Q24
Multiple Choice

Determine the correct SQL query that uses INNER JOIN to fetch all student records along with their corresponding course names from the 'students' and 'courses' tables.

SQL Code
SELECT s.student_id, s.student_name, c.course_name
FROM students s
INNER JOIN courses c ON s.course_id = c.course_id;
Q25
Multiple Choice

Which SQL query uses INNER JOIN to display all transaction details along with their respective client names from the 'transactions' and 'clients' tables?

SQL Code
SELECT t.transaction_id, t.amount, c.client_name
FROM transactions t
INNER JOIN clients c ON t.client_id = c.client_id;
Q26
Multiple Choice

Which SQL query uses INNER JOIN to combine the 'orders' and 'products' tables to find the total sales amount for each product?

SQL Code
SELECT p.product_name, SUM(o.quantity * p.price) AS total_sales
FROM orders o
INNER JOIN products p ON o.product_id = p.product_id
GROUP BY p.product_name;
Q27
Multiple Choice

Identify the correct SQL query that uses INNER JOIN to fetch all employees who have placed orders, combining data from the 'employees' and 'orders' tables.

SQL Code
SELECT e.employee_id, e.name, o.order_id
FROM employees e
INNER JOIN orders o ON e.employee_id = o.employee_id;
Q28
Multiple Choice

Which SQL query uses INNER JOIN to retrieve all customer orders along with their respective shipping details from the 'orders' and 'shipping' tables?

SQL Code
SELECT o.order_id, o.order_date, s.shipping_date
FROM orders o
INNER JOIN shipping s ON o.order_id = s.order_id;
Q29
Multiple Choice

Determine the correct SQL query that uses INNER JOIN to list all teachers along with the classes they are teaching, combining data from the 'teachers' and 'classes' tables.

SQL Code
SELECT t.teacher_id, t.name, c.class_name
FROM teachers t
INNER JOIN classes c ON t.teacher_id = c.teacher_id;
Q30
Multiple Choice

Which SQL query correctly uses INNER JOIN to retrieve a list of all projects and their corresponding manager names from the 'projects' and 'managers' tables?

SQL Code
SELECT p.project_name, m.manager_name
FROM projects p
INNER JOIN managers m ON p.manager_id = m.manager_id;