I just wanted to thank you all for a wonderful year. I’ve really enjoyed pushing myself to produce a post a week this year. It was challenging, but fun. I’d like to ask for a Christmas present from you all this year. It’s nothing that will cost you money. It will only cost you a…
Year: 2006
Optimizing Queries
This is the first article in a never ending series of articles on how to optimize your queries. Honestly, this is a topic I’m still learning volumes about. I learned pretty early on the number one rule to getting fast results from a SELECT query. Limit the results to the minimum you need If you…
SQL 201 – Statistics
Microsoft SQL Servers collect statistical information on indexes and column data stored in each database. These statistics are used by the query optimizer to choose the most efficient way to execute your queries. Good statistics hep the optimizer to asses the cost of different query plans, then choose the “best” method to execute your query….
SELECT CASE
A useful skill to learn in SQL is how to translate a value into a description. You’ll use it all the time. Whether you’re turning M|F into Male or Female, or turning T|F into True or False, you’ll have to be able to make the translation as quickly as possible. The easiest way to do…
SQL 102 – Jobs
Now that you’re familiar with stored procedures, it’s time to introduce you to jobs. Jobs are like stored procedures, in that they are a set of steps performed sequentially. Jobs can run T-SQL commands, Integration Services Packages, Analysis Services commands, replication tasks, and even command prompt applications. And what’s the best part? These steps are…
SQL 201 – Indexes
Indexes in Microsoft SQL are just like indexes in a book. They help you jump to the information you want more quickly. In Microsoft SQL you can index one or more columns in a table or view. The indexes defined can help your select statements run much more quickly… but they do have a cost,…
SQL 102 – GRANT
As an administrator, you can execute the SELECT from the Components table and the v_Components view, and execute the usp_GetBatmobileComponentsList procedure; however, your new user cannot. To grant your new user the necessary permissions, use the GRANT statement. Let’s assume for this lesson you’ve already created a SQL Server user [Lucius Fox]. Execute the following…
SQL 102 – Users
Before you got started working with SQL Server, someone had to set up a user account for you. Now that you’re learning to become a database administrator you need to learn to allow others to have access to SQL Servers. Granting a user access to a database takes three steps. First, create a login, second…
SQL 102 – Primary Keys
In SQL 101, I showed you how to create a table. I want to build on that today by introducing the concept of a primary key. A primary key is a column, or combination of columns that uniquely identify the row in the table. By doing this you can have some assurance that the row…
SQL 201 – Views
Previously I showed you how to create tables. The normal goal for designing a table is to store data in such a way that each table contains one group of facts that are highly related to each other. For example, if you had built a contact database, you’d have one table for people, one for…