In a previous post I introduced you to calculated fields, and mentioned there were many other functions you could use to compute values or columns. It’s time to introduce you to the eight most used functions when it comes to manipulating strings in SQL LEFT and RIGHT If you ever need the first 3 or…
Author: slowder
SQL 101 – Calculated Fields
When working with SQL you will inevitably be asked to return data from your database in a way it’s not stored. You’ll be asked to return city, state and zip as a single string, yet they are stored separately. You’ll be asked to return grand totals, but you only have line item totals. You’ll be…
SQL 101 – The Advanced LIKE Clauses
As I promised, this is my post on advanced LIKE clauses. Previously I’ve only shown you how to do a wildcard search that would act like the dos command “dir A*.*”, returning all the files that start with the letter A. But there is far more you can do with the LIKE operator. Wildcards themselves…
SQL 101 – SELECT, Filtering Results (Part 2)
In the previous post, I covered the WHERE clause. You should now feel pretty comfortable limiting the number of rows you get to return based on the values in a column. But I’m sure you’ve already asked “How can I limit based on two different columns?” I’m glad you asked! You can chain together your…
SQL 101 – SELECT, Filtering Results
After you learn how to get data out of a table with the SELECT command, you’ll soon ask the question, how do I limit the number of results I get back. Well, If you don’t ask the question, your DBA will. I don’t think he or she would like it if you only ever used…
SQL 101 – SELECT
The first thing you need to know when learning SQL is how to get data out of a database. This means learning the SELECT command. Using this command will get the SQL server to return data to you. You can use this command to do some simple math, or to do the common “Hello World!”…
SQL 101 – What is SQL?
SQL, pronounced S – Q – L or “sequel”, stands for structured query language. It’s the language you use to tell a database what you want to do. It’s been around since the early 1970s[1], so it’s pretty well established. One of the most awesome things about learning SQL is once you learn it, you…
SQL 101 – What is a Database
The term database is used for many different meanings. But if you compared them all, I think you would find that databases are all collections of data that are organized in some way. I usually like to refer to an Excel document when I try to explain databases. An excel file has a collection of…
SQL 101
After helping others learn SQL for several years now, I keep coming back to the same topics over and over. So, I decided to write down these SQL tutorials, and continually improve them over the years. What I’ve been able to collect here is just the introduction. This series is an introduction to Microsoft SQL…
Quickly Disconnect Users From a Database
Disconnect All Users of a Database There comes a time in every DBA’s life when he or she has many users connected to a database that needs to be detached, placed in single user mode, or simply refreshed. The problem is they keep reconnecting more quickly than you can KILL them off. This is especially…