Only for study and record, I will keep trying all tests that relate to my carrier.
I heard many companies using TESDOME for Coding Test for the job application and they gave many practice problems for various languages. Of course, I will try to solve all questions about SQL, but also Python too. (I know HackerRank problems are waiting for me.. haha..)
I will upload 3 problems in one post. One of my friends told me it is hard to read...
Let's begin.
SQL Interview Questions
1. Students
[Problem]
Given the following data definition, write a query that returns the number of students whose first name is John. String comparisons should be case sensitive.
[My Answer]
1
2
|
select count(*) from students
where firstName ='John'
|
cs |
2. Enrollment
[Problem]
A table containing the students enrolled in a yearly course has incorrect data in records with ids between 20 and 100 (inclusive).
![](https://blog.kakaocdn.net/dn/eqevoN/btq4YKySB8H/mdrlZg6lcxBKiB8DO9XZM0/img.png)
Write a query that updates the field 'year' of every faulty record to 2015.
[My Answer]
1
2
|
update enrollments set year = 2015
where id >= 20 and id <= 100;
|
cs |
3. Pets
[Problem]
Information about pets is kept in two separate tables:
Write a query that select all distinct pet names.
[My Answer]
1
2
3
|
select name from cats
union
select name from dogs
|
cs |
'Code Problems > SQL_Testdome' 카테고리의 다른 글
SQL Interview Questions_part 3-1 (0) | 2021.05.15 |
---|---|
SQL Interview Questions_part 2 (0) | 2021.05.15 |