Mega Code Archive
Search
.Net
ASP .Net
ASP .Net Tutorial
C#
C# Book
C# by API
C# Tutorial
VB.Net
VB.Net by API
VB.Net Tutorial
Visual C++ .Net
VisualBasic Script
Java
Java
Java Book
Java by API
Java Tutorial
Script
Flash ActionScript
Flex
JavaScript DHTML
JavaScript Reference
JavaScript Tutorial
Database
MSSQL
MSSQL Tutorial
MySQL
MySQL Tutorial
Oracle PLSQL
Oracle PLSQL Tutorial
PostgreSQL
Languages
Android
C
C Tutorial
C++
C++ Tutorial
Delphi
Perl
PHP
Python
Python Tutorial
Ruby
Silverlight
Office
MSOfficeExcel 2007 Tutorial
MSOfficePowerPoint 2007 Tutorial
MSOfficeWord 2007 Tutorial
Data
XML
XML Tutorial
MSSQL
Select Query 162 codes
Home
MSSQL
Select Query
1 A SELECT command returning all the columns and all the rows from the Employee table
2 A SELECT statement that uses the modulo operator
3 A simple CASE takes an expression that equates to a Boolean result
4 A statement that names just the calculated column in its SELECT clause
5 Add the TOP statement
6 Add value to a date
7 Alias = Column
8 Alias every column
9 ALL with comparison operator for a subquery
10 An expression can also be a part of the condition in the WHERE clause
11 An expression-type result set can be aliased and treated as if it were a table
12 An IN operator allows the specification of two or more expressions for a query search
13 Any
14 Between and for a number data type
15 BETWEEN Operator for Date data type
16 BETWEEN operator is equal to two individual comparisons, which are connected with the Boolean operator AND
17 BETWEEN operator specifies a range
18 CASE
19 Case when and else
20 Case when NULL
21 Case when statement in a procedure
22 Case When with else
23 Case when with Mod and ABS()
24 Checks for existing Product record
25 Column Alias demo
26 Column aliases
27 Column AS Alias
28 Combine MAX function with group by
29 Combine MIN function with group by
30 Combine two conditions in Having clause
31 Combine value from different columns
32 Count distinct values
33 Count function deals with NULL values
34 Count with group by
35 Count() and Sum() with group by and column alias
36 Date value comparision
37 Deal with quotation mark
38 Dealing with NULL Data - the ISNULL Function
39 Define variable to query top number of records
40 Descending order
41 DISTINCT clause can be used only once in a SELECT list, precede all column names in that list
42 Distinct order
43 Dynamically set the number of percent returned
44 EXISTS function can be used to represent the ANY and ALL operators
45 Function result with AS
46 Get full details of all departments using
47 Get the bottom two rows by using a TOP keyword and specifying the ORDER BY clause
48 Get the top two rows by using a TOP keyword and specifying the ORDER BY clause with a column name
49 GROUP BY builds different groups for all possible values (NULL, too!)
50 GROUP BY clause with an aggregator SUM()
51 Group by, having and order
52 HAVING clause can also be used without aggregates
53 HAVING with the aggregate function COUNT()
54 Identify the columns in the ORDER BY clause by the ordinal position of the column in the SELECT list
55 In an ascending order
56 IN for number value
57 IN for varchar value
58 IN is equivalent to a series of conditions, connected with one or more OR operators
59 IN operator
60 Insert into a temporary table
61 Inserting Several Records in a Query Batch
62 Is NOT NULL
63 IS NULL
64 ISNULL allows a display of the specified value as substitution for NULL
65 ISNULL function demo
66 ISNULL with subquery
67 ISNULL(5, 15)
68 LIKE %[k-l]%
69 LIKE ^A% (begining with A)
70 LIKE A_____
71 LIKE operator with NOT
72 Like statement with two variables
73 Like with escape
74 Like with variable
75 Like with variable and wild card character
76 Limiting the Search result using where clause
77 List of Comparison Operators
78 Logical operators with Parenthesis
79 MAX RECURSION Option
80 NOT between and
81 NOT changes the logical value of the corresponding condition
82 Not equal operator in SQL server
83 NOT EXISTS function
84 Not greater than
85 NOT IN
86 Not less than
87 NOT NULL column
88 NOT operator can be replaced by the comparison operator (not equal)
89 NOT Operator Demo
90 Operator Precedence demo
91 Or operator
92 Order by date
93 ORDER BY is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR X
94 Order by two columns
95 Order criterion may contain more than one column
96 Order in descending order
97 Order stringchar value descending
98 Order the result set by ascending order
99 Placing Conditions on Groups with the HAVING Clause
100 Put the DESC in the first item in order by clause
101 Put the sort direction against each item in the ORDER BY clause
102 Queries Involving Null Values
103 Query a single column
104 Query a single row
105 Replacing a NULL Value with an Alternative Value
106 See all the ties for a rank
107 SELECT
108 Select a single row
109 Select case statement
110 Select data into
111 Select distinct value
112 Select with Case when
113 Simple group by demo
114 Sorting Results
115 Specific column names are defined in the query
116 Specifying Items to Select from a Data Source
117 Subquery as one column
118 Testing numeric values with bitwise operators
119 TOP 10 PERCENT with order by
120 TOP 2 WITH TIES
121 TOP Clause in DELETE Statements
122 Top percent with where clause
123 Top percent without where clause
124 Top with descending order
125 Use AND operator in where clause
126 Use AS to add column alias
127 Use Between and operator on a date data type
128 Use CASE in the UPDATE statement
129 Use like to filter strings
130 Use logical operator in where clause
131 Use logical operator to compare date
132 Use logical operator to compare string
133 Use MIN and MAX function with column alias
134 Use NOT EXISTS to represent the ALL operator
135 Use NOT operator in where clause
136 Use of a comparison operator in the WHERE clause
137 Use OR to connect between and and another logical operator
138 Use query in where clause
139 Use regular expressions to retrieve table data
140 Use SUM function with having clause
141 Use the ORDER BY clause
142 Use variable in where statement
143 Use your function in select statement
144 Using a CASE Expression in an ORDER BY Clause
145 Using a CASE Expression in an ORDER BY Clause (Alternative)
146 Using defined variables in where clause
147 Using EXISTS Operator for a subquery
148 Using Functions in Queries
149 Using HAVING Clause as a where clause
150 Using ISNULL in select statement
151 Using Order By clause to order result
152 Using Parentheses
153 Using select into to create a temporary table
154 Using the CASE Statement
155 Using TOP in select statement
156 Variable with wrong data type
157 When grouping on more than one column, every unique combination of grouped values produces a row in the result set
158 WHERE clause conditions can either be simple or contain multiple conditions
159 Where value IS NULL
160 Wildcard characters recognized by SQL Server for use in regular expressions
161 With demo
162 With function with aggregate function