31 Lecture
CS403
Midterm & Final Term Short Notes
Inner Join
Inner Join is a type of join operation in SQL that combines matching rows from two tables based on a specified condition. It selects only the rows that have matching values in both tables, and excludes non-matching rows. Inner Join is the most c
Important Mcq's
Midterm & Finalterm Prepration
Past papers included
Download PDF
- What is the purpose of an Inner Join in SQL?
a. To combine all rows from two tables
b. To combine matching rows from two tables
c. To combine non-matching rows from two tables
d. None of the above
Answer: b. To combine matching rows from two tables
What is the syntax for an Inner Join in SQL?
a. SELECT * FROM table1, table2 WHERE table1.column = table2.column
b. SELECT * FROM table1 JOIN table2 ON table1.column = table2.column
c. SELECT * FROM table1 INNER JOIN table2 ON table1.column = table2.column
d. Both b and c
Answer: d. Both b and c
Which of the following types of join can result in NULL values?
a. Inner Join
b. Left Join
c. Right Join
d. Full Outer Join
Answer: d. Full Outer Join
In an Inner Join, what happens if there are duplicate values in the matching columns?
a. Only one row is returned for each duplicate value
b. All rows with duplicate values are returned
c. An error is thrown
d. None of the above
Answer: b. All rows with duplicate values are returned
Which of the following is an example of an Inner Join condition?
a. table1.column1 = table2.column2
b. table1.column1 <> table2.column2
c. table1.column1 > table2.column2
d. Both b and c
Answer: a. table1.column1 = table2.column2
In an Inner Join, what is the result if there are no matching values in either table?
a. All rows from both tables are returned
b. No rows are returned
c. Only the rows from the first table are returned
d. Only the rows from the second table are returned
Answer: b. No rows are returned
What is the difference between an Inner Join and a Left Join?
a. Inner Join returns only matching rows, while Left Join returns all rows from the left table and matching rows from the right table
b. Inner Join returns all rows from both tables, while Left Join returns only matching rows
c. Inner Join and Left Join are the same thing
d. None of the above
Answer: a. Inner Join returns only matching rows, while Left Join returns all rows from the left table and matching rows from the right table
Which of the following keywords is used in an Inner Join to specify the columns to join on?
a. ON
b. WHERE
c. JOIN
d. FROM
Answer: a. ON
Which of the following operators is used in an Inner Join to combine multiple conditions?
a. AND
b. OR
c. NOT
d. XOR
Answer: a. AND
Which of the following statements is true about the order of tables in an Inner Join?
a. The order does not matter
b. The first table listed is always the left table
c. The second table listed is always the right table
d. Both b and c
Answer: a. The order does not matter.
Subjective Short Notes
Midterm & Finalterm Prepration
Past papers included
Download PDF
What is an Inner Join in SQL? Answer: An Inner Join is a type of join in SQL that selects only the rows from two tables that have matching values in both tables. What is the syntax for an Inner Join? Answer: The syntax for an Inner Join is "SELECT columns FROM table1 INNER JOIN table2 ON table1.column = table2.column". What is the difference between an Inner Join and a Left Join? Answer: An Inner Join returns only the rows with matching values in both tables, while a Left Join returns all the rows from the left table and matching rows from the right table. Can an Inner Join result in NULL values? Answer: No, an Inner Join does not result in NULL values because it only returns rows with matching values in both tables. What happens if there are duplicate values in the matching columns of an Inner Join? Answer: All rows with duplicate values in the matching columns are returned in the Inner Join. What is the purpose of the ON keyword in an Inner Join? Answer: The ON keyword is used in an Inner Join to specify the columns to join on. Can more than two tables be used in an Inner Join? Answer: Yes, an Inner Join can be performed on more than two tables by joining one table at a time. What is the result if there are no matching values in either table in an Inner Join? Answer: If there are no matching values in either table, then no rows are returned in the Inner Join. What is the difference between an Inner Join and a Full Outer Join? Answer: An Inner Join returns only the rows with matching values in both tables, while a Full Outer Join returns all rows from both tables, including those with NULL values. What is the order of tables in an Inner Join? Answer: The order of tables in an Inner Join does not matter.