technical skills grow

Responsive Ads Here

Thursday, October 28, 2021

Part-20 Type Conversion In Postgres

 

Example:

When we try to compare in the WHERE clause is of data type integer In the result set, here is the inventory_id column. The name of the column there is the data type for this column .The data type is 
column is integer we see on the right side of the equal to operator  in the where clause. where also have an integer. That mean in the where clause we have an integer compared with another integer .When data types are compared and both of them have the same data type. there is not  conversion

Example :

It will convert this integer column to a string or this particular  string to an integer. This will create little bit performance degradation .However , when we execute this query. Our result will be the same and we will still get accurate result .You will execute This is because Postgres has converted this particular string to an integer to compare it with the invetory_id column. particular string to an integer how will you do it? That's when explicit conversion comes into action. Now right before this string 2346, we will write the keyword integer.This particular keyword will convert string 2346 to integer. This is called explicit conversion when we convert any data of different data types to our preferred data type 






No comments:

Post a Comment

Powered by Blogger.

Labels

Contact Form

Name

Email *

Message *

Search This Blog

Blog Archive

Ad Code

Responsive Advertisement

Recent Posts