Databases Reference
In-Depth Information
how many rows were returned. DML statements usually just return a count of
rows affected. You receive even less with most DDL statements. In most cases,
they only return a statement that the command completed successfully.
If the command didn't complete successfully, the DBMS returns an error.
Often, the errors returned give little information other than the fact than an error
has occurred. One reason for this is security. One possible source of errors is
that someone is trying to break into a database without authorization. The less
information you provide them about why a command didn't work, the more dif-
ficult it is for them to figure out a solution without knowing the database and
database object structures.
SELF-CHECK
Briefly describe the importance of the SQL language standard.
Compare interactive and embedded SQL.
Explain why DBMS providers vary from the SQL standard.
6.2 Understanding SELECT Fundamentals
One of the most commonly used SQL commands is the SELECT command. As
you have already learned, you use SELECT to retrieve data. You can also use
SELECT to perform calculations and to retrieve the results from functions, which
are special commands designed to operate on data and return a result.
6.2.1 Working with SELECT
You have already been introduced to the SELECT statement and its basic syn-
tax. We're going to talk a bit more about SELECT because you will likely use it
more than any other command. The complete SELECT command syntax is
beyond the scope of this chapter, but we'll take a closer look at a few additional
syntax options. SELECT statement command examples used in this chapter are
all based on Microsoft SQL Server's Transact-SQL variation of the SQL standard
language. Command syntax for the SELECT command, as well as for other com-
mands discussed later in the chapter, varies for other DBMS products.
SELECT commands are considered declarative statements rather than being
procedural in nature. This means that you specify what data you are looking for
rather than provide a logical sequence of steps that guide the system in how to
find the data. The relational DBMS analyzes the declarative SQL SELECT state-
ment and creates an access path —a plan for what steps to take to respond to
the query. The SELECT command also allows the user, in some circumstances,
to exert a certain amount of logical control over the data retrieval process.
Search WWH ::




Custom Search