- How to retrieve data from asingle tableIn this chapter, you’ll learn how to code SELECT statements that retrieve datafrom a single table. You should realize, though, that the skills covered here arethe essential ones that apply to any SELECT statement you code…no matterhow many tables it operates on, no matter how complex the retrieval. So you’llwant to be sure you have a good understanding of the material in this chapterbefore you go on to the chapters that follow.3An introduction to the SELECT statement ........................ 80The basic syntax of the SELECT statement ................................................. 80SELECT statement examples ....................................................................... 82How to code the SELECT clause ........................................ 84How to code column specifications .............................................................. 84How to name the columns in a result set ...................................................... 86How to code string expressions .................................................................... 88How to code arithmetic expressions ............................................................. 90How to use functions .................................................................................... 92How to use the DISTINCT keyword to eliminate duplicate rows ................ 94How to use the TOP clause to return a subset of selected rows ................... 96How to code the WHERE clause ......................................... 98How to use comparison operators ................................................................ 98How to use the AND, OR, and NOT logical operators .............................. 100How to use the IN operator ........................................................................ 102How to use the BETWEEN operator.......................................................... 104How to use the LIKE operator .................................................................... 106How to use the IS NULL clause ................................................................. 108How to code the ORDER BY clause ................................. 110How to sort a result set by a column name ................................................. 110How to sort a result set by an alias, an expression, or a column number ... 112Perspective.......................................................................... 11480Section 2 The SQL skillsAn introduction to the SELECTstatementTo help you learn to code SELECT statements, this chapter starts by presentingits basic syntax. Next, it presents several examples that will give you anidea of what you can do with this statement. Then, the rest of this chapter willteach you the details of coding this statement.The basic syntax of the SELECT statementFigure 3-1 presents the basic syntax of the SELECT statement. The syntaxsummary at the top of this figure uses conventions that are similar to those usedin other programming manuals. Capitalized words arekeywords that you have totype exactly as shown. In contrast, you have to provide replacements for thelowercase words. For example, you can enter a list of columns in place ofselect_list, and you can enter a table name in place of table_source.Beyond that, you can choose between the items in a syntax summary thatare separated by pipes (|) and enclosed in braces ({}) or brackets ([]). And youcan omit items enclosed in brackets. If you have a choice between two or moreoptional items, the default item is underlined. And if an element can be codedmultiple times in a statement, it’s followed by an ellipsis (…). You’ll see examplesof pipes, braces, default values, and ellipses in syntax summaries later inthis chapter. For now, if you compare the syntax in this figure with the codingexamples in the next figure, you should easily see how the two are related.The syntax summary in this figure has been simplified so that you can focuson the four main clauses of the SELECT statement: SELECT, FROM, WHERE,and ORDER BY. Most of the SELECT statements you code will contain all fourof these clauses. However, only the SELECT and FROM clauses are required.The SELECT clause is always the first clause in a SELECT statement. Itidentifies the columns that will be included in the result set. These columns areretrieved from the base tables named in the FROM clause. Since this chapterfocuses on retrieving data from a single table, the FROM clauses in all of thestatements shown in this chapter name a single base table. In the next chapter,though, you’ll learn how to retrieve data from two or more tables.The WHERE and ORDER BY clauses are optional. The ORDER BY clausedetermines how the rows in the result set are sorted, and the WHERE clausedetermines which rows in the base table are included in the result set. TheWHERE clause specifies a search condition that’s used tofilter the rows in thebase table. This search condition can consist of one or moreBoolean expressions,orpredicates. A Boolean expression is an expression that evaluates toTrue or False. When the search condition evaluates to True, the row is includedin the result set.In this book, I won’t use the terms “Boolean expression” or “predicate”because I don’t think they clearly describe the content of the WHERE clause.Instead, I’ll just use the term “search condition” to refer to an expression thatevaluates to True or False.Chapter 3 How to retrieve data from a single table81The simplified syntax of the SELECT statementSELECT select_listFROM table_source[WHERE search_condition][ORDER BY order_by_list]The four clauses of the SELECT statementClause DescriptionSELECT Describes the columns that will be included in the result set.FROM Names the table from which the query will retrieve the data.WHERE Specifies the conditions that must be met for a row to be included in the result set. Thisclause is optional.ORDER BY Specifies how the rows in the result set will be sorted. This clause is optional.Description•You use the basic SELECT statement shown above to retrieve the columns specified inthe SELECT clause from the base table specified in the FROM clause and store them ina result set.•The WHERE clause is used to filter the rows in the base table so that only those rowsthat match the search condition are included in the result set. If you omit the WHEREclause, all of the rows in the base table are included.•The search condition of a WHERE clause consists of one or more Boolean expressions,orpredicates, that result in a value of True, False, or Unknown. If the combination of allthe expressions is True, the row being tested is included in the result set. Otherwise, it’snot.•If you include the ORDER BY clause, the rows in the result set are sorted in the specifiedsequence. Otherwise, the rows are returned in the same order as they appear in thebase table. In most cases, that means that they’re returned in primary key sequence.Note•The syntax shown above does not include all of the clauses of the SELECT statement.You’ll learn about the other clauses later in this book.Figure 3-1 The basic syntax of the SELECT statement82Section 2 The essential SQL skillsSELECT statement examplesFigure 3-2 presents five SELECT statement examples. All of these statementsretrieve data from the Invoices table. If you aren’t already familiar withthis table, you should use the Management Studio as described in the lastchapter to review its definition.The first statement in this figure retrieves all of the rows and columns fromthe Invoices table. Here, an asterisk (*) is used as a shorthand to indicate that allof the columns should be retrieved, and the WHERE clause is omitted so thatthere are no conditions on the rows that are retrieved. Notice that this statementdoesn’t include an ORDER BY clause, so the rows are in primary key sequence.You can see the results following this statement as they’re displayed by theManagement Studio. Notice that both horizontal and vertical scroll bars aredisplayed, indicating that the result set contains more rows and columns thancan be displayed on the screen at one time.The second statement retrieves selected columns from the Invoices table. Asyou can see, the columns to be retrieved are listed in the SELECT clause. Likethe first statement, this statement doesn’t include a WHERE clause, so all therows are retrieved. Then, the ORDER BY clause causes the rows to be sorted bythe InvoiceTotal column in ascending sequence.The third statement also lists the columns to be retrieved. In this case,though, the last column is calculated from two columns in the base table,CreditTotal and PaymentTotal, and the resulting column is given the nameTotalCredits. In addition, the WHERE clause specifies that only the invoicewhose InvoiceID column has a value of 17 should be retrieved.The fourth SELECT statement includes a WHERE clause whose conditionspecifies a range of values. In this case, only invoices with invoice dates between05/01/2006 and 05/31/2006 are retrieved. In addition, the rows in theresult set are sorted by invoice date.The last statement in this figure shows another variation of the WHEREclause. In this case, only those rows with invoice totals greater than 50,000 areretrieved. Since none of the rows in the Invoices table satisfy this condition, theresult set is empty.Chapter 3 How to retrieve data from a single table83A SELECT statement that retrieves all the data from the Invoices tableSELECT *FROM Invoices(114 rows)A SELECT statement that retrieves three columns from each row, sortedin descending sequence by invoice totalSELECT InvoiceNumber, InvoiceDate, InvoiceTotalFROM InvoicesORDER BY InvoiceTotal(114 rows)A SELECT statement that retrieves two columns and a calculated valuefor a specific invoiceSELECT InvoiceID, InvoiceTotal, CreditTotal + PaymentTotal AS TotalCreditsFROM InvoicesWHERE InvoiceID = 17A SELECT statement that retrieves all invoices between given datesSELECT InvoiceNumber, InvoiceDate, InvoiceTotalFROM InvoicesWHERE InvoiceDate BETWEEN '2006-05-01' AND '2006-05-31'ORDER BY InvoiceDate(70 rows)A SELECT statement that returns an empty result setSELECT InvoiceNumber, InvoiceDate, InvoiceTotalFROM InvoicesWHERE InvoiceTotal > 50000Figure 3-2 SELECT statement examples84Section 2 TheSQL skillsHow to code the SELECT clauseFigure 3-3 presents an expanded syntax for the SELECT clause. Thekeywords shown in the first line allow you to restrict the rows that are returnedby a query. You’ll learn how to code them in a few minutes. First, though, you’lllearn various techniques for identifying which columns are to be included in aresult set.How to code column specificationsFigure 3-3 summarizes the techniques you can use to code column specifications.You saw how to use some of these techniques in the previous figure. Forexample, you can code an asterisk in the SELECT clause to retrieve all of thecolumns in the base table, and you can code a list of column names separated bycommas. Note that when you code an asterisk, the columns are returned in theorder that they occur in the base table.You can also code a column specification as anexpression. For example,you can use an arithmetic expression to perform a calculation on two or morecolumns in the base table, and you can use a string expression to combine twoor more string values. An expression can also include one or more functions.You’ll learn more about each of these techniques in the topics that follow.But first, you should know that when you code the SELECT clause, youshould include only the columns you need. For example, you shouldn’t code anasterisk to retrieve all the columns unless you need all the columns. That’sbecause the amount of data that’s retrieved can affect system performance. Thisis particularly important if you’re developing SQL statements that will be usedby application programs.Chapter 3 How to retrieve data from a single table85The expanded syntax of the SELECT clauseSELECT [ALL|DISTINCT] [TOP n [PERCENT] [WITH TIES]]column_specification [[AS] result_column][, column_specification [[AS] result_column]] ...Five ways to code column specificationsSource Option SyntaxBase table value All columns *Column name column_nameCalculated value Result of a calculation Arithmetic expression (see figure 3-6)Result of a concatenation String expression (see figure 3-5)Result of a function Function (see figure 3-7)Column specifications that use base table valuesThe * is used to retrieve all columnsSELECT *Column names are used to retrieve specific columnsSELECT VendorName, VendorCity, VendorStateColumn specifications that use calculated valuesAn arithmetic expression is used to calculate BalanceDueSELECT InvoiceNumber,InvoiceTotal - PaymentTotal – CreditTotal AS BalanceDueA string expression is used to calculate FullNameSELECT VendorContactFName + ' ' + VendorContactLName AS FullNameA function is used to calculate CurrentDateSELECT InvoiceNumber, InvoiceDate,GETDATE() AS CurrentDateDescription•Use SELECT * only when you need to retrieve all of the columns from a table. Otherwise,list the names of the columns you need.•An expression is a combination of column names and operators that evaluate to a singlevalue. In the SELECT clause, you can code arithmetic expressions, string expressions,and expressions that include one or more functions.•After each column specification, you can code an AS clause to specify the name for thecolumn in the result set. See figure 3-4 for details.Note•The other elements shown in the syntax summary above let you control the number ofrows that are returned by a query. You can use the ALL and DISTINCT keywords todetermine whether or not duplicate rows are returned. And you can use the TOP clauseto retrieve a specific number or percent of rows. See figures 3-8 and 3-9 for details.Figure 3-3 How to code column specifications86Section 2 The SQL skillsHow to name the columns in a result setBy default, a column in a result set is given the same name as the column inthe base table. However, you can specify a different name if you need to. Youcan also name a column that contains a calculated value. When you do that, thenew column name is called acolumn alias. Figure 3-4 presents two techniquesfor creating column aliases.The first technique is to code the column specification followed by the ASkeyword and the column alias. This is the ANSI-standard coding technique, andit’s illustrated by the first example in this figure. Here, a space is added betweenthe two words in the name of the InvoiceNumber column, the InvoiceDatecolumn is changed to just Date, and the InvoiceTotal column is changed toTotal. Notice that because a space is included in the name of the first column,it’s enclosed in brackets ([]). As you’ll learn in chapter 10, any name thatdoesn’t follow SQL Server’s rules for naming objects must be enclosed in eitherbrackets or double quotes. Column aliases can also be enclosed in single quotes.The second example in this figure illustrates another technique for creatinga column alias. Here, the column is assigned to an alias using an equal sign.This technique is only available with SQL Server, not with other types ofdatabases, and is included for compatibility with earlier versions of SQL Server.So although you may see this technique used in older code, I don’t recommendit for new statements you write.The third example in this figure illustrates what happens when you don’tassign an alias to a calculated column. Here, no name is assigned to the column,which usually isn’t what you want. That’s why you usually assign a name to anycolumn that’s calculated from other columns in the base table.Chapter 3 How to retrieve data from a single table87Two SELECT statements that name the columns in the result setA SELECT statement that uses the AS keyword (the preferred technique)SELECT InvoiceNumber AS [Invoice Number], InvoiceDate AS Date,InvoiceTotal AS TotalFROM InvoicesA SELECT statement that uses the equal operator (an older technique)SELECT [Invoice Number] = InvoiceNumber, Date = InvoiceDate,Total = InvoiceTotalFROM InvoicesThe result set for both SELECT statementsA SELECT statement that doesn’t provide a name for a calculated columnSELECT InvoiceNumber, InvoiceDate, InvoiceTotal,InvoiceTotal - PaymentTotal - CreditTotalFROM InvoicesDescription•By default, a column in the result set is given the same name as the column in the basetable. If that’s not what you want, you can specify acolumn alias or substitute name forthe column.•One way to name a column is to use the AS phrase as shown in the first example above.Although the AS keyword is optional, I recommend you code it for readability.•Another way to name a column is to code the name followed by an equal sign and thecolumn specification as shown in the second example above. This syntax is unique toTransact-SQL.•It’s generally considered a good practice to specify an alias for a column that contains acalculated value. If you don’t, no name is assigned to it as shown in the third exampleabove.•If an alias includes spaces or special characters, you must enclose it in double quotes orbrackets ([]). That’s true of all names you use in Transact-SQL. SQL Server also lets youenclose column aliases in single quotes for compatibility with earlier releases.Figure 3-4 How to name the columns in a result set88Section 2 TheSQL skillsHow to code string expressionsAstring expression consists of a combination of one or more charactercolumns andliteral values. To combine, or concatenate, the columns andvalues, you use theconcatenation operator (+). This is illustrated by the examplesin figure 3-5.The first example shows how to concatenate the VendorCity andVendorState columns in the Vendors table. Notice that because no alias isassigned to this column, it doesn’t have a name in the result set. Also notice thatthe data in the VendorState column appears immediately after the data in theVendorCity column in the results. That’s because of the way VendorCity isdefined in the database. Because it’s defined as a variable-length column (thevarchar data type), only the actual data in the column is included in the result. Incontrast, if the column had been defined with a fixed length, any spaces followingthe name would have been included in the result. You’ll learn about datatypes and how they affect the data in your result set in chapter 8.The second example shows how to format a string expression by addingspaces and punctuation. Here, the VendorCity column is concatenated with astring literal, or string constant, that contains a comma and a space. Then, theVendorState column is concatenated with that result, followed by a string literalthat contains a single space and the VendorZipCode column.Occasionally, you may need to include a single quotation mark or anapostrophe within a literal string. If you simply type a single quote, however,the system will misinterpret it as the end of the literal string. As a result, youmust code two quotation marks in a row. This is illustrated by the third examplein this figure.Chapter 3 How to retrieve data from a single table89How to concatenate string dataSELECT VendorCity, VendorState, VendorCity + VendorStateFROM VendorsHow to format string data using literal valuesSELECT VendorName,VendorCity + ', ' + VendorState + ' ' + VendorZipCode AS AddressFROM VendorsHow to include apostrophes in literal valuesSELECT VendorName + '''s Address: ',VendorCity + ', ' + VendorState + ' ' + VendorZipCodeFROM VendorsDescription•A string expression can consist of one or more character columns, one or more literalvalues, or a combination of character columns and literal values.•The columns specified in a string expression must contain string data (that means they’redefined with the char or varchar data type).•The literal values in a string expression also contain string data, so they can be calledstring literalsor string constants. To create a literal value, enclose one or more characterswithin single quotation marks (').•You can use the concatenation operator (+) to combine columns and literals in a stringexpression.•You can include a single quote within a literal value by coding two single quotationmarks as shown in the third example above.Figure 3-5 How to code string expressions90Section 2 The SQL skillsHow to code arithmetic expressionsFigure 3-6 shows how to codearithmetic expressions. To start, it summarizesthe fivearithmetic operators you can use in this type of expression. Then,it presents three examples that illustrate how you use these operators.The SELECT statement in the first example includes an arithmetic expressionthat calculates the balance due for an invoice. This expression subtracts thePaymentTotal and CreditTotal columns from the InvoiceTotal column. Theresulting column is given the name BalanceDue.When SQL Server evaluates an arithmetic expression, it performs theoperations from left to right based on theorder of precedence. This order saysthat multiplication, division, and modulo operations are done first, followed byaddition and subtraction. If that’s not what you want, you can use parentheses tospecify how you want an expression evaluated. Then, the expressions in theinnermost sets of parentheses are evaluated first, followed by the expressions inouter sets of parentheses. Within each set of parentheses, the expression isevaluated from left to right in the order of precedence. Of course, you can alsouse parentheses to clarify an expression even if they’re not needed for theexpression to be evaluated properly.To illustrate how parentheses and the order of precedence affect the evaluationof an expression, consider the second example in this figure. Here, theexpressions in the second and third columns both use the same operators. WhenSQL Server evaluates the expression in the second column, it performs themultiplication operation before the addition operation because multiplicationcomes before addition in the order of precedence. When SQL Server evaluatesthe expression in the third column, however, it performs the addition operationfirst because it’s enclosed in parentheses. As you can see in the result set shownhere, these two expressions result in different values.Although you’re probably familiar with the addition, subtraction, multiplication,and division operators, you may not be familiar with the modulo operator.This operator returns the remainder of a division of two integers. This isillustrated in the third example in this figure. Here, the second column containsan expression that returns the quotient of a division operation. Note that theresult of the division of two integers is always an integer. You’ll learn moreabout that in chapter 8. The third column contains an expression that returns theremainder of the division operation. If you study this example for a minute, youshould quickly see how this works.Chapter 3 How to retrieve data from a single table91The arithmetic operators in order of precedence*Multiplication/Division%Modulo (Remainder)+Addition-SubtractionA SELECT statement that calculates the balance dueSELECT InvoiceTotal, PaymentTotal, CreditTotal,InvoiceTotal - PaymentTotal - CreditTotal AS BalanceDueFROM InvoicesA SELECT statement that uses parentheses to control the sequence ofoperationsSELECT InvoiceID,InvoiceID + 7 * 3 AS OrderOfPrecedence,(InvoiceID + 7) * 3 AS AddFirstFROM InvoicesORDER BY InvoiceIDA SELECT statement that uses the modulo operatorSELECT InvoiceID,InvoiceID / 10 AS Quotient,InvoiceID % 10 AS RemainderFROM InvoicesORDER BY InvoiceIDDescription•Unless parentheses are used, the operations in an expression take place from left to rightin theorder of precedence. For arithmetic expressions, multiplication, division, andmodulo operations are done first, followed by addition and subtraction.•Whenever necessary, you can use parentheses to clarify or override the sequence ofoperations. Then, the operations in the innermost sets of parentheses are done first,followed by the operations in the next sets, and so on.Figure 3-6 How to code arithmetic expressions92Section 2 The SQL skillsHow to use functionsFigure 3-7 introduces you tofunctions and illustrates how you use them incolumn specifications. A function performs an operation and returns a value.For now, don’t worry about the details of how the functions shown here work.You’ll learn more about all of these functions in chapter 8. Instead, just focus onhow they’re used in column specifications.To code a function, you begin by entering its name followed by a set ofparentheses. If the function requires one or moreparameters, you enter themwithin the parentheses and separate them with commas. When you enter aparameter, you need to be sure it has the correct data type. You’ll learn moreabout that in chapter 8.The first example in this figure shows how to use the LEFT function toextract the first character of the VendorContactFName andVendorContactLName columns. The first parameter of this function specifiesthe string values, and the second parameter specifies the number of characters toreturn. The results of the two functions are then concatenated to form initials asshown in the result set for this statement.The second example shows how to use the CONVERT function to changethe data type of a value. This function requires two parameters. The first parameterspecifies the new data type, and the second parameter specifies the value toconvert. In addition, this function accepts an optional third parameter thatspecifies the format of the returned value. The first CONVERT function shownhere, for example, converts the PaymentDate column to a character value withthe format mm/dd/yy. And the second CONVERT function converts thePaymentTotal column to a variable-length character value that’s formatted withcommas. These functions are included in a string expression that concatenatestheir return values with the InvoiceNumber column and three literal values.The third example uses two functions that work with dates. The first one,GETDATE, returns the current date. Notice that although this function doesn’taccept any parameters, the parentheses are still included. The second function,DATEDIFF, gets the difference between two date values. This function requiresthree parameters. The first one specifies the units in which the result will beexpressed. In this example, the function will return the number of days betweenthe two dates. The second and third parameters specify the start date and the enddate. Here, the second parameter is the invoice date and the third parameter isthe current date, which is obtained using the GETDATE function.Chapter 3 How to retrieve data from a single table93A SELECT statement that uses the LEFT functionSELECT VendorContactFName, VendorContactLName,LEFT(VendorContactFName, 1) +LEFT(VendorContactLName, 1) AS InitialsFROM VendorsA SELECT statement that uses the CONVERT functionSELECT 'Invoice: #' + InvoiceNumber+ ', dated ' + CONVERT(char(8), PaymentDate, 1)+ ' for $' + CONVERT(varchar(9), PaymentTotal, 1)FROM InvoicesA SELECT statement that computes the age of an invoiceSELECT InvoiceDate,GETDATE() AS 'Today''s Date',DATEDIFF(day, InvoiceDate, GETDATE()) AS AgeFROM InvoicesDescription•An expression can include any of the functions that are supported by SQL Server. Afunction performs an operation and returns a value.•A function consists of the function name, followed by a set of parentheses that containsanyparameters, or arguments, required by the function. If a function requires two ormore arguments, you separate them with commas.•For more information on using functions, see chapter 8.Figure 3-7 How to use functions94Section 2 The SQL skillsHow to use the DISTINCT keyword to eliminateduplicate rowsBy default, all of the rows in the base table that satisfy the search conditionyou specify in the WHERE clause are included in the result set. In some cases,though, that means that the result set will contain duplicate rows, or rows whosecolumn values are identical. If that’s not what you want, you can include theDISTINCT keyword in the SELECT clause to eliminate the duplicate rows.Figure 3-8 illustrates how this works. Here, both SELECT statementsretrieve the VendorCity and VendorState columns from the Vendors table. Thefirst statement, however, doesn’t include the DISTINCT keyword. Because ofthat, the same city and state can appear in the result set multiple times. In theresults shown in this figure, for example, you can see that Anaheim CA occurstwice and Boston MA occurs three times. In contrast, the second statementincludes the DISTINCT keyword, so each city/state combination is includedonly once.Chapter 3 How to retrieve data from a single table95A SELECT statement that returns all rowsSELECT VendorCity, VendorStateFROM VendorsORDER BY VendorCity(122 rows)A SELECT statement that eliminates duplicate rowsSELECT DISTINCT VendorCity, VendorStateFROM Vendors(53 rows)Description•The DISTINCT keyword prevents duplicate (identical) rows from being included in theresult set. It also causes the result set to be sorted by its first column.•The ALL keyword causes all rows matching the search condition to be included in theresult set, regardless of whether rows are duplicated. Since this is the default, it’s acommon practice to omit the ALL keyword.•To use the DISTINCT or ALL keyword, code it immediately after the SELECT keywordas shown above.Figure 3-8 How to use the DISTINCT keyword to eliminate duplicate rows96Section 2 The SQL skillsHow to use the TOP clause to return a subset ofselected rowsIn addition to eliminating duplicate rows, you can limit the number of rowsthat are retrieved by a SELECT statement. To do that, you use the TOP clause.Figure 3-9 shows you how.You can use the TOP clause in one of two ways. First, you can use it toretrieve a specific number of rows from the beginning, or top, of the result set.To do that, you code the TOP keyword followed by an integer value that specifiesthe number of rows to be returned. This is illustrated in the first example inthis figure. Here, only five rows are returned. Notice that this statement alsoincludes an ORDER BY clause that sorts the rows by the InvoiceTotal columnin descending sequence. That way, the invoices with the highest invoice totalswill be returned.You can also use the TOP clause to retrieve a specific percent of the rows inthe result set. To do that, you include the PERCENT keyword as shown in thesecond example. In this case, the result set includes six rows, which is fivepercent of the total of 122 rows.By default, the TOP clause causes the exact number or percent of rows youspecify to be retrieved. However, if additional rows match the values in the lastrow, you can include those additional rows by including WITH TIES in the TOPclause. This is illustrated in the third example in this figure. Here, the SELECTstatement says to retrieve the top five rows from a result set that includes theVendorID and InvoiceDate columns sorted by the InvoiceDate column indescending sequence. As you can see, however, the result set includes six rowsinstead of five. That’s because WITH TIES is included in the TOP clause, andthe columns in the sixth row have the same values as the columns in the fifthrow.Chapter 3 How to retrieve data from a single table97A SELECT statement with a TOP clauseSELECT TOP 5 VendorID, InvoiceTotalFROM InvoicesORDER BY InvoiceTotal DESCA SELECT statement with a TOP clause and the PERCENT keywordSELECT TOP 5 PERCENT VendorID, InvoiceTotalFROM InvoicesORDER BY InvoiceTotal DESCA SELECT statement with a TOP clause and the WITH TIES keywordSELECT TOP 5 WITH TIES VendorID, InvoiceDateFROM InvoicesORDER BY InvoiceDate DESCDescription•You can use the TOP clause within a SELECT clause to limit the number of rowsincluded in the result set. When you use this clause, the firstn rows that meet the searchcondition are included, wheren is an integer.•If you include PERCENT, the first n percent of the selected rows are included in theresult set.•If you include WITH TIES, additional rows will be included if their values match, or tie,the values of the last row.•You should include an ORDER BY clause whenever you use the TOP keyword. Otherwise,the rows in the result set will be in no particular sequence.Figure 3-9 How to use the TOP clause to return a subset of selected rows98Section 2 The SQL skillsHow to code the WHERE clauseEarlier in this chapter, I mentioned that to improve performance, you shouldcode your SELECT statements so they retrieve only the columns you need. Thatgoes for retrieving rows too: The fewer rows you retrieve, the more efficient thestatement will be. Because of that, you’ll almost always include a WHEREclause on your SELECT statements with a search condition that filters the rowsin the base table so that only the rows you need are retrieved. In the topics thatfollow, you’ll learn a variety of ways to code this clause.How to use comparison operatorsFigure 3-10 shows you how to use thecomparison operators in the searchcondition of a WHERE clause. As you can see in the syntax summary at the topof this figure, you use a comparison operator to compare two expressions. If theresult of the comparison is True, the row being tested is included in the queryresults.The examples in this figure show how to use some of the comparisonoperators. The first WHERE clause, for example, uses the equal operator (=) toretrieve only those rows whose VendorState column have a value of IA. Sincethe state code is a string literal, it must be included in single quotes. In contrast,the numeric literal used in the second WHERE clause is not enclosed in quotes.This clause uses the greater than (>) operator to retrieve only those rows thathave a balance due greater than zero.The third WHERE clause illustrates another way to retrieve all the invoiceswith a balance due. Like the second clause, it uses the greater than operator.Instead of comparing the balance due to a value of zero, however, it comparesthe invoice total to the total of the payments and credits that have been appliedto the invoice.The fourth WHERE clause illustrates how you can use comparison operatorsother than the equal operator with string data. In this example, the less thanoperator (<) is used to compare the value of the VendorName column to a literalstring that contains the letter M. That will cause the query to return all vendorswith names that begin with the letters A through L.You can also use the comparison operators with date literals, as illustratedby the fifth and sixth WHERE clauses. The fifth clause will retrieve rows withinvoice dates on or before May 31, 2006, and the sixth clause will retrieve rowswith invoice dates on or after May 1, 2006. Like string literals, date literals mustbe enclosed in single quotes. In addition, you can use different formats tospecify dates as shown by the two date literals shown in this figure. You’ll learnmore about the acceptable date formats in chapter 8.The last WHERE clause shows how you can test for a not equal condition.To do that, you code a less than sign followed by a greater than sign. In thiscase, only rows with a credit total that’s not equal to zero will be retrieved.Chapter 3 How to retrieve data from a single table99The syntax of the WHERE clause with comparison operatorsWHERE expression_1 operator expression_2The comparison operators=Equal>Greater than<Less than<=Less than or equal to>=Greater than or equal to<>Not equalExamples of WHERE clauses that retrieve…Vendors located in IowaWHERE VendorState = 'IA'Invoices with a balance due (two variations)WHERE InvoiceTotal – PaymentTotal – CreditTotal > 0WHERE InvoiceTotal > PaymentTotal + CreditTotalVendors with names from A to LWHERE VendorName < 'M'Invoices on or before a specified dateWHERE InvoiceDate <= '2006-05-31'Invoices on or after a specified dateWHERE InvoiceDate >= '5/1/06'Invoices with credits that don’t equal zeroWHERE CreditTotal <> 0Description•You can use a comparison operator to compare any two expressions that result in likedata types. Although unlike data types may be converted to data types that can becompared, the comparison may produce unexpected results.•If a comparison results in a True value, the row being tested is included in the result set.If it’s False or Unknown, the row isn’t included.•To use a string literal or a date literal in a comparison, enclose it in quotes. To use anumeric literal, enter the number without quotes.•Character comparisons performed on SQL Server databases are not case-sensitive. So,for example, ‘CA’ and ‘Ca’ are considered equivalent.Figure 3-10 How to use the comparison operators100Section 2 The SQL skillsWhenever possible, you should compare expressions that have similar datatypes. If you attempt to compare expressions that have different data types, SQLServer may implicitly convert the data type for you. Often, this implicit conversionis acceptable. However, implicit conversions will occasionally yieldunexpected results. In that case, you can use the CONVERT function you sawearlier in this chapter or the CAST function you’ll learn about in chapter 8 toexplicitly convert data types so the comparison yields the results you want.How to use the AND, OR, and NOT logicaloperatorsFigure 3-11 shows how to uselogical operators in a WHERE clause. Youcan use the AND and OR operators to combine two or more search conditionsinto acompound condition. And you can use the NOT operator to negate asearch condition. The examples in this figure illustrate how these operatorswork.The first two examples illustrate the difference between the AND and ORoperators. When you use the AND operator, both conditions must be true. So, inthe first example, only those vendors in New Jersey whose year-to-date purchasesare greater than 200 are retrieved from the Vendors table (2 rows). Whenyou use the OR operator, though, only one of the conditions must be true. So, inthe second example, all the vendors from New Jersey and all the vendors whoseyear-to-date purchases are greater than 200 are retrieved (76 rows).The third example shows a compound condition that uses two NOT operators.As you can see, this expression is somewhat difficult to understand.Because of that, and because using the NOT operator can reduce system performance,you should avoid using this operator whenever possible. The fourthexample in this figure, for instance, shows how the search condition in the thirdexample can be rephrased to eliminate the NOT operator. Notice that thecondition in the fourth example is much easier to understand.The last two examples in this figure show how the order of precedence forthe logical operators and the use of parentheses affect the result of a searchcondition. By default, the NOT operator is evaluated first, followed by AND andthen OR. However, you can use parentheses to override the order of precedenceor to clarify a logical expression, just as you can with arithmetic expressions. Inthe next to last example, for instance, no parentheses are used, so the twoconditions connected by the AND operator are evaluated first. In the last example,though, parentheses are used so that the two conditions connected by theOR operator are evaluated first. If you take a minute to review the results shownin this figure, you should be able to see how these two conditions differ.Chapter 3 How to retrieve data from a single table101The syntax of the WHERE clause with logical operatorsWHERE [NOT] search_condition_1 {AND|OR} [NOT] search_condition_2 ...Examples of queries using logical operatorsA search condition that uses the AND operatorWHERE VendorState = 'NJ' AND YTDPurchases > 200A search condition that uses the OR operatorWHERE VendorState = 'NJ' OR YTDPurchases > 200A search condition that uses the NOT operatorWHERE NOT (InvoiceTotal >= 5000 OR NOT InvoiceDate <= '2006-07-01')The same condition rephrased to eliminate the NOT operatorWHERE InvoiceTotal < 5000 AND InvoiceDate <= '2006-07-01'A compound condition without parenthesesWHERE InvoiceDate > '05/01/2006'OR InvoiceTotal > 500AND InvoiceTotal - PaymentTotal - CreditTotal > 0(91 rows)The same compound condition with parenthesesWHERE (InvoiceDate > '05/01/2006'OR InvoiceTotal > 500)AND InvoiceTotal - PaymentTotal - CreditTotal > 0(39 rows)Description•You can use the AND and OR logical operators to create compound conditions thatconsist of two or more conditions. You use the AND operator to specify that the searchmust satisfy both of the conditions, and you use the OR operator to specify that thesearch must satisfy at least one of the conditions.•You can use the NOT operator to negate a condition. Because this operator can make thesearch condition difficult to read, you should rephrase the condition if possible so itdoesn’t use NOT.•When SQL Server evaluates a compound condition, it evaluates the operators in thissequence: (1) NOT, (2) AND, and (3) OR. You can use parentheses to override this orderof precedence or to clarify the sequence in which the operations will be evaluated.Figure 3-11 How to use the AND, OR, and NOT logical operators102Section 2 TheSQL skillsHow to use the IN operatorFigure 3-12 shows how to code a WHERE clause that uses the IN operator.When you use this operator, the value of the test expression is compared withthe list of expressions in the IN phrase. If the test expression is equal to one ofthe expressions in the list, the row is included in the query results. This isillustrated by the first example in this figure, which will return all rows whoseTermsID column is equal to 1, 3, or 4.You can also use the NOT operator with the IN phrase to test for a valuethat’s not in a list of expressions. This is illustrated by the second example inthis figure. In this case, only those vendors who are not in California, Nevada,or Oregon are retrieved.If you look at the syntax of the IN phrase shown at the top of this figure,you’ll see that you can code asubquery in place of a list of expressions.Subqueries are a powerful tool that you’ll learn about in detail in chapter 6. Fornow, though, you should know that a subquery is simply a SELECT statementwithin another statement. In the third example in this figure, for instance, asubquery is used to return a list of VendorID values for vendors who haveinvoices dated May 1, 2006. Then, the WHERE clause retrieves a vendor rowonly if the vendor is in that list. Note that for this to work, the subquery mustreturn a single column, in this case, VendorID.Chapter 3 How to retrieve data from a single table103The syntax of the WHERE clause with an IN phraseWHERE test_expression [NOT] IN ({subquery|expression_1 [, expression_2]...})Examples of the IN phraseAn IN phrase with a list of numeric literalsWHERE TermsID IN (1, 3, 4)An IN phrase preceded by NOTWHERE VendorState NOT IN ('CA', 'NV', 'OR')An IN phrase with a subqueryWHERE VendorID IN(SELECT VendorIDFROM InvoicesWHERE InvoiceDate = '2006-05-01')Figure 3-12 How to use the IN operatorDescription•You can use the IN phrase to test whether an expression is equal to a value in a list ofexpressions. Each of the expressions in the list must evaluate to the same type of data asthe test expression.•The list of expressions can be coded in any order without affecting the order of the rowsin the result set.•You can use the NOT operator to test for an expression that’s not in the list of expressions.•You can also compare the test expression to the items in a list returned by a subquery asillustrated by the third example above. You’ll learn more about coding subqueries inchapter 6.104Section 2 The SQL skillsHow to use the BETWEEN operatorFigure 3-13 shows how to use the BETWEEN operator in a WHERE clause.When you use this operator, the value of a test expression is compared to therange of values specified in the BETWEEN phrase. If the value falls within thisrange, the row is included in the query results.The first example in this figure shows a simple WHERE clause that uses theBETWEEN operator. It retrieves invoices with invoice dates between May 1,2006 and May 31, 2006. Note that the range is inclusive, so invoices with invoicedates of May 1 and May 31 are included in the results.The second example shows how to use the NOT operator to select rows thatare not within a given range. In this case, vendors with zip codes that aren’tbetween 93600 and 93799 are included in the results.The third example shows how you can use a calculated value in the testexpression. Here, the PaymentTotal and CreditTotal columns are subtracted fromthe InvoiceTotal column to give the balance due. Then, this value is compared tothe range specified in the BETWEEN phrase.The last example shows how you can use calculated values in the BETWEENphrase. Here, the first value is the result of the GETDATE function, and thesecond value is the result of the GETDATE function plus 30 days. So the queryresults will include all those invoices that are due between the current date and 30days from the current date.Chapter 3 How to retrieve data from a single table105The syntax of the WHERE clause with a BETWEEN phraseWHERE test_expression [NOT] BETWEEN begin_expression AND end_expressionExamples of the BETWEEN phraseA BETWEEN phrase with literal valuesWHERE InvoiceDate BETWEEN '2006-05-01' AND '2006-05-31'A BETWEEN phrase preceded by NOTWHERE VendorZipCode NOT BETWEEN 93600 AND 93799A BETWEEN phrase with a test expression coded as a calculated valueWHERE InvoiceTotal– PaymentTotal – CreditTotal BETWEEN 200 AND 500A BETWEEN phrase with the upper and lower limits coded as calculatedvaluesWHERE InvoiceDueDate BETWEEN GetDate() AND GetDate() + 30Description•You can use the BETWEEN phrase to test whether an expression falls within a range ofvalues. The lower limit must be coded as the first expression, and the upper limit must becoded as the second expression. Otherwise, the result set will be empty.•The two expressions used in the BETWEEN phrase for the range of values are inclusive.That is, the result set will include values that are equal to the upper or lower limit.•You can use the NOT operator to test for an expression that’s not within the given range.Figure 3-13 How to use the BETWEEN operator106Section 2 The SQL skillsHow to use the LIKE operatorOne final operator you can use in a search condition is the LIKE operatorshown in figure 3-14. You use this operator along with thewildcards shown atthe top of this figure to specify astring pattern, or mask, you want to match.The examples shown in this figure illustrate how this works.In the first example, the LIKE phrase specifies that all vendors in cities thatstart with the letters SAN should be included in the query results. Here, thepercent sign (%) indicates that any characters can follow these three letters. SoSan Diego and Santa Ana are both included in the results.The second example selects all vendors whose vendor name starts with theletters COMPU, followed by any one character, the letters ER, and any charactersafter that. Two vendor names that match that pattern are Compuserve andComputerworld.The third example searches the values in the VendorContactLName columnfor a name that can be spelled two different ways: Damien or Damion. To dothat, the mask specifies the two possible characters in the fifth position, E andO, within brackets.The fourth example uses brackets to specify a range of values. In this case,the VendorState column is searched for values that start with the letter N andend with any letter from A to J. That excludes states like Nevada (NV) and NewYork (NY).The fifth example shows how to use the caret (^) to exclude one or morecharacters from the pattern. Here, the pattern says that the value in theVendorState column must start with the letter N, but must not end with theletters K through Y. This produces the same result as the previous statement.The last example in this figure shows how to use the NOT operator with aLIKE phrase. The condition in this example tests the VendorZipCode columnfor values that don’t start with the numbers 1 through 9. The result is all zipcodes that start with the number 0.The LIKE operator provides a powerful technique for finding information ina database that can’t be found using any other technique. Keep in mind, however,that this technique requires a lot of overhead, so it can reduce systemperformance. For this reason, you should avoid using the LIKE operator inproduction SQL code whenever possible.Chapter 3 How to retrieve data from a single table107The syntax of the WHERE clause with a LIKE phraseWHERE match_expression [NOT] LIKE patternWildcard symbolsSymbol Description% Matches any string of zero or more characters._ Matches any single character.[ ] Matches a single character listed within the brackets.[ - ] Matches a single character within the given range.[ ^ ] Matches a single character not listed after the caret.WHERE clauses that use the LIKE operatorExample Results that match the maskWHERE VendorCity LIKE 'SAN%'“San Diego” and “Santa Ana”WHERE VendorName LIKE 'COMPU_ER%'“Compuserve” and “Computerworld”WHERE VendorContactLName LIKE 'DAMI[EO]N'“Damien” and “Damion”WHERE VendorState LIKE 'N[A-J]'“NC” and “NJ” but not “NV” or “NY”WHERE VendorState LIKE 'N[^K-Y]'“NC” and “NJ” but not “NV” or “NY”WHERE VendorZipCode NOT LIKE '[1-9]%'“02107” and “08816”Description•You use the LIKE operator to retrieve rows that match a string pattern, called a mask.Within the mask, you can use special characters, calledwildcards, that determine whichvalues in the column satisfy the condition.•You can use the NOT keyword before the LIKE keyword. Then, only those rows withvalues that don’t match the string pattern will be included in the result set.•Most LIKE phrases will significantly degrade performance compared to other types ofsearches, so use them only when necessary.Figure 3-14 How to use the LIKE operator108Section 2 TheSQL skillsHow to use the IS NULL clauseIn chapter 1, you learned that a column can contain anull value. A null isn’tthe same as zero, a blank string that contains one or more spaces ( ' ' ), or anempty string ( '' ). Instead, a null value indicates that the data is not applicable,not available, or unknown. When you allow null values in one or more columns,you need to know how to test for them in search conditions. To do that, you canuse the IS NULL clause as shown in figure 3-15.This figure uses a table named NullSample to illustrate how to search fornull values. This table contains two columns. The first column, InvoiceID, is anidentity column. The second column, InvoiceTotal, contains the total for theinvoice, which can be a null value. As you can see in the first example, theinvoice with InvoiceID 3 contains a null value.The second example in this figure shows what happens when you retrieveall the invoices with invoice totals equal to zero. Notice that the row that has anull invoice total isn’t included in the result set. Likewise, it isn’t included in theresult set that contains all the invoices with invoices totals that aren’t equal tozero, as illustrated by the third example. Instead, you have to use the IS NULLclause to retrieve rows with null values, as shown in the fourth example.You can also use the NOT operator with the IS NULL clause as illustratedin the last example in this figure. When you use this operator, all of the rowsthat don’t contain null values are included in the query results.Chapter 3 How to retrieve data from a single table109The syntax of the WHERE clause with the IS NULL clauseWHERE expression IS [NOT] NULLThe contents of the NullSample tableSELECT *FROM NullSampleFigure 3-15 How to use the IS NULL clauseA SELECT statement that retrieves rows with zero valuesSELECT *FROM NullSampleWHERE InvoiceTotal = 0A SELECT statement that retrieves rows with non-zero valuesSELECT *FROM NullSampleWHERE InvoiceTotal <> 0A SELECT statement that retrieves rows with null valuesSELECT *FROM NullSampleWHERE InvoiceTotal IS NULLA SELECT statement that retrieves rows without null valuesSELECT *FROM NullSampleWHERE InvoiceTotal IS NOT NULLDescription•A null value represents a value that’s unknown, unavailable, or not applicable. It isn’t thesame as a zero, a blank space (' '), or an empty string ('').•To test for a null value, you can use the IS NULL clause. You can also use the NOTkeyword with this clause to test for values that aren’t null.•The definition of each column in a table indicates whether or not it can store null values.Before you work with a table, you should identify those columns that allow null valuesso you can accommodate them in your queries.Note•SQL Server provides an extension that lets you use = NULL to test for null values. Forthis to work, however, the ANSI_NULLS system option must be set to OFF. For moreinformation on this option, see Books Online.110Section 2 The SQL skillsHow to code the ORDER BY clauseThe ORDER BY clause specifies the sort order for the rows in a result set.In most cases, you can use column names from the base table to specify the sortorder as you saw in some of the examples earlier in this chapter. However, youcan also use other techniques to sort the rows in a result set, as described in thetopics that follow.How to sort a result set by a column nameFigure 3-16 presents the expanded syntax of the ORDER BY clause. As youcan see, you can sort by one or more expressions in either ascending or descendingsequence. This is illustrated by the three examples in this figure.The first two examples show how to sort the rows in a result set by a singlecolumn. In the first example, the rows in the Vendors table are sorted in ascendingsequence by the VendorName column. Since ascending is the defaultsequence, the ASC keyword is omitted. In the second example, the rows aresorted by the VendorName column in descending sequence.To sort by more then one column, you simply list the names in the ORDERBY clause separated by commas as shown in the third example. Here, the rowsin the Vendors table are first sorted by the VendorState column in ascendingsequence. Then, within each state, the rows are sorted by the VendorCitycolumn in ascending sequence. Finally, within each city, the rows are sorted bythe VendorName column in ascending sequence. This can be referred to as anested sortbecause one sort is nested within another.Although all of the columns in this example are sorted in ascending sequence,you should know that doesn’t have to be the case. For example, I couldhave sorted by the VendorName column in descending sequence like this:ORDER BY VendorState, VendorCity, VendorName DESCNote that the DESC keyword in this example applies only to the VendorNamecolumn. The VendorState and VendorCity columns are still sorted in ascendingsequence.Chapter 3 How to retrieve data from a single table111The expanded syntax of the ORDER BY clauseORDER BY expression [ASC|DESC] [, expression [ASC|DESC]] ...An ORDER BY clause that sorts by one column in ascending sequenceSELECT VendorName,VendorCity + ', ' + VendorState + ' ' + VendorZipCode AS AddressFROM VendorsORDER BY VendorNameAn ORDER BY clause that sorts by one column in descending sequenceSELECT VendorName,VendorCity + ', ' + VendorState + ' ' + VendorZipCode AS AddressFROM VendorsORDER BY VendorName DESCAn ORDER BY clause that sorts by three columnsSELECT VendorName,VendorCity + ', ' + VendorState + ' ' + VendorZipCode AS AddressFROM VendorsORDER BY VendorState, VendorCity, VendorNameDescription•The ORDER BY clause specifies how you want the rows in the result set sorted. You cansort by one or more columns, and you can sort each column in either ascending (ASC) ordescending (DESC) sequence. ASC is the default.•By default, in an ascending sort, nulls appear first in the sort sequence, followed byspecial characters, then numbers, then letters. Although you can change this sequence,that’s beyond the scope of this book.•You can sort by any column in the base table regardless of whether it’s included in theSELECT clause. The exception is if the query includes the DISTINCT keyword. Then,you can only sort by columns included in the SELECT clause.Figure 3-16 How to sort a result set by a column name112Section 2 TheSQL skillsHow to sort a result set by an alias, an expression,or a column numberFigure 3-17 presents three more techniques you can use to specify sortcolumns. First, you can use a column alias that’s defined in the SELECT clause.The first SELECT statement in this figure, for example, sorts by a column namedAddress, which is an alias for the concatenation of the VendorCity, VendorState,and VendorZipCode columns. Within the Address column, the result set is alsosorted by the VendorName column.You can also use an arithmetic or string expression in the ORDER BY clause,as illustrated by the second example in this figure. Here, the expression consistsof the VendorContactLName column concatenated with theVendorContactFName column. Here, neither of these columns is included in theSELECT clause. Although SQL Server allows this seldom-used coding technique,many other database systems do not.The last example in this figure shows how you can use column numbers tospecify a sort order. To use this technique, you code the number that correspondsto the column of the result set, where 1 is the first column, 2 is the secondcolumn, and so on. In this example, the ORDER BY clause sorts the result set bythe second column, which contains the concatenated address, then by the firstcolumn, which contains the vendor name. The result set returned by this statementis the same as the result set returned by the first statement. Notice, however,that the statement that uses column numbers is more difficult to read because youhave to look at the SELECT clause to see what columns the numbers refer to. Inaddition, if you add or remove columns from the SELECT clause, you may alsohave to change the ORDER BY clause to reflect the new column positions. As aresult, you should avoid using this technique.Chapter 3 How to retrieve data from a single table113An ORDER BY clause that uses an aliasSELECT VendorName,VendorCity + ', ' + VendorState + ' ' + VendorZipCode AS AddressFROM VendorsORDER BY Address, VendorNameAn ORDER BY clause that uses an expressionSELECT VendorName,VendorCity + ', ' + VendorState + ' ' + VendorZipCode AS AddressFROM VendorsORDER BY VendorContactLName + VendorContactFNameAn ORDER BY clause that uses column positionsSELECT VendorName,VendorCity + ', ' + VendorState + ' ' + VendorZipCode AS AddressFROM VendorsORDER BY 2, 1Description•The ORDER BY clause can include a column alias that’s specified in the SELECTclause.•The ORDER BY clause can include any valid expression. The expression can refer toany column in the base table, even if it isn’t included in the result set.•The ORDER BY clause can use numbers to specify the columns to use for sorting. Inthat case, 1 represents the first column in the result set, 2 represents the second column,and so on.Figure 3-17 How to sort a result set by an alias, an expression, or a column number114Section 2 The SQL skillsPerspectiveThe goal of this chapter has been to teach you the basic skills for codingSELECT statements. You’ll use these skills in almost every SELECT statementyou code. As you’ll see in the chapters that follow, however, there’s a lot more tocoding SELECT statements than what’s presented here. In the next three chapters,then, you’ll learn additional skills for coding SELECT statements. When youcomplete those chapters, you’ll know everything you need to know about retrievingdata from a SQL Server database.TermskeywordfilterBoolean expressionpredicateexpressioncolumn aliassubstitute namestring expressionconcatenateconcatenation operatorliteral valuestring literalstring constantarithmetic expressionarithmetic operatororder of precedencefunctionparameterargumentdate literalcomparison operatorlogical operatorcompound conditionsubquerystring patternmaskwildcardnull valuenested sort
- Senior Systems Engineer (MS Server OS & Linux Server OS) Fidelity Investments - Westlake, TX
End User Computing, an internal division of Fidelity Investments, is making employee IT a competitive advantage. By focusing on user experience, we are enabling employees to be...From Fidelity Investments - 26 days ago
- Engineering Designer Server Technology - Reno, NV
skillsAlong with a competitive base salary, Server Technology offers a fantastic benefits ... a great, fast paced, working environment. Server Technology has been voted one of...From CareerBuilder - 16 days ago
- Client Server Consultant (Client Server) Cynergies Consulting - Highland Heights, OH
Job Title: Client Server Consultant (Client Server) Profession: Computer Engineering and ... IT Apps Programmer Consultant ( Client Server) Job Description Section: Cynergies...From Jobfox - 13 days ago
- Python Server Engineer - Python Systems / Server Engineer Cybercoders - New York, NY
Python Server Engineer - Python Systems / Server Engineer - Top Funded Mobile Based ... Python Server Engineer - Python Systems / Server Engineer position, and have a...From Sologig - 17 days ago
- Servers, Lounge Servers and Bartenders Uno Chicago Grill - Henrietta, NY
At Uno Chicago Grill, you can have fun and take pride in providing an enjoyable dining experience to our expanding customer base and in building a solid career and hefty paycheck!...From Snagajob - 30+ days ago
- SQL Server Developer - Server Admin & Security job - new Robert Half Technology - Ewing, NJ +1 location
Title SQL Server Developer Our client in Princeton, NJ is seeking a SQL Server Developer / ... Requirements: Advanced Microsoft SQL Server, Advanced T-SQL, Advanced SSAS (SQL...From FINS.com - 3 days ago
- SQL Server DBA SQL Server 2008 2005 Pri Technology - New York, NY
SQL SERVER DBA SQL SERVER 2008 2005 Major firm located in Midtown, Manhattan is seeking a ... your availability for this full time SQL Server DBA position. The ideal candidate...From TheLadders.com - 30+ days ago
- SQl server Developer - SQL Server 2005 R2 Analysis MDX .NET SharePoint 2007 SSIS Compnova - Atlanta, GA
-SQL Server 2005 / SQL Server 2008 R2 SQL Server Reporting Services -SQL Server ... Experience Need 1) SQL Server 2005 / SQL Server 2008 R2 Expert Required 2) SQL Server...From Corp-Corp.com - 4 days ago
- Servers, Take Out Servers, Back Waiters & Hosts Pf Chang's China Bistro - Plymouth Meeting, PA
We are currently looking for Servers, Take Out Servers, Back Waiters & Hosts/Hostesses at our Plymouth Meeting location to help us continue to meet the spoken and unspoken needs...From Snagajob - 30+ days ago
- SQL Server DBA - Server Admin & Security job Randstad - Charlotte, NC
maintenance of highly-available MS SQL Server database management systems. ... Understanding of, and experience with, server-client computing and relational...From FINS.com - 4 days ago
sql server
Tuesday, December 20, 2011
SqlServer
Subscribe to:
Posts (Atom)