Microsoft SQL Server Database Quiz Questions

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

Does the INNER JOIN keyword only return rows when there is a match in both tables?

Q2
True / False

Can an INNER JOIN be used to join more than two tables?

Q3
True / False

Is it mandatory to have a common column between tables for an INNER JOIN?

Q4
True / False

Does the INNER JOIN keyword return unmatched rows from both tables?

Q5
True / False

Can INNER JOIN result in a Cartesian product if there is no ON clause?

Q6
True / False

Does an INNER JOIN automatically eliminate duplicate rows?

Q7
True / False

Is it possible to use a WHERE clause along with an INNER JOIN?

Q8
True / False

Can you join tables using an INNER JOIN based on a non-primary key column?

Q9
True / False

Does INNER JOIN return null values from columns of joined tables?

Q10
True / False

Can INNER JOIN be used with aliases for table names?

Q11
True / False

Does the INNER JOIN keyword support joining tables from different databases?

Q12
True / False

Is the order of tables in an INNER JOIN clause important for the result set?

Q13
True / False

Can INNER JOIN be used with aggregate functions?

Q14
True / False

Is it possible to use INNER JOIN in a subquery?

Q15
True / False

Does an INNER JOIN create a temporary table with combined results?

Q16
Single Choice

Which clause is necessary to specify the condition for an INNER JOIN?

Q17
Single Choice

Which of the following queries correctly joins the Employees and Departments tables using INNER JOIN?

SQL Code
SELECT Employees.Name, Departments.DepartmentName
FROM Employees
INNER JOIN Departments
ON Employees.DepartmentID = Departments.DepartmentID;
Q18
Single Choice

How do you perform an INNER JOIN to get all employees with their respective manager names?

SQL Code
SELECT e.Name AS EmployeeName, m.Name AS ManagerName
FROM Employees e
INNER JOIN Employees m
ON e.ManagerID = m.EmployeeID;
Q19
Single Choice

Which query shows an INNER JOIN between Orders and Customers to get customer names and their order dates?

SQL Code
SELECT Customers.CustomerName, Orders.OrderDate
FROM Customers
INNER JOIN Orders
ON Customers.CustomerID = Orders.CustomerID;
Q20
Single Choice

What does the INNER JOIN clause do in the following query: SELECT * FROM Products INNER JOIN Suppliers ON Products.SupplierID = Suppliers.SupplierID?

SQL Code
SELECT *
FROM Products
INNER JOIN Suppliers
ON Products.SupplierID = Suppliers.SupplierID;
Q21
Single Choice

Which query correctly joins Customers and Orders to show all customer names with their respective order IDs?

SQL Code
SELECT Customers.CustomerName, Orders.OrderID
FROM Customers
INNER JOIN Orders
ON Customers.CustomerID = Orders.CustomerID;
Q22
Single Choice

Which clause is used to combine rows from two or more tables based on a related column?

Q23
Single Choice

What is the result of an INNER JOIN if no matching rows are found between the tables?

Q24
Single Choice

Which of the following SQL keywords is used to retrieve unique rows from multiple tables?

Q25
Single Choice

What is the purpose of the ON clause in an INNER JOIN statement?

Q26
Single Choice

Which SQL function can be used in combination with INNER JOIN to count the number of rows?

Q27
Single Choice

Which clause should be used to join tables and include only those rows with matching values?

Q28
Single Choice

Which query retrieves the names of employees and their department names using INNER JOIN?

SQL Code
SELECT Employees.Name, Departments.DepartmentName
FROM Employees
INNER JOIN Departments
ON Employees.DepartmentID = Departments.DepartmentID;
Q29
Single Choice

Which of the following queries correctly retrieves customer names and their order dates?

SQL Code
SELECT Customers.CustomerName, Orders.OrderDate
FROM Customers
INNER JOIN Orders
ON Customers.CustomerID = Orders.CustomerID;
Q30
Single Choice

Which keyword should be used to join tables and return only matching rows from both tables?

Q31
Multiple Choice

Which query retrieves all products with their supplier names using INNER JOIN?

SQL Code
SELECT Products.ProductName, Suppliers.SupplierName
FROM Products
INNER JOIN Suppliers
ON Products.SupplierID = Suppliers.SupplierID;
Q32
Multiple Choice

Which of the following queries correctly retrieves employees' names and their managers' names?

SQL Code
SELECT e.Name AS EmployeeName, m.Name AS ManagerName
FROM Employees e
INNER JOIN Employees m
ON e.ManagerID = m.EmployeeID;
Q33
Multiple Choice

