Quiz-summary
0 of 10 questions completed
Questions:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Information
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:
Results
0 of 10 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 points, (0)
Average score |
|
Your score |
|
Categories
- 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.
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- Answered
- Review
-
Question 1 of 10
1. Question
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
Incorrect
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
2. Question
An inner join is used to return which of the following?
Correct
Incorrect
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
3. Question
Which of the following operators is allowed in a join condition?
Correct
Incorrect
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
4. Question
Given the following example:
SELECT A.Name,
B.Age
FROM Person A
INNER JOIN Person B ON A.ID = B.ID
What most accurately describes what kind of join it is?
Correct
Incorrect
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
5. Question
Given the following statement what do you think is incorrect?
SELECT DepartmentName,
(SELECT name FROM Employee)
FROM Department
Correct
Incorrect
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
6. Question
What is the main purpose of the primary key?
Correct
Incorrect
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
7. Question
A database that is in first normal form follow all these rules except:
Correct
Incorrect
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
8. Question
Which statement is not true about relational database tables?
Correct
Incorrect
A table can have more than one foreign key.
-
Question 9 of 10
9. Question
What is the difference between UNION and UNION ALL?
Correct
Incorrect
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
10. Question
Which Query best finds all Employee records containing the word “Joe”, regardless of capitalization (e.g. JOE, Joe, or joe)?
Correct
Incorrect
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.