How To Create Conditions In Sql In Sql Server 2008


show more Creating conditions in SQL provides you with in-depth training on Business. Taught by Simon Allardice as part of the SQL Server 2008 Essential Training show less
please wait ...

Creating conditions in SQL

So we have this very simple SQL query, selecting these three columns from the SalesLT.Customer table in the AdventureWorksLT database. If I execute that, it's going to bring back the entire contents of that table, which is 847 rows. But I can either see by scanning through it or down here in the status bar, 847 rows. But of course, if I don't want all those rows available, if I want to filter that information, it's a very common thing. So, the way that I do it is by using the WHERE keyword.

I only want to bring back that data where people have a certain last name or have a certain email address or their customer ID is in a particular range. Now it all depends on what kind of data that you're filtering on. So, for example, if I wanted to bring back information where the LastName of the person was equal to Vargas, well, if it's text I need to write it in quotes. Another single quote again here. If I execute that, I get in this case four rows coming back. It looks like my t...

Creating conditions in SQL
Video duration: 8m 10s 6h 54m Beginner

Viewers:

Creating conditions in SQL provides you with in-depth training on Business. Taught by Simon Allardice as part of the SQL Server 2008 Essential Training

Subjects:
Business Developer IT
Software:
SQL Server
Author:
please wait ...