Quoted strings in column headings  Computed values in the select list

Chapter 2: Queries: Selecting Data from a Table

Character strings in query results

The select statements you have seen so far produce results showing data in the database. You can also write queries so that the results contain strings of characters.

Enclose the string to include in single or double quotation marks and separate it from other elements in the select list with a comma. Use double quotation marks if there is an apostrophe in the string—otherwise, the apostrophe is interpreted as a single quotation mark.

Here is a query with a character string:

select "The publisher’s name is", Publisher = pub_name 
from publishers 
                              Publisher 
------------------------      --------------------
The publisher’s name is       New Age Books 
The publisher’s name is       Binnet & Hardley 
The publisher’s name is       Algodata Infosystems 
 
(3 rows affected) 




Copyright © 2005. Sybase Inc. All rights reserved. Computed values in the select list

View this book as PDF