Selecting multiple rows in sql

In order to select a single row in Sql we normally use the following syntax : Select * from table name where column name = value;
For Example we have a table People and we want to fetch the row where PersonId is 1 we will use the following statement:
select * from People where PersonId=1

Now if we want to select more rows we will use the following syntax : Select * from table name where column name in( value1, value2,value3…..);
For Example if we want to select all rows where PersonId more 1,2, 3 and 4, we will use the following statement :
select * from People where PersonID in (1,2,3,4)

Leave a Comment

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