0 of 10 questions completed
Here are some great interview questions about SQL.
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You have to finish following quiz, to start this quiz:
0 of 10 questions answered correctly
Time has elapsed
You have reached 0 of 0 points, (0)
- Not categorized 0%
- SQL 101 0%
- SQL 201 0%
Congratulations for completing the course!
Do you want to get better at SQL and be able to confidently answer those tough questions?
Do you want to completely understand how to join data from two or more tables?
If so, then you’ll want to check out SQL 201.
This is my easy to follow, and simple to understand online training that walks you through joins, subqueries, and set operators.
Question 1 of 10
There is a table which contains two columns: Student and Marks
Which query would you use to find all the students, whose marks are greater than average marks?Correct
The correct answer is to use a subquery to calculate the average mark for all grades and then use this result to filter against. Remember, subqueries can be used in the SELECT list, FROM, GROUP BY, and HAVING clauses.
Question 2 of 10
An inner join is used to return which of the following?Correct
Inner joins are used to combine columns from one table with another based on join conditions. In most cases we are matching one or more columns from one table to another, such as matching a foreign key to a primary key.
Question 3 of 10
Which of the following operators is allowed in a join condition?Correct
Surprising all of these operators are allows in a join condition. Though the equals operator is most common, the others come in handy is special circumstances. For instance the <> is useful in self-joins where you want to find duplicates and are avoiding matching the same record to itself. You can use the <> operator to ensure the primary keys don’t match.
Question 4 of 10
Given the following example:
FROM Person A
INNER JOIN Person B ON A.ID = B.ID
What most accurately describes what kind of join it is?Correct
Though this join could be considered an inner join, specifically it is a self join. The reason is because the a table is being joined to itself.
Question 5 of 10
Given the following statement what do you think is incorrect?
(SELECT name FROM Employee)
When used to return a value in a SELECT column list, a subquery can only return a single value. In this example the query will fail if the Employee table has two or more rows.
Question 6 of 10
What is the main purpose of the primary key?Correct
The main purpose of the primary key is to uniquely identify each row. Each primary key value can not be NULL.
Question 7 of 10
A database that is in first normal form follow all these rules except:Correct
It is important that information is stored in a relational table, has a primary key, and each column contains atomic values. Repeating columns, such as name1, name2 are allowed, but there is no requirement they are consistently named.
Question 8 of 10
Which statement is not true about relational database tables?Correct
A table can have more than one foreign key.
Question 9 of 10
What is the difference between UNION and UNION ALL?Correct
The main difference lies in whether duplicate values are returned. UNION returns unique rows from both queries. UNION ALL return all rows from both queries.
Question 10 of 10
Which Query best finds all Employee records containing the word “Joe”, regardless of capitalization (e.g. JOE, Joe, or joe)?Correct
IN is a great operator use and the form for the SQL is correct, but using UPPER is the best way to do this comparison as it will also find every Joe, JOE, joe, or jOe.