Which query retrieves customer names and their order dates using INNER JOIN?

SQL Code
SELECT Customers.CustomerName, Orders.OrderDate
FROM Customers
INNER JOIN Orders
ON Customers.CustomerID = Orders.CustomerID;
Q34
Multiple Choice

Which query retrieves department names and their manager names using INNER JOIN?

SQL Code
SELECT Departments.DepartmentName, Employees.Name AS ManagerName
FROM Departments
INNER JOIN Employees
ON Departments.ManagerID = Employees.EmployeeID;
Q35
Multiple Choice

Which query shows an INNER JOIN between Customers and Orders to get customer names and their order amounts?

SQL Code
SELECT Customers.CustomerName, Orders.OrderAmount
FROM Customers
INNER JOIN Orders
ON Customers.CustomerID = Orders.CustomerID;
Q36
Multiple Choice

Which query retrieves all orders with their product names using INNER JOIN?

SQL Code
SELECT Orders.OrderID, Products.ProductName
FROM Orders
INNER JOIN OrderDetails
ON Orders.OrderID = OrderDetails.OrderID
INNER JOIN Products
ON OrderDetails.ProductID = Products.ProductID;
Q37
Multiple Choice

Which query retrieves employee names and their project names using INNER JOIN?

SQL Code
SELECT Employees.Name AS EmployeeName, Projects.ProjectName
FROM Employees
INNER JOIN EmployeeProjects
ON Employees.EmployeeID = EmployeeProjects.EmployeeID
INNER JOIN Projects
ON EmployeeProjects.ProjectID = Projects.ProjectID;
Q38
Multiple Choice

Which query retrieves department names and the number of employees in each department using INNER JOIN?

SQL Code
SELECT Departments.DepartmentName, COUNT(Employees.EmployeeID) AS NumberOfEmployees
FROM Departments
INNER JOIN Employees
ON Departments.DepartmentID = Employees.DepartmentID
GROUP BY Departments.DepartmentName;
Q39
Multiple Choice

Which query retrieves all orders with their customer names and product names using INNER JOIN?

SQL Code
SELECT Orders.OrderID, Customers.CustomerName, Products.ProductName
FROM Orders
INNER JOIN Customers
ON Orders.CustomerID = Customers.CustomerID
INNER JOIN OrderDetails
ON Orders.OrderID = OrderDetails.OrderID
INNER JOIN Products
ON OrderDetails.ProductID = Products.ProductID;
Q40
Multiple Choice

Which query retrieves project names and their start dates using INNER JOIN?

SQL Code
SELECT Projects.ProjectName, Projects.StartDate
FROM Projects
INNER JOIN ProjectDetails
ON Projects.ProjectID = ProjectDetails.ProjectID;
Q41
Multiple Choice

Which query retrieves the names of employees and their project names using INNER JOIN?

SQL Code
SELECT Employees.Name, Projects.ProjectName
FROM Employees
INNER JOIN EmployeeProjects
ON Employees.EmployeeID = EmployeeProjects.EmployeeID
INNER JOIN Projects
ON EmployeeProjects.ProjectID = Projects.ProjectID;
Q42
Multiple Choice

Which query retrieves the names of departments and the number of employees in each department using INNER JOIN?

SQL Code
SELECT Departments.DepartmentName, COUNT(Employees.EmployeeID) AS NumberOfEmployees
FROM Departments
INNER JOIN Employees
ON Departments.DepartmentID = Employees.DepartmentID
GROUP BY Departments.DepartmentName;
Q43
Multiple Choice

Which query retrieves the names of customers and the total amount of their orders using INNER JOIN?

SQL Code
SELECT Customers.CustomerName, SUM(Orders.OrderAmount) AS TotalAmount
FROM Customers
INNER JOIN Orders
ON Customers.CustomerID = Orders.CustomerID
GROUP BY Customers.CustomerName;
Q44
Multiple Choice

Which query retrieves the names of suppliers and the number of products they supply using INNER JOIN?

SQL Code
SELECT Suppliers.SupplierName, COUNT(Products.ProductID) AS NumberOfProducts
FROM Suppliers
INNER JOIN Products
ON Suppliers.SupplierID = Products.SupplierID
GROUP BY Suppliers.SupplierName;
Q45
Multiple Choice

Which query retrieves the names of employees and their salaries using INNER JOIN?

SQL Code
SELECT Employees.Name, Salaries.Salary
FROM Employees
INNER JOIN Salaries
ON Employees.EmployeeID = Salaries.EmployeeID;