Friday , July 19 2024

NOT EXISTS Clause In PostgreSQL

In today’s article, we will be learning the NOT EXISTS clause in PostgreSQL. You can think of NOT EXITS as the use of equal and not equal symbols.

We will operate with ogrenci_all and ogrenci_vf tables, let’s see these tables and start our example.

ogrenci_all table with student names:

ogrenci_vf table where student visa and final grades are entered:

Let’s list both of our tables as above and now list the students whose vize and final grades have not been entered.

It is different when you pay attention to the ROWS numbers in the lower left corner of the pictures of the tables above, you can notice this by manually looking at the values in the no column in the tables with low number of records, but if the number of records in your tables is thousands or millions, I recommend you to use not exists.

In the example below, the student whose vize and final grade has not been entered is listed.

Loading

About Faruk Erdem

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories