The WHERE clause sets a conditional statement,fetching and filtering the data from single table or joining with multiple table.
If the given condition is satisfied then only it returns specific value from the table.
Syntax-
SELECT column1, column2, column N FROM table_name WHERE [condition]
Example-
Table Name - games, Shows the year and the city hosting Games.
year city
2000 Sydney
2004 Athens
2008 Beijing
2012 London
This example shows the year that Athens hosted games.
SELECT year, city FROM games WHERE year = 2004
Result:
year city
2004 Athens
If the given condition is satisfied then only it returns specific value from the table.
Syntax-
SELECT column1, column2, column N FROM table_name WHERE [condition]
Example-
Table Name - games, Shows the year and the city hosting Games.
year city
2000 Sydney
2004 Athens
2008 Beijing
2012 London
This example shows the year that Athens hosted games.
SELECT year, city FROM games WHERE year = 2004
Result:
year city
2004 Athens
0 comments:
Post a Comment