The Language of SQL: How to Access Data in Relational Databases
Format: PDF / Kindle (mobi) / ePub
Most SQL texts attempt to serve as an encyclopedic reference on SQL syntax - an approach that is counterproductive, since this information is readily available in online references published by the major database vendors. For SQL beginners, it's more important for a book to focus on general concepts and offer clear explanations and examples of what the various statements can accomplish. This is that beginner book. A number of features make The LANGUAGE OF SQL unique among introductory SQL books. First, you will not be required to download software or sit with a computer as you read the text. The intent of this book is to provide examples of SQL usage that can be understood simply by reading them. Second, topics are organized in an intuitive and logical sequence. SQL keywords are introduced one at a time, allowing you to build on your prior understanding as you encounter new words and concepts. Finally, this book covers the syntax of three widely used databases: Microsoft SQL Server, MySQL, and Oracle, with special "Database Differences" boxes that will show you any differences in the syntax among those three databases, as well as instructions on how to obtain and install free versions of the databases. This is the only book you'll need to gain a working knowledge of SQL and relational databases.
The Language of SQL Larry Rockoff Course Technology PTR A part of Cengage Learning Australia • Brazil • Japan • Korea • Mexico • Singapore • Spain • United Kingdom • United States The Language of SQL † 2011 Course Technology, a part of Cengage Learning. Larry Rockoff ALL RIGHTS RESERVED. No part of this work covered by the copyright herein may be reproduced, transmitted, stored, or used in any form or by any means graphic, electronic, or mechanical, including but not limited to
attention to ways of specifying some more complex logical conditions in your selection criteria. 71 72 Chapter 8 ■ Boolean Logic The ability to devise complex logical conditions is sometimes called Boolean logic. This term, taken from mathematics, refers to the ability to formulate complex conditions that are evaluated as either true or false. In the aforementioned example, the condition QuantityPurchased ¼ 5 is evaluated as either true or false for each row in the table. Obviously, you
operator comes in situations where you want to use data from Excel in a SQL statement. If you want to obtain multiple values from adjacent cells in a spreadsheet for your SQL statement, Excel allows you to copy those values with a comma delimiter. This result can then be pasted inside the parentheses following the IN operator. As with the BETWEEN operator, the NOT operator can be used with the IN, as shown in this example: SELECT CustomerName, State FROM Orders WHERE State NOT IN ('IL', 'NY' )
('Smith') AS 'Sound of Smith', SOUNDEX ('Smythe') AS 'Sound of Smythe' The result is: Sound of Smith Sound of Smythe S530 S530 The SOUNDEX function always returns a four-character response, which is a sort of code for the sound of the phrase. The first character is always the first letter of the phrase. In this case, the first character is S because both Smith and Smythe begin with an S. The remaining three characters are calculated from an analysis of the sound of the rest of the phrase.
of Views The previous example illustrates one of the important benefits of using views. Once a view is created, that view can be referenced just like it was a table. Even if the view were created from multiple tables joined together, it now appears, logically, to be just one table. Let’s summarize the benefits of using views: ■ Views can reduce complexity. First, views can simplify SELECT statements that are particularly complex. For example, if you have a SELECT statement that joins six tables