나는 이렇게 학습한다/Algorithm & SQL

Collect Tuition (SQL for Beginners #4)

daco2020 2022. 5. 16. 20:04
반응형

You are working for a local school, and you are responsible for collecting tuition from students. You have a list of all students, some of them have already paid tution and some haven't. Write a select statement to get a list of all students who haven't paid their tuition yet. The list should include all the data available about these students.

students table schema

  • name (string)
  • age (integer)
  • semester (integer)
  • mentor (string)
  • tuition_received (Boolean)

NOTE: Your solution should use pure SQL. Ruby is used within the test cases just to validate your answer.

 

Solution:

SELECT *
FROM students
WHERE NOT tuition_received;

When checking true and false values, there is no need to use '='('==') like in python.

 

 

Test Results:

 

 

반응형

'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글

SQL Basics: Simple DISTINCT  (0) 2022.05.18
Easy SQL: Square Root and Log  (0) 2022.05.17
Expressions Matter  (0) 2022.05.15
SQL Basics: Mod  (0) 2022.05.14
Easy SQL: LowerCase  (0) 2022.05.13