We previously looked at an introduction to Vertical Partitioning where we covered what it is and the potential benefits and drawbacks of using it. Here I wanted to build up some data and show how we may vertically partition it to help make it more manageable for us. So that we’ve got some relevant data to use […]
Tag: Querying
Introduction to Vertical Partitioning
When dealing with large volumes of data in SQL Server we may need to look for strategies to make querying and managing the data easier to handle. A few months back we looked at an approach where we partitioned our data into multiple segments by applying partition functions and schemes to our tables. This helps […]
Querying with Aliases
When writing larger queries which return more fields or join together an increasing number of tables it can be easy for scripts to get unruly. A fundamental skill to help with the readablity of you queries is through the use of Aliases. An alias provides us a was to change how we reference part of […]
Performance Considerations using APPLY
In the previous post we looked at how to use the CROSS APPLY and OUTER APPLY operators as alternative to a JOIN in queries with some examples. As we wrapped that up I also mentioned that there can be drawbacks to using APPLY in our queries, particularly when we’re working with large data sets. The issue is due to the way that the right hand […]
Using Cross Apply and Outer Apply
When joining data in SQL we have a number of options to us including INNER and OUTER joins, but one of the ones I tend to use less frequently is the APPLY operator, specifically the CROSS APPLY and OUTER APPLY operators. As with other types of joins they operate slightly differently and have considerations which should be taken into account when deciding on the output […]
Complex Updates and Deletes
The UPDATE and DELETE statements allow us to manage the data within our databases and being able to use them effectively is key. There was recently a question from a junior developer asking about how to perform data changes when table joins are required so I thought it a good opportunity to put forward some more thought out details […]
SSMS Tip: Show Table Details
Sometimes when you’re querying a set of data for the first time it can be tricky to understand the results you see. What are the data types? How is the data keyed? Are there any constraints in place? Does the table have foreign keys relating to other tables? So you might then end up scanning […]
Last time out we looked at referencing tables across databases. While we of course have the option of using three-part naming to address the table, we also considered views and synonyms as two alternative options. Both of these can be used to achieve similar results. There are elements which they have in common and others which […]
Referencing Cross-Database Objects
In SQL Server we’ll typically end up using environments containing multiple databases which happen to have data which relate to each other. Due to this there will be times when we’ll need to reference objects in another database when writing a query. What options do we have for doing this? Here we’ll look at three […]
T-SQL Tuesday #152 – It Depends
As Deborah’s invitation opens this month she quite rightly points out that there are a lot of professionals out there who have a few (passionate) opinions about what they do or the way they do it. This month we’re invited to … well, have a rant – a rant about those experiences which have shaped […]