<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Global Knowledge Training Blog &#187; SQL Server</title>
	<atom:link href="http://globalknowledgeblog.com/category/technology/microsoft/sql-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://globalknowledgeblog.com</link>
	<description>Your Source for Technical, Professional, &#38; Leadership Training</description>
	<lastBuildDate>Thu, 17 May 2012 17:34:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Navigating Microsoft SQL 2012 Certifications</title>
		<link>http://globalknowledgeblog.com/certification/navigating-microsoft-sql-2012-certifications/</link>
		<comments>http://globalknowledgeblog.com/certification/navigating-microsoft-sql-2012-certifications/#comments</comments>
		<pubDate>Thu, 19 Apr 2012 12:31:35 +0000</pubDate>
		<dc:creator>Randy Muller</dc:creator>
				<category><![CDATA[Certification]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[SQL 2012]]></category>

		<guid isPermaLink="false">http://globalknowledgeblog.com/?p=5595</guid>
		<description><![CDATA[The whole SQL world is an interesting place, part Database Admin, part Developer, and part system administrator all rolled into one neat package. Well, knowing some of them, maybe not so neat. Theirs is a difficult world because of the different areas they must master – back up the database, write cleaner and more efficient and secure code, come up with new queries, study for the new SQL 2012 exams coming out in June (oops, didn’t want to slip that in too soon).]]></description>
			<content:encoded><![CDATA[<p><a href="http://globalknowledgeblog.com/wp-content/uploads/2012/04/navigate78247433.jpg"><img class="alignright size-full wp-image-5606" title="navigate78247433" src="http://globalknowledgeblog.com/wp-content/uploads/2012/04/navigate78247433.jpg" alt="" width="300" height="300" /></a><em>Excerpted from <a href="http://www.globalknowledge.com/training/whitepaperdetail.asp?pageid=502&amp;wpid=976&amp;country=United+States" target="_blank">Global Knowledge White Paper: Navigating Microsoft SQL 2012 Certifications</a></em></p>
<p>The whole SQL world is an interesting place, part Database Admin, part Developer, and part system administrator all rolled into one neat package. Well, knowing some of them, maybe not so neat. Theirs is a difficult world because of the different areas they must master – back up the database, write cleaner and more efficient and secure code, come up with new queries, study for the new SQL 2012 exams coming out in June (oops, didn’t want to slip that in too soon).</p>
<p>SQL 2012 was recently released; in fact, the launch was held March 7th, 2012. There are three main editions of SQL 2012 available: Enterprise, Business Intelligence, and Standard, with the Business Intelligence being new to SQL 2012. In addition, the Compact, Developer, and Express editions will continue to be distributed without licensing or pricing changes. The new SQL 2012 is a cloud-ready information platform that will help you and your organization unlock breakthrough insights across the organization and quickly build solutions to extend data across on-premises and public cloud, backed by mission-critical confidence.</p>
<p>You will need to wait until June 2012 to take the new SQL Server 2012 certification exams. However, you can prepare now for the SQL 2012 certifications by ensuring you have earned (or will have earned) a SQL Server 2008 Professional-level certification. Exams on SQL 2008 that you take now will help when upgrading from a Professional-level SQL Server 2008 certification to a Professional-level SQL Server 2012 certification. If you do so, than you must successfully pass only three exams, rather than all five.</p>
<h3>SQL Professional-level Certifications</h3>
<p>The Professional-level SQL Server 2012 certifications will validate that you have the expertise to design, build, and maintain the next wave of cloud-ready database and information solutions. Two new Professional-level certifications will be introduced for SQL Server 2012: the Data Platform certification and the Business Intelligence certification. In order to earn one of the professional-level certifications, you will need to successfully pass five exams, and you will need to recertify every three years by taking a recertification exam.</p>
<h4>Exam 70–461: Querying Microsoft SQL Server 2012</h4>
<p>The 70–461 certification exam is intended for SQL Server database administrators, SQL implementers, system administrators and engineers, and SQL developers. It is expected that these individuals have two or more years of experience and are seeking to prove their skills and knowledge in writing queries on SQL 2012. There is a five day instructor-led course (10774A — Querying Microsoft SQL Server 2012) that will give you the base technical skills required to write basic Transact-SQL queries for Microsoft SQL Server 2012. This course forms the foundation for all the other SQL 2012 Server-related courses; namely, Database Administration, Database Development, and Business Intelligence. As an aside, many of the exercises in this course are SQL Azure-enabled – helping you prepare for use of SQL 2012 in the cloud.</p>
<h4>Exam 70–462: Administering Microsoft SQL Server 2012 Databases</h4>
<p>Database Professionals whose duties are mostly installation, maintenance, and configuration tasks will be interested in the 70–462 exam. These SQL 2012 professionals are the ones who will often set up SQL 2012 database systems and are responsible for ensuring that these systems operate efficiently. They also ensure that the data they store is backed up regularly, stored effectively, and that the data is secure from unauthorized access. The 10775A Administering Microsoft SQL Server 2012 Databases class is a five-day instructor-led course that focuses on teaching SQL professionals individuals how to use the new SQL Server 2012 product features and tools.</p>
<h4>Exam 70–463: Implementing a Data Warehouse with Microsoft SQL Server 2012</h4>
<p>Those SQL 2012 Professionals who are interested in Extract Transform Load (ETL) and Data Warehousing will be very interested in the five-day 10777A Implementing a Data Warehouse with Microsoft SQL Server 2012 instructor-led course. This course describes how to implement a Business Intelligence (BI) platform to support information worker analytics, create a data warehouse with SQL Server 2012, implement ETL with SQL Server Integration Services, and validate and cleanse data with SQL Server Data Quality Services and SQL Server Master Data Services. SQL 2012 professionals who take this course are most likely to focus on hands-on work creating BI solutions, including data cleansing, ETL, and Data Warehouse implementation.</p>
<p>This course will help prepare students for the 70–463 Implementing a Data Warehouse with Microsoft SQL Server 2012 certification exam.</p>
<h4>Exam 70–464: Developing Microsoft SQL Server 2012 Databases</h4>
<p>If you are a SQL 2012 professional who is interested in building and implementing databases across an organization while ensuring high levels of data availability, than the 10776A Developing Microsoft SQL Server 2012 Databases course is for you. This five-day class is aimed for those SQL professionals whose tasks include creating database files; creating data types and tables; planning, creating, and optimizing indexes; implementing data integrity; implementing views, stored procedures, and functions; and managing transactions and locks. If you are interested in learning about logical table design, indexing and query plans, and creating database objects including views, stored procedures, along with parameters, and functions. Also, if you are curious about common aspects of procedure coding, such as transactions, concurrency, error handling, triggers, and SQL CLR, than this is the course for you. This course will help prepare you for the 70–464: Developing Microsoft SQL Server 2012 Databases – of course, a good deal of hands-on experience will help as well.</p>
<h4>Exam 70–465: Designing Database Solutions for Microsoft SQL Server 2012</h4>
<p>The 70–465 Exam is for SQL 2012 database professionals who design and build database solutions for an organization. These professionals will be responsible for creating plans and designs for database structure, storage, objects, and servers. They will also be responsible for creating the overall design plan for the SQL environment in which the database solutions will be housed and run.</p>
<h4>Exam 70–466: Implementing Data Models and Reports with Microsoft SQL Server 2012</h4>
<p>The primary audience for this exam is Business Intelligence (BI) Developers. They are most likely to focus on hands-on work creating BI solutions including implementing multi-dimensional data models, implementing and maintaining OLAP cubes, and creating information displays used in business decision-making processes. The five-day instructor-led 10778A Implementing Data Models and Reports with Microsoft SQL Server 2012 course will aid with these tasks.</p>
<h4>Exam 70–467: Designing Business Intelligence Solutions with Microsoft SQL Server 2012</h4>
<p>The primary audience for this exam is the BI Architect. Business Intelligence architects are responsible for the overall design of the BI architecture. This is the framework used for data organization, information management, and the technology components that are required to build BI systems for reporting data (which includes how these systems relate to other data systems in use). The BI architect’s responsibilities may include BI solution architecture and design, the provisioning of software and hardware, data warehouse and data mart design, online Analytical Processing (OLAP) cube design, and Integration with Microsoft SharePoint or line-of-business applications.</p>
<p><strong>Related Courses</strong><br />
<a href="http://www.globalknowledge.com/training/course.asp?pageid=9&amp;courseid=16985&amp;catid=184&amp;country=United+States" target="_blank">Querying Microsoft SQL Server 2012 (M10774)</a><br />
<a href="http://www.globalknowledge.com/training/course.asp?pageid=9&amp;courseid=16987&amp;catid=184&amp;country=United+States" target="_blank">Administering Microsoft SQL Server 2012 Databases (M10775)</a><br />
<a href="http://www.globalknowledge.com/training/course.asp?pageid=9&amp;courseid=16989&amp;catid=184&amp;country=United+States" target="_blank">Developing Microsoft SQL Server 2012 Databases (M10776)</a><br />
<a href="http://www.globalknowledge.com/training/course.asp?pageid=9&amp;courseid=16991&amp;catid=184&amp;country=United+States" target="_blank">Implementing a Data Warehouse with Microsoft SQL Server 2012 (M10777)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://globalknowledgeblog.com/certification/navigating-microsoft-sql-2012-certifications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Look at Microsoft SQL Server 2012</title>
		<link>http://globalknowledgeblog.com/technology/microsoft/a-look-at-microsoft-sql-server-2012/</link>
		<comments>http://globalknowledgeblog.com/technology/microsoft/a-look-at-microsoft-sql-server-2012/#comments</comments>
		<pubDate>Fri, 09 Mar 2012 13:46:42 +0000</pubDate>
		<dc:creator>Brian Egler</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[SQL Server 2012]]></category>

		<guid isPermaLink="false">http://globalknowledgeblog.com/?p=5375</guid>
		<description><![CDATA[In this post, we will explore just some of the new features under each theme to give a feel for the capabilities of the upcoming release. Other features and a pre-release version of the software are available on the Microsoft web site.]]></description>
			<content:encoded><![CDATA[<p><a href="http://globalknowledgeblog.com/wp-content/uploads/2012/03/computerbusinessman100883378.jpg"><img class="alignright size-full wp-image-5451" title="computerbusinessman100883378" src="http://globalknowledgeblog.com/wp-content/uploads/2012/03/computerbusinessman100883378.jpg" alt="" width="300" height="300" /></a><em>Excerpted from <a href="http://www.globalknowledge.com/training/olm/go.asp?find=blog0309SQL2012&amp;country=United+States" target="_blank">Global Knowledge White Paper: Microsoft SQL Server 2012: What to Expect</a></em></p>
<p>In this post, we will explore just some of the new features under each theme to give a feel for the capabilities of the upcoming release. Other features and a pre-release version of the software are available on the <a href="http://www.microsoft.com/sql">Microsoft web site</a>.</p>
<h2>Mission Critical Confidence</h2>
<h3>AlwaysOn for High Availability and Disaster Recovery</h3>
<p>Before SQL Server 2012, we had four options for High Availability (HA): Server Clustering, Database Mirroring, Log Shipping, and Peer-to-Peer (P2P) Replication. Each solution had its pros and cons.</p>
<p>SQL Server 2012 effectively combines the pros of each of these solutions with its AlwaysOn feature. With AlwaysOn, you will have the automatic failover of Mirroring at the Database level but with the added ability to create multiple secondaries for read-only load balancing. AlwaysOn will provide HADR and Load Balancing in one effective solution.</p>
<h3>Project Apollo Provides Column Compression and Performance Gains</h3>
<p>SQL Server 2008 introduced Data Compression at the Row and Page Levels to provide not only storage savings but also, surprisingly, performance gains based on less I/O. In SQL Server 2008 R2, the VertiPaq technology allowed massive column-level compression in conjunction with the PowerPivot add-in. In SQL Server 2012, the new column-store index, as part of Project Apollo, will provide the same massive column-level compression within the Database Engine itself. Data Warehouse queries against Star or Snowflake schemas will be optimized to give potential performance gains and storage savings in the order of 100 times improvement.</p>
<h3>Organizational Compliance With Enterprise-Wide Security Controls</h3>
<p>On the security front, new features in SQL Server 2012 include the ability to create user-defined server roles. This allows specific permissions to be applied to groups of logins instead of using the fixed server roles or having to give permissions directly to each login.</p>
<p>Another interesting security feature is the Contained Database that allows a database to be moved or copied to a new instance without having the dependency on login objects. Users can connect to the database without authenticating a login at the Database Engine-level. There exist some specific security threats that relate uniquely to Contained Databases (documented in SQL Server 2012 Books Online), but if you need a database to be easily portable, the benefits may outweigh the drawbacks.</p>
<p>The SQL Audit feature, which was introduced in SQL Server 2008 Enterprise Edition, allows Server– and Database– level auditing without the need for DDL or DML Trigger, giving a more efficient method of auditing that is built in to the Database Engine. SQL Server 2012 allows new features such as filtering audit output and now supports Server level audits for all SQL Server editions.</p>
<h2>Breakthrough Insight</h2>
<h3>SSAS 2012: VertiPaq, BI Semantic Model and PowerPivot</h3>
<p>SQL Server 2008 R2 introduced support for PowerPivot through Excel 2010 and SharePoint 2010 using its VertiPaq technology for massive column compression. This allowed advanced users to develop their own Business Intelligence solutions via Excel or SharePoint. The Vertipaq technology allowed literally hundreds of millions of rows of data to be imported and analyzed efficiently on the client via Excel and on the Server via SharePoint.</p>
<p>Based on the popularity of the technology, SSAS 2012 enables Vertipaq on the server-side within Analysis Services itself in a new configuration option named Tabular Mode that supports the BI Semantic Model (BISM).</p>
<h3>Consistent data via Data Quality Services</h3>
<p>SQL Server Data Quality Services (DQS) is new in SQL Server 2012 and provides a knowledge-based platform for data cleansing, including data correction and deduplication. The DQS Client application is intended for the end user to automate data correction in addition to an interactive mode.</p>
<h3>Parallel Data Warehouse and Reference Architectures</h3>
<p>When Microsoft acquired DATAllegro, its stated direction was to support Very Large Databases (VLDB) through a scalable appliance architecture using the combination of hardware and software to support databases in excess of 100TB. Now with SQL Server 2012, that vision is closer to reality with many hardware vendors supporting the Fast Track configurations and reference architectures. The Parallel Data Warehouse edition supports features such as Remote BLOB Storage and large-scale data partitioning while using up to 256 logical CPUs for high performance in the VLDB arena.</p>
<h3>Cloud on Your Terms</h3>
<p>SQL Azure is an exciting new SQL Server edition that introduces the cloud as a data platform for the future. SQL Azure now supports Open Data (OData) protocol for querying and updating data in the cloud. Project Juneau extends the Visual Studio 2010 shell to support SQL Azure and SQL Server applications using the .NET framework through standard data APIs such as ADO.NET, ODBC, JDBC, etc.</p>
<h3>Conclusion</h3>
<p>Microsoft SQL Server 2012 has many great new features that will allow you to develop higher performing, more scalable next-generation applications. Using the same architecture and management tools, customers will be able to smoothly upgrade their systems and skills based on the need for the new features and according to their own schedule.</p>
]]></content:encoded>
			<wfw:commentRss>http://globalknowledgeblog.com/technology/microsoft/a-look-at-microsoft-sql-server-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disadvantages of Indexing in SQL Server</title>
		<link>http://globalknowledgeblog.com/technology/microsoft/disadvantages-of-indexing-in-sql-server/</link>
		<comments>http://globalknowledgeblog.com/technology/microsoft/disadvantages-of-indexing-in-sql-server/#comments</comments>
		<pubDate>Thu, 23 Feb 2012 13:09:36 +0000</pubDate>
		<dc:creator>Gidget Pryor</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[clustered index]]></category>
		<category><![CDATA[indexing]]></category>
		<category><![CDATA[non-clustered index]]></category>

		<guid isPermaLink="false">http://globalknowledgeblog.com/?p=5272</guid>
		<description><![CDATA[Optimal performance in SQL Server OLTP (Online Transaction Processing) systems is achieved by creating balance between insert, update, delete, and select. Which is most important — adding data to the database, or retrieving it back in a report or application? The answer is yes! The very reason we save data is so that we can retrieve it. We also need to modify the data and delete non-relevant data.

In a previous blog post, I discussed the value of indexing. The real value is to help us retrieve data quickly. No one likes to wait for data from the database. We want instant answers and indexes are the best way to facilitate that.

Well then, why not create a lot of them? Why not create an index to match the way we search or sort in each query? The answer is the negative impact on the server when we modify data.]]></description>
			<content:encoded><![CDATA[<p><a href="http://globalknowledgeblog.com/wp-content/uploads/2012/02/indexAA045349.jpg"><img class="alignright size-full wp-image-5367" title="indexAA045349" src="http://globalknowledgeblog.com/wp-content/uploads/2012/02/indexAA045349.jpg" alt="" width="300" height="300" /></a>Optimal performance in SQL Server OLTP (Online Transaction Processing) systems is achieved by creating balance between <strong>insert</strong>,<strong> update</strong>,<strong> delete</strong>, and<strong> select</strong>. Which is most important — adding data to the database, or retrieving it back in a report or application? The answer is yes! The very reason we save data is so that we can retrieve it. We also need to modify the data and delete non-relevant data.</p>
<p>Read operations (<strong>select</strong>) often oppose write operations (<strong>insert</strong>, <strong>update</strong>, and <strong>delete</strong>).</p>
<p><a href="http://globalknowledgeblog.com/featured/the-upside-of-indexing-improving-our-queries" target="_blank">In a previous blog post</a>, I discussed the value of indexing. The real value is to help us retrieve data quickly. No one likes to wait for data from the database. We want instant answers and indexes are the best way to facilitate that.</p>
<p>Well then, why not create a lot of them? Why not create an index to match the way we search or sort in each query? The answer is the negative impact on the server when we modify data.</p>
<p>I am going to way oversimplify this to make the point. Let’s look at some data.</p>
<table style="border-collapse: collapse; border-spacing: 0px; margin: 0px auto;">
<tbody>
<tr>
<td style="border: 1px solid black;">CustomerId</td>
<td style="border: 1px solid black;">Lastname</td>
<td style="border: 1px solid black;">Firstname</td>
<td style="border: 1px solid black;">Addr1</td>
<td style="border: 1px solid black;">Addr2</td>
<td style="border: 1px solid black;">Zip</td>
</tr>
<tr>
<td style="border: 1px solid black;">1</td>
<td style="border: 1px solid black;">Jones</td>
<td style="border: 1px solid black;">Bill</td>
<td style="border: 1px solid black;">111 East Main Street</td>
<td style="border: 1px solid black;"> </td>
<td style="border: 1px solid black;">78727</td>
</tr>
<tr>
<td style="border: 1px solid black;">2</td>
<td style="border: 1px solid black;">Adams</td>
<td style="border: 1px solid black;">Sue</td>
<td style="border: 1px solid black;">121 East Ave</td>
<td style="border: 1px solid black;">Suite 500</td>
<td style="border: 1px solid black;">04328</td>
</tr>
<tr>
<td style="border: 1px solid black;">3</td>
<td style="border: 1px solid black;">Simmons</td>
<td style="border: 1px solid black;">JoAnn</td>
<td style="border: 1px solid black;">44 SW Parkway</td>
<td style="border: 1px solid black;">Suite 452</td>
<td style="border: 1px solid black;">32111</td>
</tr>
<tr>
<td style="border: 1px solid black;">4</td>
<td style="border: 1px solid black;">Hamil</td>
<td style="border: 1px solid black;">Amy</td>
<td style="border: 1px solid black;">2408 N Harrison</td>
<td style="border: 1px solid black;"> </td>
<td style="border: 1px solid black;">50421</td>
</tr>
</tbody>
</table>
<p> </p>
<p>Let’s say I have the following indexes and that they are all in ascending order:<br /> Clustered index on Customer ID<br /> Non-clustered index on Lastname<br /> Non-clustered index on Zip</p>
<p>I’ve added the index order in blue to the table:</p>
<table style="border-collapse: collapse; border-spacing: 0px; margin: 0px auto;">
<tbody>
<tr>
<td style="border: 1px solid black;">CustomerId</td>
<td style="border: 1px solid black;">Lastname</td>
<td style="border: 1px solid black;">Firstname</td>
<td style="border: 1px solid black;">Addr1</td>
<td style="border: 1px solid black;">Addr2</td>
<td style="border: 1px solid black;">Zip</td>
</tr>
<tr>
<td style="border: 1px solid black;"><span style="color: blue;">1</span> 1</td>
<td style="border: 1px solid black;"><span style="color: blue;">3</span> Jones</td>
<td style="border: 1px solid black;">Bill</td>
<td style="border: 1px solid black;">111 East Main Street</td>
<td style="border: 1px solid black;"> </td>
<td style="border: 1px solid black;"><span style="color: blue;">4</span> 78727</td>
</tr>
<tr>
<td style="border: 1px solid black;"><span style="color: blue;">2</span> 2</td>
<td style="border: 1px solid black;"><span style="color: blue;">1</span> Adams</td>
<td style="border: 1px solid black;">Sue</td>
<td style="border: 1px solid black;">121 East Ave</td>
<td style="border: 1px solid black;">Suite 500</td>
<td style="border: 1px solid black;"><span style="color: blue;">1</span> 04328</td>
</tr>
<tr>
<td style="border: 1px solid black;"><span style="color: blue;">3</span> 3</td>
<td style="border: 1px solid black;"><span style="color: blue;">4</span> Simmons</td>
<td style="border: 1px solid black;">JoAnn</td>
<td style="border: 1px solid black;">44 SW Parkway</td>
<td style="border: 1px solid black;">Suite 452</td>
<td style="border: 1px solid black;"><span style="color: blue;">2</span> 32111</td>
</tr>
<tr>
<td style="border: 1px solid black;"><span style="color: blue;">4</span> 4</td>
<td style="border: 1px solid black;"><span style="color: blue;">2</span> Hamil</td>
<td style="border: 1px solid black;">Amy</td>
<td style="border: 1px solid black;">2408 N Harrison</td>
<td style="border: 1px solid black;"> </td>
<td style="border: 1px solid black;"><span style="color: blue;">3</span> 50421</td>
</tr>
</tbody>
</table>
<p> </p>
<p>Now let’s say we hire a new person. In other words, we insert a row. We have one of two options — update the index, or let it grow out of date. If we update it, we will put everything in the proper order. Internally SQL Server considers where the rows really belong in the index. This takes work and adds overhead to the server. If we let it grow out of date, we might be looking for a row that we thought was in a particular order, but it really isn’t now.</p>
<table style="border-collapse: collapse; border-spacing: 0px; margin: 0px auto;">
<tbody>
<tr>
<td style="border: 1px solid black;">CustomerId</td>
<td style="border: 1px solid black;">Lastname</td>
<td style="border: 1px solid black;">Firstname</td>
<td style="border: 1px solid black;">Addr1</td>
<td style="border: 1px solid black;">Addr2</td>
<td style="border: 1px solid black;">Zip</td>
</tr>
<tr>
<td style="border: 1px solid black;"><span style="color: blue;">1</span> 1</td>
<td style="border: 1px solid black;"><span style="color: blue;">3</span> Jones</td>
<td style="border: 1px solid black;">Bill</td>
<td style="border: 1px solid black;">111 East Main Street</td>
<td style="border: 1px solid black;"> </td>
<td style="border: 1px solid black;"><span style="color: blue;">4</span> 78727</td>
</tr>
<tr>
<td style="border: 1px solid black;"><span style="color: blue;">2</span> 2</td>
<td style="border: 1px solid black;"><span style="color: blue;">1</span> Adams</td>
<td style="border: 1px solid black;">Sue</td>
<td style="border: 1px solid black;">121 East Ave</td>
<td style="border: 1px solid black;">Suite 500</td>
<td style="border: 1px solid black;"><span style="color: blue;">1</span> 04328</td>
</tr>
<tr>
<td style="border: 1px solid black;"><span style="color: blue;">3</span> 3</td>
<td style="border: 1px solid black;"><span style="color: blue;">4</span> Simmons</td>
<td style="border: 1px solid black;">JoAnn</td>
<td style="border: 1px solid black;">44 SW Parkway</td>
<td style="border: 1px solid black;">Suite 452</td>
<td style="border: 1px solid black;"><span style="color: blue;">2</span> 32111</td>
</tr>
<tr>
<td style="border: 1px solid black;"><span style="color: blue;">4</span> 4</td>
<td style="border: 1px solid black;"><span style="color: blue;">2</span> Hamil</td>
<td style="border: 1px solid black;">Amy</td>
<td style="border: 1px solid black;">2408 N Harrison</td>
<td style="border: 1px solid black;"> </td>
<td style="border: 1px solid black;"><span style="color: blue;">3</span> 50421</td>
</tr>
<tr>
<td style="border: 1px solid black;">5</td>
<td style="border: 1px solid black;">Bruner</td>
<td style="border: 1px solid black;">Cathy</td>
<td style="border: 1px solid black;">348 W 2ndStreet</td>
<td style="border: 1px solid black;"> </td>
<td style="border: 1px solid black;">42404</td>
</tr>
</tbody>
</table>
<p> </p>
<p>We will update ours. Here’s what it will look like after the update:</p>
<table style="border-collapse: collapse; border-spacing: 0px; margin: 0px auto;">
<tbody>
<tr>
<td style="border: 1px solid black;">CustomerId</td>
<td style="border: 1px solid black;">Lastname</td>
<td style="border: 1px solid black;">Firstname</td>
<td style="border: 1px solid black;">Addr1</td>
<td style="border: 1px solid black;">Addr2</td>
<td style="border: 1px solid black;">Zip</td>
</tr>
<tr>
<td style="border: 1px solid black;"><span style="color: blue;">1</span> 1</td>
<td style="border: 1px solid black;"><span style="color: blue;">4</span> Jones</td>
<td style="border: 1px solid black;">Bill</td>
<td style="border: 1px solid black;">111 East Main Street</td>
<td style="border: 1px solid black;"> </td>
<td style="border: 1px solid black;"><span style="color: blue;">5</span> 78727</td>
</tr>
<tr>
<td style="border: 1px solid black;"><span style="color: blue;">2</span> 2</td>
<td style="border: 1px solid black;"><span style="color: blue;">1</span> Adams</td>
<td style="border: 1px solid black;">Sue</td>
<td style="border: 1px solid black;">121 East Ave</td>
<td style="border: 1px solid black;">Suite 500</td>
<td style="border: 1px solid black;"><span style="color: blue;">1</span> 04328</td>
</tr>
<tr>
<td style="border: 1px solid black;"><span style="color: blue;">3</span> 3</td>
<td style="border: 1px solid black;"><span style="color: blue;">5</span> Simmons</td>
<td style="border: 1px solid black;">JoAnn</td>
<td style="border: 1px solid black;">44 SW Parkway</td>
<td style="border: 1px solid black;">Suite 452</td>
<td style="border: 1px solid black;"><span style="color: blue;">2</span> 32111</td>
</tr>
<tr>
<td style="border: 1px solid black;"><span style="color: blue;">4</span> 4</td>
<td style="border: 1px solid black;"><span style="color: blue;">3</span> Hamil</td>
<td style="border: 1px solid black;">Amy</td>
<td style="border: 1px solid black;">2408 N Harrison</td>
<td style="border: 1px solid black;"> </td>
<td style="border: 1px solid black;"><span style="color: blue;">4</span> 50421</td>
</tr>
<tr>
<td style="border: 1px solid black;"><span style="color: blue;">5</span> 5</td>
<td style="border: 1px solid black;"><span style="color: blue;">2</span> Bruner</td>
<td style="border: 1px solid black;">Cathy</td>
<td style="border: 1px solid black;">348 W 2ndStreet</td>
<td style="border: 1px solid black;"> </td>
<td style="border: 1px solid black;"><span style="color: blue;">3</span> 42404</td>
</tr>
</tbody>
</table>
<p> </p>
<p>We basically strike through the original value and reconsider where the rows belong. Let’s say that Sue Adams gets married and changes her lastname to Zachary and moves to the 32401 zipcode. This is an update. Now we need to redo the index order for the two non-clustered indexes:</p>
<table style="border-collapse: collapse; border-spacing: 0px; margin: 0px auto;">
<tbody>
<tr>
<td style="border: 1px solid black;">CustomerId</td>
<td style="border: 1px solid black;">Lastname</td>
<td style="border: 1px solid black;">Firstname</td>
<td style="border: 1px solid black;">Addr1</td>
<td style="border: 1px solid black;">Addr2</td>
<td style="border: 1px solid black;">Zip</td>
</tr>
<tr>
<td style="border: 1px solid black;"><span style="color: blue;">1</span> 1</td>
<td style="border: 1px solid black;"><span style="color: blue;">3</span> Jones</td>
<td style="border: 1px solid black;">Bill</td>
<td style="border: 1px solid black;">111 East Main Street</td>
<td style="border: 1px solid black;"> </td>
<td style="border: 1px solid black;"><span style="color: blue;">5</span> 78727</td>
</tr>
<tr>
<td style="border: 1px solid black;"><span style="color: blue;">2</span> 2</td>
<td style="border: 1px solid black;"><span style="color: blue;">5</span> Zachary</td>
<td style="border: 1px solid black;">Sue</td>
<td style="border: 1px solid black;">121 East Ave</td>
<td style="border: 1px solid black;">Suite 500</td>
<td style="border: 1px solid black;"><span style="color: blue;">2</span> 32401</td>
</tr>
<tr>
<td style="border: 1px solid black;"><span style="color: blue;">3</span> 3</td>
<td style="border: 1px solid black;"><span style="color: blue;">4</span> Simmons</td>
<td style="border: 1px solid black;">JoAnn</td>
<td style="border: 1px solid black;">44 SW Parkway</td>
<td style="border: 1px solid black;">Suite 452</td>
<td style="border: 1px solid black;"><span style="color: blue;">1</span> 32111</td>
</tr>
<tr>
<td style="border: 1px solid black;"><span style="color: blue;">4</span> 4</td>
<td style="border: 1px solid black;"><span style="color: blue;">2</span> Hamil</td>
<td style="border: 1px solid black;">Amy</td>
<td style="border: 1px solid black;">2408 N Harrison</td>
<td style="border: 1px solid black;"> </td>
<td style="border: 1px solid black;"><span style="color: blue;">4</span> 50421</td>
</tr>
<tr>
<td style="border: 1px solid black;"><span style="color: blue;">5</span> 5</td>
<td style="border: 1px solid black;"><span style="color: blue;">1</span> Bruner</td>
<td style="border: 1px solid black;">Cathy</td>
<td style="border: 1px solid black;">348 W 2ndStreet</td>
<td style="border: 1px solid black;"> </td>
<td style="border: 1px solid black;"><span style="color: blue;">3</span> 42404</td>
</tr>
</tbody>
</table>
<p> </p>
<p>We would have a similar situation if we delete a row. For example, let’s say that Amy Hamil asks to be removed from our customer list or is inactive for so long that we delete the row. We need to update the indexes again.</p>
<p>In our examples, we are considering a single row at a time. However, the reality is that rows are constantly being inserted, updated, and deleted. It’s not just one row we are considering — it’s hundreds, thousands, or even millions of rows. These processes are going on at the same time we report on the data. To optimize the read performance, we keep the indexes exactly up to date. However, at the same time of the read, when we modify data (if we are keeping the indexes up to date), we change the values of the position in the index due to the data modifications. Therefore, they are competing. If we don’t keep the indexes up to date, we might look in one place for the row when it’s really not located in that place any longer.</p>
<p>It’s also common for developers or dbas to create too many indexes. We might have a single query that is much improved by creating an index on a particular column. That’s great for the read performance of that query. However, modifications need to update that index. We maintain an index on a column that is part of every insert into the table but is searched only for that single query.</p>
<p>In summary, indexes improve performance if we search in the way we have indexed. Simultaneously, they potentially hurt us because of the overhead when data is modified.</p>
 <div class=’series_links’> </div><div class=’series_toc’><h3>SQL Server Indexing Series</h3><ul><li><a href='http://globalknowledgeblog.com/technology/microsoft/the-upside-of-indexing-improving-our-queries/' title='The Upside of Indexing — Improving our Queries'>The Upside of Indexing — Improving our Queries</a></li><li>Disadvantages of Indexing in SQL Server</li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://globalknowledgeblog.com/technology/microsoft/disadvantages-of-indexing-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Upside of Indexing — Improving our Queries</title>
		<link>http://globalknowledgeblog.com/technology/microsoft/the-upside-of-indexing-improving-our-queries/</link>
		<comments>http://globalknowledgeblog.com/technology/microsoft/the-upside-of-indexing-improving-our-queries/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 13:04:48 +0000</pubDate>
		<dc:creator>Gidget Pryor</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[clustered index]]></category>
		<category><![CDATA[indexing]]></category>
		<category><![CDATA[non-clustered index]]></category>

		<guid isPermaLink="false">http://globalknowledgeblog.com/?p=5271</guid>
		<description><![CDATA[Here’s the secret — the most important thing to know about SQL Server (in my opinion) is indexing. In transaction processing systems (also known as OLTP databases), database activity involves several statements. These include insert, update, delete, and select. There is a competing need between the modification statements (insert, update, and delete) and reading the data (select). Since the database has both — what should we do?]]></description>
			<content:encoded><![CDATA[<p><a href="http://globalknowledgeblog.com/wp-content/uploads/2011/10/couplelaptopPX111022.jpg"><img class="alignright size-full wp-image-4788" title="couplelaptopPX111022" src="http://globalknowledgeblog.com/wp-content/uploads/2011/10/couplelaptopPX111022.jpg" alt="" width="300" height="300" /></a>Here’s the secret — the most important thing to know about SQL Server (in my opinion) is indexing. In transaction processing systems (also known as OLTP databases), database activity involves several statements. These include <strong>insert</strong>, <strong>update</strong>, <strong>delete</strong>, and <strong>select</strong>. There is a competing need between the modification statements (<strong>insert</strong>, <strong>update</strong>, and <strong>delete</strong>) and reading the data (<strong>select</strong>). Since the database has both — what should we do?</p>
<p>We must carefully balance the needs of both. As our first step, let’s look at indexing.</p>
<p>Indexes potentially improve performance when we search and sort, but they potentially hurt performance when we add or modify data.</p>
<p>The two major types of indexes in SQL Server are <strong>clustered</strong> and <strong>non-clustered</strong>. SQL Server stores data physically in one of two ways. The first way is according to a clustered index, which means that the key of the index determines how the data is physically stored on disk, and the second way is called a heap. For example, let’s say I create an index on a column called customerid. Each row of the data would follow in order. In other words, customerid 2 would immediately follow customerid 1, and as new rows are added to the table, the index is updated sequentially.</p>
<p>Think of it this way, I have a filing cabinet, and as I place things in the filing cabinet I am mindful of the way I will retrieve them. In my case, I often lecture on a specific version of SQL Server, and  I have technical journals that arrive monthly. In my filing cabinet, I have the journals sorted by type, actual journal, and date. Right now, I am beginning to write and lecture about SQL 2012. My system works well in this case because I know that the “Denali” project (now branded as SQL Server 2012) is in the journals that were written around 2010 and beyond. The retrieval of the data is exactly how it’s laid out in my file cabinet.</p>
<p>What if I need to write about a particular feature in SQL Server? For example, let’s say I’m asked to lecture over all of the different versions of Reporting Services. The data isn’t physically ordered that way. We will come back  and use a non-clustered index for this.</p>
<p>First, we need to look at the other way data is physically organized. A heap is defined as “in no particular order”. Think of it this way, have you ever known (or been) a person with an incredibly messy desk? As paper comes into the office, it simply goes in the pile or various piles (I don’t keep my desk this way, I can’t function). I have always been fascinated by the people that do keep everything in piles and function perfectly well in what looks like chaos to me. Their data is in no particular order, but, amazingly, they can retrieve information quickly.</p>
<p>SQL Server is able to retrieve information quickly regardless of the clustered vs. heap storage. However, we need some other indexes to help. These are called non-clustered indexes. We can have indexes that are built on top of the clustered index or on top of the heap.</p>
<p>Say you travel to an unfamiliar city, and you have an address for your destination but no idea how to get to that location. You need a map or a GPS, right? You don’t know how to get to the physical location, but you know someone who knows. That’s the way non-clustered indexes work. The data is not physically stored according to the non-clustered index, but the non-clustered index points to the physical location — the heap or the clustered index.</p>
<p>Going back to the example above — writing about Reporting Services would be easy. I would simply have a lookup chart that lists the topic, and next to it I would have the journal name and journal date of the journals with Reporting Services articles.</p>
<p>When you run a query in SQL Server, the Database Engine physically has to retrieve the data you’ve requested. In order to do that, it must know the physical order. For efficiency, we want to store the data in an order that we will search (there are several considerations beyond the scope of this post, but for now, we are only considering the retrieval). If we request the data in a way that it isn’t physically stored, we want a way to look it up, thus needing a non-clustered index.</p>
<p>We only get one way to store the data physically at a time, a clustered index or heap. However, there are probably multiple ways that I search or sort the data. I might request a particular customer in one query, and in another query I might search by last name. In both cases, I need to physically retrieve the data. If my clustered index for the table is on customerid, the first query would use that. If I had a second query, a non-clustered index on last name could be used.</p>
<p>In summary, remember that indexes help us when we search or sort. We will see in another post how they potentially hurt performance on data modification.</p>
 <div class=’series_links’> </div><div class=’series_toc’><h3>SQL Server Indexing Series</h3><ul><li>The Upside of Indexing — Improving our Queries</li><li><a href='http://globalknowledgeblog.com/technology/microsoft/disadvantages-of-indexing-in-sql-server/' title='Disadvantages of Indexing in SQL Server'>Disadvantages of Indexing in SQL Server</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://globalknowledgeblog.com/technology/microsoft/the-upside-of-indexing-improving-our-queries/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>5 Tips for Better Performing T-SQL</title>
		<link>http://globalknowledgeblog.com/technology/microsoft/5-tips-for-better-performing-t-sql/</link>
		<comments>http://globalknowledgeblog.com/technology/microsoft/5-tips-for-better-performing-t-sql/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 13:52:28 +0000</pubDate>
		<dc:creator>Gidget Pryor</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[t-sql]]></category>
		<category><![CDATA[Transact-SQL]]></category>

		<guid isPermaLink="false">http://globalknowledgeblog.com/?p=4847</guid>
		<description><![CDATA[I love it when I can make simple fixes in the database that yield great results. Here are a few T-SQL tips that gave me great gain over the years. You have two goals with any database — storage and retrieval.  Optimize both with these tips. ]]></description>
			<content:encoded><![CDATA[<p><a href="http://globalknowledgeblog.com/wp-content/uploads/2011/11/database045321.jpg"><img class="alignright size-full wp-image-4864" title="database045321" src="http://globalknowledgeblog.com/wp-content/uploads/2011/11/database045321.jpg" alt="" width="300" height="300" /></a>I love it when I can make simple fixes in the database that yield great results. Here are a few T-SQL tips that gave me great gain over the years. You have two goals with any database — storage and retrieval.  Optimize both with these tips.</p>
<h3><strong>Stop Using SELECT *!</strong></h3>
<p>Many people know they shouldn’t use SELECT* but don’t fully understand the impact. When you use SELECT *, you force SQL Server to go to the heap or clustered index one way or the other because this is where <strong><em>all</em></strong> of the columns are located — and you just asked for all of them. Oh, and all of the other people using SELECT * are going to the same clustered index or heap on that table, increasing contention for resources. Stay tuned for an upcoming post on indexing that will cover this in more detail. For now, just trust me. Please stop using SELECT *. You’re hurting database performance. The truth is you probably don’t need all of the columns. Let’s just say your query looks something like this:</p>
<p><strong>SELECT * from customer</strong></p>
<p>I’m going to put some numbers here just to help demonstrate the point. Let’s say customer has 2000 rows and 30 columns. Notice there is no WHERE clause here — so you’re accessing all 2000 rows when you run this query. Perhaps you need 25 of the 30 columns, but it’s easier to just type SELECT *. I understand.</p>
<p>Let’s say those five additional columns add up to 30 bytes. You’re accessing 30 bytes multiplied by the number of rows (2000) multiplied by the number of times the query is run — in other words, the number of connections / users / applications that run the query. By the way, you can drag and drop columns from the Object Explorer in the SQL Server Management Studio Tool to the query window, so you don’t even have to type the columns.<strong></strong></p>
<h3><strong>Use a WHERE Clause</strong></h3>
<p>The WHERE clause filters the number of rows processed and increases the chance that SQL Server can use an index. What’s the exact tipping point? Well, that’s a complex question. I’ve spent hours understanding exactly when the query would tip and use a scan instead of a seek, an index vs. the table. In my most recent study of one query with a pretty large table, it was just over 1%!! I was pretty shocked myself. As a very general rule, try to aim for a WHERE clause that yields less than 5% of the table. Of course, sometimes you need to access more than 5%, and you won’t have this option.</p>
<h3><strong>I Don’t Like “LIKE”</strong></h3>
<p>That’s just me. Well, no, it isn’t. I found more problems in queries dealing with the LIKE operator than I can count. Don’t get me wrong. LIKE is very powerful, and sometimes you need it. However, try to solve your query without the use of wildcards when you can. You reduce the chances that an index can be used for your queries. Especially if your pattern match is at the beginning of the statement, you reduce the likelihood that SQL Server can find a useful index.</p>
<h3><strong>Use Stored Procedures</strong></h3>
<p>When you use stored procedures, you give SQL Server the chance to use the same execution plan over again. SQL Server has something called the query optimizer. This internal mechanism figures out the best way to run your query on a cost based analysis. If you use ad hoc queries, SQL Server figures this out every time. For queries you will run over and over, just turn them into stored procedures. It’s easy.</p>
<p>If your query looks like this:</p>
<p><strong>Select last, first from customer</strong></p>
<p>You can turn it into a stored procedure by changing it to:</p>
<p><strong>Create procedure usp_CustInfo as select last, first from customer</strong></p>
<h3><strong>Use Your Indexes Wisely</strong></h3>
<p>Indexes only help you when you search and sort. They potentially hurt you when you insert, update, or delete. Follow these guidelines:</p>
<ul>
<li>Create indexes for columns that appear in your WHERE clause.</li>
<li>Try to use index keys (columns that are part of the index) that are short and stable over time.</li>
<li>Do not create indexes on columns that aren’t accessed in that order. Consider a filing cabinet that is organized by zip code. If you search by alphabet or topic, it really does you no good to organize by zip code. Indexes are useful when we access the data in that order. If I never access the data by zip code, I am simply wasting time to organize by zip code. Create indexes for the columns you request.</li>
<li>Create indexes on columns that have high variation. It really does you no good (and in fact, does harm) to have an index on a column with very few different values. For example, an index on a column of gender yields approximately 50% of the table in a normal distribution of the population. SQL Server will disregard such an index because you are accessing a large portion of the table. You’re maintaining an index for something that will likely be unused.</li>
</ul>
<p><strong>Related Courses</strong><br />
<a href="http://www.globalknowledge.com/training/course.asp?pageid=9&amp;courseid=11961&amp;catid=184&amp;country=United+States?utm_source=blog&amp;utm_medium=referral&amp;utm_campaign=socialmedia" target="_blank">Writing Queries Using Microsoft SQL Server 2008 Transact-SQL</a><br />
<a href="http://www.globalknowledge.com/training/course.asp?pageid=9&amp;courseid=11903&amp;country=United+States?utm_source=blog&amp;utm_medium=referral&amp;utm_campaign=socialmedia" target="_blank">SQL Server 2008 R2 for Administration</a><br />
<a href="http://www.globalknowledge.com/training/course.asp?pageid=9&amp;courseid=11965&amp;country=United+States?utm_source=blog&amp;utm_medium=referral&amp;utm_campaign=socialmedia" target="_blank">Designing and Implementing a SQL Server 2008 R2 Database</a></p>
 <div class=’series_links’> </div><div class=’series_toc’><h3>T-SQL Basics Series</h3><ul><li><a href='http://globalknowledgeblog.com/technology/microsoft/t-sql-basics-anatomy-of-the-select-statement/' title='T-SQL Basics: Anatomy of the Select Statement'>T-SQL Basics: Anatomy of the Select Statement</a></li><li>5 Tips for Better Performing T-SQL</li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://globalknowledgeblog.com/technology/microsoft/5-tips-for-better-performing-t-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server from One Version to the Next</title>
		<link>http://globalknowledgeblog.com/technology/microsoft/keeping-up-to-date-with-sql/</link>
		<comments>http://globalknowledgeblog.com/technology/microsoft/keeping-up-to-date-with-sql/#comments</comments>
		<pubDate>Thu, 13 Oct 2011 12:20:27 +0000</pubDate>
		<dc:creator>Gidget Pryor</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://globalknowledgeblog.com/?p=4685</guid>
		<description><![CDATA[I love being organized mostly because it’s the only way I can function effectively. As a Microsoft instructor and database consultant, it truly is interesting to see all the new features from one release to the next. However, I find it extremely challenging to remember which version introduced each feature as I work with clients. 

However, I also find it extremely challenging to remember which version introduced each feature as I work with clients. Database Administrators and Developers are tasked with making applications and upgrades work efficiently, and they must be able to integrate applications across versions. This matters because most companies cannot suddenly upgrade all of their servers and applications at once, so there is this type of mish-mash blend of versions.]]></description>
			<content:encoded><![CDATA[<p><a href="http://globalknowledgeblog.com/wp-content/uploads/2011/10/updating.jpg"><img class="alignright size-full wp-image-4740" title="updating" src="http://globalknowledgeblog.com/wp-content/uploads/2011/10/updating.jpg" alt="" width="300" height="300" /></a>I love being organized mostly because it’s the only way I can function effectively. As a Microsoft instructor and database consultant, it truly is interesting to see all the new features from one release to the next. However, I find it extremely challenging to remember which version introduced each feature as I work with clients.</p>
<p>Database Administrators and Developers are tasked with making applications and upgrades work efficiently, and they must be able to integrate applications across versions. This matters because most companies cannot suddenly upgrade all of their servers and applications at once, so there is this type of mish-mash blend of versions.</p>
<p>I created this little chart to remind myself (and you) of some of the highlights introduced in each feature. As the next version (Denali) makes it way into the market, check back here for updates. Happy reading!</p>
<table style="border-collapse: collapse; border-spacing: 0px; margin: 0px auto;">
<tbody>
<tr style="background-color: #66ccff; font-weight: bold; text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Feature</td>
<td style="border: 1px solid black;">New in 2005</td>
<td style="border: 1px solid black;">New in 2008</td>
<td style="border: 1px solid black;">New in 2008 Feature Pack</td>
<td style="border: 1px solid black;">New in 2008 r2</td>
</tr>
<tr style="text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Dynamic Management Views</td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="background-color: #66ccff; text-align: center; padding: 2px;">
<td style="border: 1px solid black;">DB Snapshots</td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="text-align: center; padding: 5px;">
<td style="border: 1px solid black;">New Replication Types</td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="background-color: #66ccff; text-align: center; padding: 5px;">
<td style="border: 1px solid black;">SSIS</td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Mirrored Backups</td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="background-color: #66ccff; text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Database Mirroring</td>
<td style="border: 1px solid black; font-weight: bold;">X (SP1-fix)</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Column Encryption</td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="background-color: #66ccff; text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Online Indexing</td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Database Mail</td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="background-color: #66ccff; text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Table/Index Partitions</td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Native XML Support</td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="background-color: #66ccff; text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Database Engine Tuning Advisor</td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="background-color: #000000; border: 1px solid black;">
<td colspan="5"></td>
</tr>
<tr style="background-color: #66ccff; text-align: center; padding: 5px;">
<td style="border: 1px solid black;">DMV Enhancements</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Data Collector</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="background-color: #66ccff; text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Resource Governor</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Policy Management</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="background-color: #66ccff; text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Powershell Support</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Backup Compression</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="background-color: #66ccff; text-align: center; padding: 5px;">
<td style="border: 1px solid black;">DB Encryption (TDE)</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Facets</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="background-color: #66ccff; text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Filestream</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Spatial Data Support</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="background-color: #66ccff; text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Registered Server Enhancements</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Aggregation Wizard Changes</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="background-color: #66ccff; text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Performance and Reliability</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Activity Monitor changes</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="background-color: #66ccff; text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Cube Wizard Changes</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Row Compression/Page Compression</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="background-color: #000000; border: 1px solid black;">
<td colspan="5"></td>
</tr>
<tr style="background-color: #66ccff; text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Report Builder 2.0</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
<td style="border: 1px solid black;"></td>
</tr>
<tr style="background-color: #000000; border: 1px solid black;">
<td colspan="5"></td>
</tr>
<tr style="background-color: #66ccff; text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Report Builder 3.0</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
</tr>
<tr style="text-align: center; padding: 5px;">
<td style="border: 1px solid black;">New Report Viewer (VS2010)</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
</tr>
<tr style="background-color: #66ccff; text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Power Pivot</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
</tr>
<tr style="text-align: center; padding: 5px;">
<td style="border: 1px solid black;">BINGMaps in SSRS</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
</tr>
<tr style="background-color: #66ccff; text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Report Part Gallery</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
</tr>
<tr style="text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Shared Datasets SSRS</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
</tr>
<tr style="background-color: #66ccff; text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Shared Report Parts</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
</tr>
<tr style="text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Datafeed Subscripts SSRS</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
</tr>
<tr style="background-color: #66ccff; text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Multi-server MGMT Utility/Utility control Point</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
</tr>
<tr style="text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Complex Event Processing/StreamInsight</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
</tr>
<tr style="background-color: #66ccff; text-align: center; padding: 5px;">
<td style="border: 1px solid black;">DACPAC</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
</tr>
<tr style="text-align: center; padding: 5px;">
<td style="border: 1px solid black;">Data Tier Application</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
</tr>
<tr style="background-color: #66ccff; text-align: center; padding: 5px;">
<td style="border: 1px solid black;">LINQ/AJAX Support with SQL</td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black;"></td>
<td style="border: 1px solid black; font-weight: bold;">X</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://globalknowledgeblog.com/technology/microsoft/keeping-up-to-date-with-sql/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>T-SQL Basics: Anatomy of the Select Statement</title>
		<link>http://globalknowledgeblog.com/technology/microsoft/t-sql-basics-anatomy-of-the-select-statement/</link>
		<comments>http://globalknowledgeblog.com/technology/microsoft/t-sql-basics-anatomy-of-the-select-statement/#comments</comments>
		<pubDate>Mon, 19 Sep 2011 12:42:29 +0000</pubDate>
		<dc:creator>Gidget Pryor</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[t-sql]]></category>
		<category><![CDATA[Transact-SQL]]></category>

		<guid isPermaLink="false">http://globalknowledgeblog.com/?p=4513</guid>
		<description><![CDATA[Relational databases are important not only because of the information they store but, more importantly, for the data we retrieve from them. The select statement allows us to ask the database a question. It’s the way we retrieve information from the database system.]]></description>
			<content:encoded><![CDATA[<p><a href="http://globalknowledgeblog.com/wp-content/uploads/2011/08/data102080.jpg"><img class="alignright size-full wp-image-4299" title="data102080" src="http://globalknowledgeblog.com/wp-content/uploads/2011/08/data102080.jpg" alt="" width="300" height="300" /></a>Relational databases are important not only because of the information they store but, more importantly, for the data we retrieve from them. The select statement allows us to ask the database a question. It’s the way we retrieve information from the database system.</p>
<p>There are two standards that govern SQL (Structured Query Language) — ANSI (American National Standards Institute) and ISO (International Standards Organization). Microsoft SQL Server supports both of these standards. Like other database products, Microsoft SQL Server has its own dialect of SQL. This dialect for SQL Server is called T-SQL or Transact-SQL.</p>
<p>The basics of the select statement are the same from one database to another. However, some options of the statement vary from product to product. We’ll specifically examine SQL Server’s select statement, although it is virtually identical to other select statements.</p>
<p>SQL Server is one of many relational database systems. Relational databases store information in a series of tables (rows and columns) that are “related” to each other.</p>
<p>Let’s say we have a customer database. This database has a few different sub-topics — or entities like customer, order, vendor, product, and employee. Entities can be translated to the topic of the table. We’ll only work with a single table to keep our examples very simple.</p>
<p>Our table has the following structure and records (rows):</p>
<p>CUSTOMER</p>
<table style="border-collapse: collapse; border-spacing: 0px; margin: 0px auto;">
<tbody>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;"><strong>CustomerID</strong></td>
<td style="border: 1px solid black; text-align: center; padding: 2px;"><strong>LastName</strong></td>
<td style="border: 1px solid black; text-align: center; padding: 2px;"><strong>FirstName</strong></td>
<td style="border: 1px solid black; text-align: center; padding: 2px;"><strong>Address</strong></td>
<td style="border: 1px solid black; text-align: center; padding: 2px;"><strong>City</strong></td>
<td style="border: 1px solid black; text-align: center; padding: 2px;"><strong>State</strong></td>
<td style="border: 1px solid black; text-align: center; padding: 2px;"><strong>Zip</strong></td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">1000</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Adams</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Susan</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">101 Main Street</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Cary</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">NC</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">27513</td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">1001</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Johnson</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">JoAnne</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">5402 Loop 1</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Austin</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">TX</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">78752</td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">1002</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Smith</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Ron</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">2201 Thomas Dr</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Panama City</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">FL</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">32401</td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">1003</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Baker</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Pete</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">2408 NW 119th</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Oklahoma City</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">OK</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">73120</td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">1004</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Smith</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Bill</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">4407 12th Avenue</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Austin</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">TX</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">78746</td>
</tr>
</tbody>
</table>
<p>Let’s begin by discussing the parts of the select statement. Then we will select information from one table only.</p>
<p>The select statement is comprised of multiple clauses. These are:</p>
<p>SELECT<br />
FROM<br />
WHERE<br />
GROUP BY<br />
ORDER BY<br />
HAVING</p>
<p>Each of these clauses has information that follows it. These are:</p>
<p>SELECT column(s)<br />
FROM table / view<br />
WHERE condition / expression<br />
GROUP BY column(s)<br />
ORDER BY column(s)<br />
HAVING aggregate function and condition / expression</p>
<p>The only two clauses that are required in a select statement are SELECT and FROM.</p>
<p>The SELECT clause identifies which columns we want to retrieve, and the FROM clause identifies the name of the table we are using. We might have something like this:</p>
<p>Select lastname, firstname<br />
from customer</p>
<p>This gives us the output:</p>
<table style="border-collapse: collapse; border-spacing: 0px; margin: 0px auto;">
<tbody>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;"><strong>LastName</strong></td>
<td style="border: 1px solid black; text-align: center; padding: 2px;"><strong>FirstName</strong></td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Adams</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Susan</td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Johnson</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">JoAnne</td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Smith</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Ron</td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Baker</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Pete</td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Smith</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Bill</td>
</tr>
</tbody>
</table>
<p>Notice that the headings above the column data are not title case as they are in the table. This is because my query had them listed as lower case. Our select statement indicates exactly what we want to see in the output.</p>
<p>Now we’ll review the optional clauses.</p>
<p><strong>WHERE</strong></p>
<p>The WHERE clause is a filter for the query results and uses a condition or expression. We use the WHERE clause to specify our request for only particular rows.</p>
<p>If I want to retrieve only those individuals with the last name of Smith then I can add a WHERE clause.</p>
<p>Select lastname, firstname<br />
from customer<br />
where lastname = ‘Smith’</p>
<p>This gives us the output:</p>
<table style="border-collapse: collapse; border-spacing: 0px; margin: 0px auto;">
<tbody>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;"><strong>CustomerID</strong></td>
<td style="border: 1px solid black; text-align: center; padding: 2px;"><strong>LastName</strong></td>
<td style="border: 1px solid black; text-align: center; padding: 2px;"><strong>FirstName</strong></td>
<td><strong>Address</strong></td>
<td style="border: 1px solid black; text-align: center; padding: 2px;"><strong>City</strong></td>
<td style="border: 1px solid black; text-align: center; padding: 2px;"><strong>State</strong></td>
<td style="border: 1px solid black; text-align: center; padding: 2px;"><strong>Zip</strong></td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">1002</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Smith</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Ron</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">2201 Thomas Dr</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Panama City</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">FL</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">32401</td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">1004</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Smith</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Bill</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">4407 12th Avenue</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Austin</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">TX</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">78746</td>
</tr>
</tbody>
</table>
<p><strong>GROUP BY</strong></p>
<p>The purpose of the GROUP BY clause is to group or cluster records together based on a column or list of columns. In our example, I also use an aggregate function that counts the number of rows specifying our criteria. I also created an alias for the heading of the column with the function.</p>
<p>Select State, count(state) as ‘Count of Customers by State’<br />
from customer<br />
group by state</p>
<p>This gives us the output:</p>
<table style="border-collapse: collapse; border-spacing: 0px; margin: 0px auto;">
<tbody>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;"><strong>State</strong></td>
<td style="border: 1px solid black; text-align: center; padding: 2px;"><strong>Count of Customers by State</strong></td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">FL</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">1</td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">NC</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">1</td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">OK</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">1</td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">TX</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">2</td>
</tr>
</tbody>
</table>
<p><strong>HAVING</strong></p>
<p>The HAVING clause works in conjunction with the GROUP BY clause. It’s very much like the WHERE clause since it works as a filter. However, it works as a filter on the aggregate group.</p>
<p>Select State, count(state) as ‘Count of Customers Greater Than 1’<br />
from customer<br />
group by state<br />
having count(state) &gt; 1</p>
<p>This gives us the output:</p>
<table style="border-collapse: collapse; border-spacing: 0px; margin: 0px auto;">
<tbody>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;"><strong>State</strong></td>
<td style="border: 1px solid black; text-align: center; padding: 2px;"><strong>Count of Customers Greater Than 1</strong></td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">TX</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">2</td>
</tr>
</tbody>
</table>
<p><strong>ORDER BY</strong></p>
<p>The ORDER BY clause indicates the sort order for the query results.</p>
<p>If I want to put my results in alphabetical order by lastname, I can add an ORDER BY clause.</p>
<p>Select lastname, firstname<br />
from customer<br />
order by lastname</p>
<p>This gives us the output:</p>
<table style="border-collapse: collapse; border-spacing: 0px; margin: 0px auto;">
<tbody>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;"><strong>LastName</strong></td>
<td style="border: 1px solid black; text-align: center; padding: 2px;"><strong>FirstName</strong></td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Adams</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Susan</td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Baker</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Pete</td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Johnson</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">JoAnne</td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Smith</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Ron</td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Smith</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Bill</td>
</tr>
</tbody>
</table>
<p>Notice that Ron Smith appears before Bill Smith in our example even though “Bill” comes before “Ron” alphabetically. This is because I didn’t order by firstname, only by lastname. To correct this, I can do the following.</p>
<p>Select lastname, firstname<br />
from customer<br />
order by lastname, firstname</p>
<p>This gives us the output:</p>
<table style="border-collapse: collapse; border-spacing: 0px; margin: 0px auto;">
<tbody>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;"><strong>LastName</strong></td>
<td style="border: 1px solid black; text-align: center; padding: 2px;"><strong>FirstName</strong></td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Adams</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Susan</td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Baker</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Pete</td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Johnson</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">JoAnne</td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Smith</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Bill</td>
</tr>
<tr>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Smith</td>
<td style="border: 1px solid black; text-align: center; padding: 2px;">Ron</td>
</tr>
</tbody>
</table>
<p>We saw the basics of selecting data from a single table. Look for Part II where we’ll explore querying from multiple tables.</p>
<p> </p>
<p><strong>Related Courses</strong><br />
<a href="http://www.globalknowledge.com/training/course.asp?pageid=9&amp;courseid=11961&amp;catid=184&amp;country=United+States?utm_source=blog&amp;utm_medium=referral&amp;utm_campaign=socialmedia" target="_blank">Writing Queries Using Microsoft SQL Server 2008 Transact-SQL</a><br />
<a href="http://www.globalknowledge.com/training/course.asp?pageid=9&amp;courseid=11903&amp;country=United+States?utm_source=blog&amp;utm_medium=referral&amp;utm_campaign=socialmedia" target="_blank">SQL Server 2008 R2 for Administration</a><br />
<a href="http://www.globalknowledge.com/training/course.asp?pageid=9&amp;courseid=11965&amp;country=United+States?utm_source=blog&amp;utm_medium=referral&amp;utm_campaign=socialmedia" target="_blank">Designing and Implementing a SQL Server 2008 R2 Database</a></p>
<p> </p>
 <div class=’series_links’> </div><div class=’series_toc’><h3>T-SQL Basics Series</h3><ul><li>T-SQL Basics: Anatomy of the Select Statement</li><li><a href='http://globalknowledgeblog.com/technology/microsoft/5-tips-for-better-performing-t-sql/' title='5 Tips for Better Performing T-SQL'>5 Tips for Better Performing T-SQL</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://globalknowledgeblog.com/technology/microsoft/t-sql-basics-anatomy-of-the-select-statement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Star vs Snowflake Schemas     –     what’s your belief?</title>
		<link>http://globalknowledgeblog.com/technology/data-center/star-vs-snowflake-schemas%e2%80%89%e2%80%89%e2%80%89%e2%80%93%e2%80%89%e2%80%89%e2%80%89what%e2%80%99s-your-belief/</link>
		<comments>http://globalknowledgeblog.com/technology/data-center/star-vs-snowflake-schemas%e2%80%89%e2%80%89%e2%80%89%e2%80%93%e2%80%89%e2%80%89%e2%80%89what%e2%80%99s-your-belief/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 18:32:33 +0000</pubDate>
		<dc:creator>Brian Egler</dc:creator>
				<category><![CDATA[Data Center]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Data Warehouse]]></category>
		<category><![CDATA[data warehouse design]]></category>

		<guid isPermaLink="false">http://globalknowledgeblog.com/?p=3064</guid>
		<description><![CDATA[Two common Data Warehouse designs are identified as a “Star Schema” and a “Snowflake Schema”. When we discuss the differences and individual preferences, usually the gloves come off, and DBA’s duke it out. It becomes a religious argument with plenty of passion and zeal. Let’s take a look at why…]]></description>
			<content:encoded><![CDATA[<p><a href="http://globalknowledgeblog.com/wp-content/uploads/2011/03/schemas012007.jpg"><img class="alignleft size-full wp-image-3328" title="schemas012007" src="http://globalknowledgeblog.com/wp-content/uploads/2011/03/schemas012007.jpg" alt="" width="250" height="250" /></a>Two common Data Warehouse designs are identified as a “Star Schema” and a “Snowflake Schema”. When we discuss the differences and individual preferences, usually the gloves come off, and DBA’s duke it out. It becomes a religious argument with plenty of passion and zeal. Let’s take a look at why…</p>
<p>The definition of a Star Schema is one in which all dimension tables are directly related to the fact table through foreign key relationships. It’s the simplest form of Data Warehouse design where complex dimension relationships are collapsed into a single layer of dimension tables. Looking at the diagram of the design shows a “Star” type figure with the fact table at the center, hence the name.</p>
<p>The Snowflake Schema gets its name from an extra layer or layers of dimension tables which are NOT directly related to the fact table. The extra layers make the star look more like a “Snowflake” supposedly although it normally takes a few egg nogs to see the similarity. The dimension tables are effectively normalized to yield additional relationships.</p>
<p>Normalized design is essential in high performing OLTP databases where data needs to be stored in one place and one place only, to ensure efficient updates and space savings. One exception is where we selectively choose to violate the rules of normalization in the name of performance costing redundant storage. This is called “denormalization” and should be performed with extreme care. With a Data Warehouse we can relax the rules of normalization a little more and denormalize as long as we buy off on the extra space needed. As always it comes down to performance versus storage.</p>
<p>The Star Schema effectively is a denormalized schema costing extra storage. Proponents would argue this is done for performance reasons and also emphasize the “keep it simple stupid” or “KISS” approach to database development just to wind-up the Snowflake gurus.</p>
<p>The Snowflake Schema is more normalized and saves space and redundancy. Skeptics would argue that it does this at the expense of performance degradation caused by excessive joins.</p>
<p>Of course, there’s a bit of Star and Snowflake in all of us. The typical Time Dimension in both schemas is really a collapsed snowflake-turned-star schema design with Year, Quarter, Month dimensions collapsed into a single table.</p>
<p>Some older analysis products actually required a Star Schema. Fortunately, Microsoft SQL Server Analysis Services (SSAS) now allows us a choice as it supports both schema designs.</p>
<p>To calm people down, I usually introduce the concept of a “Constellation” or “Galaxy” schema which actually contains multiple Star and/or Snowflake Schemas combined so we can look to the heavens knowing there is a common solution for all of us. And SSAS supports that too, just so we can all coexist. Thankfully.</p>
]]></content:encoded>
			<wfw:commentRss>http://globalknowledgeblog.com/technology/data-center/star-vs-snowflake-schemas%e2%80%89%e2%80%89%e2%80%89%e2%80%93%e2%80%89%e2%80%89%e2%80%89what%e2%80%99s-your-belief/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slowly Changing Dimension  —  Sample Code</title>
		<link>http://globalknowledgeblog.com/technology/microsoft/slowly-changing-dimension%e2%80%89%e2%80%89%e2%80%94%e2%80%89%e2%80%89sample-code/</link>
		<comments>http://globalknowledgeblog.com/technology/microsoft/slowly-changing-dimension%e2%80%89%e2%80%89%e2%80%94%e2%80%89%e2%80%89sample-code/#comments</comments>
		<pubDate>Mon, 21 Feb 2011 18:20:40 +0000</pubDate>
		<dc:creator>Brian Egler</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[SCD]]></category>
		<category><![CDATA[slowly changing dimension]]></category>

		<guid isPermaLink="false">http://globalknowledgeblog.com/?p=3063</guid>
		<description><![CDATA[In a previous blog entry I discussed the concept of the Slowly Changing Dimension, or SCD. A good example is how to handle the analysis of Sales by Customer Region when a customer moves from one Region to another. The way to solve this situation is with a Type 2 SCD design. Let’s take a look…]]></description>
			<content:encoded><![CDATA[<p><a href="http://globalknowledgeblog.com/wp-content/uploads/2011/02/blographic3486.jpg"><img class="alignleft size-full wp-image-3179" title="blographic3486" src="http://globalknowledgeblog.com/wp-content/uploads/2011/02/blographic3486.jpg" alt="" width="250" height="250" /></a>In a previous blog entry I discussed the concept of the Slowly Changing Dimension, or SCD. A good example is how to handle the analysis of Sales by Customer Region when a customer moves from one Region to another. The way to solve this situation is with a Type 2 SCD design. Let’s take a look…</p>
<p>The Type 2 SCD design requires that an attribute is identified as a historical attribute such that the system will keep track of the changes of that attribute so that ultimately analysis can be performed accurately across multiple dimensions including the Time dimension. The way this is done is through a “Surrogate Key” being generated in the Dimension table. Consider this design for the DimCustomer dimension table in the Data Warehouse.</p>
<p>CREATE TABLE [dbo].[DimCustomer](<br />
[CustomerSK] [int] IDENTITY(1,1) NOT NULL,<br />
[CustomerKey] [int] NOT NULL,<br />
[FirstName] [nvarchar](50) NULL,<br />
[LastName] [nvarchar](50) NULL,<br />
[GeographyKey] [int] NOT NULL,<br />
[StartDate] [datetime] NULL,<br />
[EndDate] [datetime] NULL,<br />
CONSTRAINT [PK_DimCustomer] PRIMARY KEY CLUSTERED<br />
(<br />
[CustomerSK] ASC<br />
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]<br />
) ON [PRIMARY]<br />
GO</p>
<p>In this case, GeographyKey will be the “Historical Attribute” as we want to track any changes in its value for a particular customer. CustomerKey is the “Business Key” because it’s the Primary Key from the Operational OLTP Database, but is now an ordinary attribute in the dimension table. CustomerSK is the surrogate key which will be generated by the system using the IDENTITY property and will be the Primary Key of the dimension table. The actual value of the surrogate key is of little significance except that it is unique and will be used to form a relationship with the Fact table.</p>
<p>CREATE TABLE [dbo].[FactInternetSales](<br />
[OrderQuantity] [smallint] NOT NULL,<br />
[SalesAmount] [money] NOT NULL,<br />
[DiscountPercentage] [float] NOT NULL,<br />
[DiscountAmount] [float] NOT NULL,<br />
[ProductCost] [money] NOT NULL,<br />
[ProductKey] [int] NOT NULL,<br />
[CustomerSK] [int] NOT NULL,<br />
[OrderDateTimeKey] [int] NOT NULL<br />
) ON [PRIMARY]<br />
GO</p>
<p>ALTER TABLE [dbo].[FactInternetSales]  WITH CHECK ADD  CONSTRAINT [FK_FactInternetSales_DimCustomer] FOREIGN KEY([CustomerSK])<br />
REFERENCES [dbo].[DimCustomer] ([CustomerSK])<br />
GO<br />
ALTER TABLE [dbo].[FactInternetSales] CHECK CONSTRAINT [FK_FactInternetSales_DimCustomer]<br />
GO</p>
<p>To populate the DimCustomer dimension table we could use the following query to access data from the fully normalized Operational OLTP database:</p>
<p>SELECT     Person.Contact.FirstName, Person.Contact.LastName, Sales.Customer.CustomerID, Sales.Customer.TerritoryID<br />
FROM         Person.Contact<br />
INNER JOIN Sales.Individual<br />
ON Person.Contact.ContactID = Sales.Individual.ContactID<br />
RIGHT OUTER JOIN Sales.Customer<br />
ON Sales.Individual.CustomerID = Sales.Customer.CustomerID</p>
<p>Note that the CustomerSK surrogate key is system generated and increments by one for each new row added to the dimension table. Note also that the StartDate and EndDate attributes are populated using the Slowly Changing Dimension transform or similar logic within the SSIS ETL incremental load process. For each customer move, the EndDate will be updated to reflect the date that the customer ceased to live in the old region (GeographyKey). A new row will be inserted for the same customer with the new region code and the EndDate set to NULL to indicate the current region. The CustomerSK surrogate key guarantees a unique Primary Key even though the CustomerKey has a duplicate value.</p>
<p>When the fact table rows are updated, the fact table load step within the SSIS ETL incremental load process may perform a sub-select to match the CustomerSK surrogate key with the correct customer row for the current location forming the correct Foreign Key value in the Fact table. If the incremental load is performed correctly in this way, the subsequent analysis will be accurate without any differences in end user requests. Here is the inner query of the fact table load query to populate the CustomerSK foreign key in the fact table.</p>
<p>(SELECT     CustomerSK<br />
FROM          AdvWorksDW1.dbo.DimCustomer AS dc<br />
WHERE      (dc.CustomerKey = Sales.SalesOrderHeader.CustomerID) AND (EndDate IS NULL))</p>
<p>This is the “magic” of the Type 2 SCD.</p>
<p>I developed and tested these code samples by adapting the AdventureWorks BI Sample available under  <a href="http://sqlserversamples.codeplex.com/">http://sqlserversamples.codeplex.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://globalknowledgeblog.com/technology/microsoft/slowly-changing-dimension%e2%80%89%e2%80%89%e2%80%94%e2%80%89%e2%80%89sample-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server 2008 R2  –  Master Data Services</title>
		<link>http://globalknowledgeblog.com/technology/microsoft/sql-server-2008-r2-%e2%80%93-master-data-services/</link>
		<comments>http://globalknowledgeblog.com/technology/microsoft/sql-server-2008-r2-%e2%80%93-master-data-services/#comments</comments>
		<pubDate>Wed, 12 Jan 2011 19:58:33 +0000</pubDate>
		<dc:creator>Brian Egler</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Master Data Services]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>

		<guid isPermaLink="false">http://globalknowledgeblog.com/?p=2891</guid>
		<description><![CDATA[When building a Data Warehouse, we have to go through a “Data Discovery” phase where the requirements of the Business Intelligence solution are mapped to the actual operational systems so that we can extract transform and load (ETL) the data into the Data Warehouse. This is a significant effort, especially if you have multiple application [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://globalknowledgeblog.com/wp-content/uploads/2010/12/data.jpg"><img class="alignleft size-full wp-image-2892" title="data" src="http://globalknowledgeblog.com/wp-content/uploads/2010/12/data.jpg" alt="" width="300" height="297" /></a>When building a Data Warehouse, we have to go through a “Data Discovery” phase where the requirements of the Business Intelligence solution are mapped to the actual operational systems so that we can extract transform and load (ETL) the data into the Data Warehouse. This is a significant effort, especially if you have multiple application groups to contend with. Not all systems use appropriate and friendly naming conventions! Usually we end up with a large spreadsheet with all the cross reference information, and we proceed to design the DW and build the ETL processes necessary to populate it incrementally. Well, now there is a better way – Master Data Services.</p>
<p>One of the many interesting features of Microsoft SQL Server 2008 R2 is Master Data Services (or MDS). This enhancement allows an organization to create a “Master Data Hub” which provides a “single source of truth” for the enterprise’s numerous data entities and hierarchies. The typical medium to large sized company has many disparate systems, some inherited from mergers or acquisitions, each using its own data source. These data sources can be aligned using a hub-and-spoke architecture to cross-reference the data entities into a central database that can be used for auditing, change tracking, and consolidation. It may even help you to build that Data Warehouse you’ve been thinking about.</p>
<p>Discovering the data specifications can be time-consuming, but when stored centrally and maintained with version control and change tracking, the business can benefit from this understanding of it mission critical data. When building a Data Warehouse, much of this data discovery needs to be performed, but instead of recording this information in an isolated spreadsheet, now the information can be recorded in a centralized database for all to access and contribute to. Through Web Applications, individual application groups can be held accountable for “their” data specifications through ownership, allowing all parts of the organization to contribute to the centralized “Master Data”. Ongoing Data Warehouse and Business Intelligence efforts can then benefit with the Master Data being readily available and up-to-date.</p>
<p>Master Data Services consists of the following components:</p>
<ul>
<li>Master Data Services Configuration Manager — used to setup the MDS Database and configure the Web application</li>
<li>Master Data Manager — ASP.NET application used to manage your master data</li>
<li>Master Data Services Web Service — used by developers to extend and customize the functionality of Master Data Services</li>
</ul>
<p>Note that Master Data Services (MDS) is available on only the <strong>64-bit editions</strong> of SQL Server 2008 R2 Datacenter, Enterprise and Developer. It is not supported on the 32-bit platform. It requires the .NET Framework 3.5 SP1 or later. For running the Web Applications, IIS is required with ASP.NET and Windows Authentication enabled.</p>
<p><a href="http://sqlblog.com/blogs/mds_team/archive/2009/12/10/installing-and-configuring-master-data-services-2008-r2-november-ctp.aspx">Here</a> is a good MSDN Blog on installing MDS.</p>
<p>Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://globalknowledgeblog.com/technology/microsoft/sql-server-2008-r2-%e2%80%93-master-data-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

