- If you want to find a specific information from different sources/places from database then you can use the statement IN like this-SELECT name, state FROM customers WHERE state IN('CA','NY','NC')
- If you want to find a specific information form different sources accept a few sources the then use statement NOT IN like this-SELECT name, state FROM customers WHERE state NOT IN('CA','NY','NC')
- For the same conditions as mentioned above if you want to order your result according to a specific manner then use ORDER BY statement like this-SELECT name, state FROM customers WHERE state IN('CA','NY','NC') ORDER BY state
Notice:
- Sometimes we have to use OR statement several times to find out informations form different rows/columns, but we can use IN once instead of using OR several times.
- We can use NOT IN to skip some columns/rows.
- To order your result use statement ORDER BY.
0 comments:
Post a Comment