PostgreSQL Where Clause

Syntax:

select cloumns(or *) from table_name Where search_condition;

After the processing of the FROM clause is done, each row of the derived virtual table is checked against the search condition. If the result of the condition is true, the row is kept in the output table, otherwise it is discarded. The search condition typically references at least one column of the table generated in the FROM clause; this is not required, but otherwise the WHERE clause will be fairly useless.

Examples:

CREATE TABLE student (
student_name varchar(80),
student_id int,
class int,
dob date
);

insert into student values(‘Karunakar’,1001,1,’12-12-2015′);
insert into student values(‘varshini’,1002,2,’12-12-2014′);

Select students who are belongs to 4th class.

select student_name from student where class=4;

PostgreSQL where clause

select the list of students whose name starts with ‘K’.

select*from student where student_name like ‘K%’;

postgresql-where-clause1

select the list of students whose name end with ‘y’.

select*from student where student_name like ‘%y’;

 student_name | student_id | class |        dob
--------------+------------+-------+--------------------
 Ajay         |       1004 |     4 | 21-AUG-12 00:00:00
Powered by k2schools