Sql In can improve your productivity.
The IN keyword is used as part of a condition, and when used with Sql Where, it enables us to specify multiple values, either as a list or a subquery. Subquery will be discussed separately, here we'll discuss a list of values.
Any column in the table. You can also use an expression.
Specifies that the result of the predicate be negated.
A list of expressions to test for a match, they must be of the same type as column_name.
Example: Let's use the following Contacts table to illustrate the usage of Sql In. Select the names of people who live in Sydney,Surry Hill,Melbourne, or Coolangatta.
|1||White||Alan||210 George St||Sydney||NSW||2000|
|2||Johnson||Benjamin||11 Cooper St||Surry Hill||NSW||2010|
|3||Brown||Peter||72 Haymarket St||Haymarket||NSW||2000|
|4||Anderson||Thomas||33 Collins St||Melbourne||VIC||3000|
|5||Gomdas||Tony||78 Marine Pde||Coolangatta||QLD||4225|
|6||Green||Tony||123 Second Ave||Liverpool||NULL||2170|
|7||Gutman||Philip||27 Swanson St||Melbourne||VIC||3000|
|White||Alan||210 George St||Sydney|
|Johnson||Benjamin||11 Cooper St||Surry Hill|
|Anderson||Thomas||33 Collins St||Melbourne|
|Gomdas||Tony||78 Marine Pde||Coolangatta|
|Gutman||Philip||27 Swanson St||Melbourne|
Compare OR and IN
If you write the above Sql Statement using OR instead of IN operator, this is what you'll get.
As you can see that with Sql In, you can write a simpler Sql.
You can also replace the list with an Sql statement, this is discussed further in the Sql subquery.
Quick link. From here, you can learn the following:
The core of Sql, selecting data from table.
Conditionally selecting rows from table.
Eliminating duplicate values in the output.
Counting number of rows.
Getting the sum of a field
This function will return the highest value.
This function will return the lowest value.
This function will return the average value.
Sql Order By
Sorting the output
Sql And Or
Connecting two or more conditions in the Where or Having clause.
Sql Group By
Grouping rows into sets.
To filter the result of aggregation
Pattern searching for conditions in Where or Having clause
Added to conditions to show results between two values.
Return from Sql In to Sql Command
All of us have at least two or three things that excite us. We could talk about these subjects for hours. Good news!. Did you know that Site Built It! can turn this type of deep interest and enthusiasm into a revenue-generating business?
Review some of the Site Build It! case studies and you'll absolutely discover something that ignites more positive ideas into your mind.
SBI! Video Tour
Invest the most
Buy at AllPosters.com
Sydney Harbor Bridge, Sydney, Australia