Posts
Create post

POSTS

Sport Music
#0: PostgreSQL CASE Expressions: If-else in Select Query
Category: Music

In the above syntax, every condition is a boolean expression that evaluates to be either true or false. The CASE expression evaluates a list of conditions in sequence. If the condition evaluates to true, the CASE expression will return the corresponding result set for that condition and stop evaluating the next expression. If the condition evaluates to false, the CASE expression keeps on evaluating the next condition until it finds the expression to be evaluated as true. If of all the conditions evaluates to be false, then it returns else_result that is in the ELSE clause. The ELSE clause is optional. If the ELSE clause is not defined for CASE expression, then it will return NULL. The data types of all the result expressions must be convertible to a single output type, otherwise CASE expression will raise error.Let`s use the following Employee table to understand the CASE expression.

Read more...
#1: SQL INSERT INTO Statement
Category: Music

The SQL INSERT INTO Statement The INSERT INTO statement is used to insert new records in a table. INSERT INTO Syntax It is possible to write the INSERT INTO statement in two ways: 1. Specify both the column names and the values to be inserted:

Read more...