Microsoft® SQL Server™ 2008 All-In-One Desk Reference For Dummies®
by Robert D. Schneider, Darril Gibson
III.5.2. Retrieving Data from a Single Table
The simplest query is one that retrieves data from a single table. It doesn't require any join statements; instead, it uses a simple SELECT statement querying only one table.
A SELECT statement is one of several Data Manipulation Language (DML) statements. The SELECT statement reads data only, but doesn't modify it. Other DML statements are:
INSERT: Adds new rows to a table.
UPDATE: Modifies existing rows in a table.
DELETE: Removes rows from a table.
By understanding the SELECT statement in detail, the other DML statements become much easier to grasp.
III.5.2.1. Using IntelliSense
One of the great features of SQL Server 2008 is the introduction of IntelliSense. When you're writing a query, IntelliSense identifies what commands are acceptable and provides you appropriate choices.
For example, you could have your query window pointed at AdventureWorks2008. Your plan is to type in the following query:
SELECT * FROM HumanResources.Employee
However, after you type in the H (as in SELECT * FROM H) an IntelliSense popup window appears, showing you all the possible choices. Because you entered an H, it displays the choices starting with H. Pressing the Tab key, the spacebar, or the Enter key selects the choice you want (in this case, HumanResources).
HumanResources fills in. Type in a period and all the objects in the HumanResources schema appear. Select Employee, press Return, and you're done.
SQL developers have wanted this feature for a ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access