Sams Teach Yourself Microsoft SQL Server T-SQL In 10 Minutes
- ISBN: 0672328674
- Pages: 320
- Publisher: Sams - August 1, 2007
- This title is out of date, and has been replaced by Sams Teach Yourself Microsoft SQL Server T-SQL In 10 Minutes - Second Edition.
SQL Server is one of the most popular and important database management systems in the world. From small development projects to some of the best known and most prestigious sites on the Web, SQL Server has proven itself to be a solid, reliable, fast, and trusted solution to all sorts of data storage needs.
This book is based on my best-selling Sams Teach Yourself SQL in 10 Minutes. That book has become one of the most used SQL tutorials in the world, with an emphasis on teaching what you really need to know, methodically, systematically, and simply. But as popular and as successful as that book it, it does have some limitations:
- In covering all of the major DBMSs, coverage of DBMS specific features and functionality had to be kept to a minimum.
- To simplify the SQL taught, the lowest common denominator had to be found, SQL statements that would (as much as possible) work with all major DBMSs. This requirement necessitated that better DBMS specific solutions not be covered.
- While basic SQL tends to be rather portable between DBMSs, more advanced SQL most definitely is not. As such, that book could not cover advanced topics like triggers, cursors, stored procedures, access control, transactions, and more, in any real detail.
And that is where this book comes in. Sams Teach Yourself SQL Server T-SQL In Ten Minutes builds on the proven tutorials and structure of Sams Teach Yourself SQL in Ten Minutes, without getting bogged down with anything but Transact SQL. Starting with simple data retrieval and working on to more complex topics including the use of joins, subqueries, regular expression and full text based searches, stored procedures, cursors, triggers, table constraints, XML support, and much more. You'll learn what you need to know methodically, systematically, and simply - in 30 highly focused lessons designed to make you immediately and effortlessly productive.
Is this book right for you? This is a beginner-intermediate book, and is not intended for SQL or Transact SQL experts. This book is for you if:
- You are new to SQL.
- You are just getting started with SQL Server and T-SQL and want to hit the ground running.
- You want to quickly learn how to get the most out of T-SQL.
- You want to learn how to use T-SQL in your own application development.
- You want to be productive quickly and easily using T-SQL without having to call someone for help.
Note: This title covers SQL Server 2000 and 2005, and several chapters are only applicable to SQL Server 2005 (and are noted as such in the text).
- 1: Understanding SQL
- 2: Introducing SQL Server
- 3: Working With SQL Server
- 4: Retrieving Data
- 5: Sorting Retrieved Data
- 6: Filtering Data
- 7: Advanced Data Filtering
- 8: Using Wildcard Filtering
- 9: Creating Calculated Fields
- 10: Using Data Manipulation Functions
- 11: Summarizing Data
- 12: Grouping Data
- 13: Working with Subqueries
- 14: Joining Tables
- 15: Creating Advanced Joins
- 16: Combining Queries
- 17: Full Text Searching
- 18: Inserting Data
- 19: Updating and Deleting Data
- 20: Creating and Manipulating Tables
- 21: Using Views
- 22: Programming With T-SQL
- 23: Working with Stored Procedures
- 24: Using Cursors
- 25: Using Triggers
- 26: Managing Transaction Processing
- 27: Working With XML
- 28: Globalization and Localization
- 29: Managing Security
- 30: Improving Performance
- Appendix A: Getting Started With SQL Server
- Appendix B: The Example Tables
- Appendix C: T-SQL Statement Syntax
- Appendix D: T-SQL Datatypes
- Appendix E: T-SQL Reserved Words
An online errata is available for this book. Select the print you have (several books have been reprinted, and different errata are available for each if appropriate):
- Original printing (320 pages, published August 1, 2007)
Downloads and Support
Appendix B: The Example Tables
Appendix B: The Example Tables describes the database tables used in the examples in this book. You may download database tables creation and population scripts here:
Getting Started With SQL Server Express 2005
Microsoft SQL Server Express 2005 is a free fully functional version of SQL Server, and is ideal for learning T-SQL with this book. To use SQL Server Express 2005, do the following:
- Download SQL Server Express 2005. It comes in several versions including the Express Edition and the Express Edition with Advanced Services, and either version will work. You'll also want a copy of the SQL Server Management Studio Express tool. If you download SQL Server Express Edition with Advanced Services, then you'll already have Management Studio as it is included with that edition. If you download SQL Server Express then you'll want to also download SQL Server Management Studio Express.
- Install SQL Server Express (and SQL Server Management Studio Express if you downloaded that separately). You will likely need to be logged in to your computer with administrative access to install this software.
- Once the installation is complete, start up SQL Server Management Studio Express - this is the tool you'll use for all of the lessons in this book.
- You will be prompted for login information. Enter the login and password that you specified during installation, or select Windows Authentication and use your Windows login.
- Once SQL Server Management Studio starts up, you'll see a panel on the left entitled Object Explorer. Locate the Databases folder within it, this displays any created databases.
- You'll want to create a new database for use with this book, so right-click on the Databases folder in the Object Explorer, and select New Database.
- You'll be prompted for the database information. Enter "crashcourse" as the Database name. You can ignore all of the other fields, and just click the OK button to create the new database.
- Now that you have a database created, you'll need to run the scripts downloadable from this web page. There are two files, create.sql and populate.sql - save them both somewhere where you can easily locate them (the desktop will do, they are only needed for setup and can be deleted once executed).
- In SQL Server Management Studio, select File, Open, File, and open file create.sql. You'll see the contents of the file displayed in the window on the right.
- Make sure the newly created "crashcourse" database is selected (otherwise you'll create the tables in the wrong database). The currently selected database is displayed in a drop-down list above the Object Explorer.
- Click the Execute button to execute the create.sql script, this will create all of the tables used in this book.
- Repeat the previous three steps for the populate.sql file, this file populates the tables with data ready for you to use.
- You can then close create.sql and populate.sql, and you are ready to write SQL yourself. TO do so, click the New Query button (above the Object Explorer to display an empty query window. You type your SQL here and then click the Execute button to execute your code. (And remember to verify that you are using the right database).