Cover image for Sam's teach yourself SQL in 24 hours
Sam's teach yourself SQL in 24 hours
Plew, Ronald R.
Personal Author:
Second edition.
Publication Information:
Indianapolis, Ind. : Sams Pub., [2000]

Physical Description:
xix, 440 pages : illustrations ; 23 cm
General Note:
Includes index.
Added Author:
Format :


Call Number
Material Type
Home Location
Item Holds
QA76.73.S67 S73 2000 Adult Non-Fiction Central Closed Stacks

On Order



Written by college instructors, Sams Teach Yourself SQL in 24 Hours quickly teaches beginning- to intermediate-level SQL users how to create, store, access and manipulate data using a proven step-by-step format that teaches SQL by example. This book contains a thorough explanation of database concepts, SQL procedures, and low-level programming, enabling readers to gain an understanding of the whys as well as the hows behind SQL.

This book presents complete code listings and output, followed with analysis that explains exactly what the listings are doing. These practical code examples can be incorporated easily by the reader into other projects. Coverage includes SQL, as well as SQL in an enterprise setting and on the Web and Intranet.

Authors Ryan Stephens and Ronald Plew are President and Vice President of Perpetual Technologies, Inc., where their duties include Oracle database administration and consulting and Oracle, SQL, and UNIX training. They have both been teaching at the collegiate level for over three years as adjunct professors at Indiana University-Purdue University in Indianapolis. Both are Oracle Certified Professionals, having specialized in Oracle and UNIX for more than 10 years each.

Author Notes

Ronald R. Plew is vice president and CIO for Perpetual Technologies, Inc., in Indianapolis, Indiana. Ron is a Certified Oracle Professional, and his duties include Oracle database consulting and training. Ron is an adjunct professor at Indiana University-Purdue University in Indianapolis and Indiana University at Kokomo, where he teaches SQL and various database courses. He holds a Bachelor of Science degree in Business Management/Administration from Indiana Institute of Technology, Fort Wayne, Indiana. Ron also serves in the Indiana Army National Guard, where he is the programmer/analyst for the 433rd Personnel Detachment. Ron's hobbies include golf, chess, and collecting Indianapolis 500 racing memorabilia. He shares ownership of Plew's Indy 500 Museum with is brothers, Mark and Dennis; his sister Arleen; and mother, Betty. Ron lives in Indianapolis with his wife Linda. Ron and Linda have four children and nine grandchildren.

Ryan K. Stephens is president and CEO for Perpetual Technologies, Inc., an Oracle training and consulting firm in Indianapolis, Indiana, that is partnered with Oracle Corporation. He has specialized in Oracle database and SQL for over 10 years, working as an Oracle programmer/analyst and Oracle Database Administrator. Ryan is a Certified Oracle Professional and is also an adjunct professor at Indiana University-Purdue University in Indianapolis and Indiana University at Kokomo, where he teaches SQL, PL/SQL, UNIX, Oracle Designer, Oracle Forms, and Oracle database administration. Ryan resides in Indianapolis with his wife Tina and their son Daniel.

Table of Contents

Introductionp. 1
Part I A SQL Concepts Overviewp. 5
Hour 1 Welcome to the World of SQLp. 7
SQL Definition and Historyp. 8
SQL Sessionsp. 12
Disconnectp. 13
Types of SQL Commandsp. 13
An Introduction to the Database Used in This Bookp. 16
Part II A SQL Concepts Overviewp. 23
Hour 2 Defining Data Structuresp. 25
What Is Data?p. 25
Basic Data Typesp. 26
Hour 3 Managing Database Objectsp. 37
What Are Database Objects?p. 38
What Is a Schema?p. 38
A Table: The Primary Storage for Datap. 39
Integrity Constraintsp. 47
Hour 4 The Normalization Processp. 55
Normalizing a Databasep. 56
Hour 5 Manipulating Datap. 65
Overview of Data Manipulationp. 65
Populating Tables with New Datap. 66
Updating Existing Datap. 71
Deleting Data from Tablesp. 73
Hour 6 Managing Database Transactionsp. 77
What Is a Transaction?p. 77
What Is Transactional Control?p. 78
Transactional Control and Database Performancep. 85
Part III Getting Effective Results from Queriesp. 87
Hour 7 Introduction to the Database Queryp. 89
What Is a Query?p. 89
Introduction to the SELECT Statementp. 90
Examples of Simple Queriesp. 97
Hour 8 Using Operators to Categorize Datap. 103
What Is an Operator in SQL?p. 103
Comparison Operatorsp. 104
Logical Operatorsp. 107
Conjunctive Operatorsp. 114
Negating Conditions with the NOT Operatorp. 116
Arithmetic Operatorsp. 120
Hour 9 Summarizing Data Results from a Queryp. 127
What Are Aggregate Functions?p. 128
Hour 10 Sorting and Grouping Datap. 137
Why Group Data?p. 138
The GROUP BY Clausep. 138
GROUP BY Versus ORDER BYp. 143
The HAVING Clausep. 145
Hour 11 Restructuring the Appearance of Datap. 149
The Concepts of ANSI Character Functionsp. 150
Various Common Character Functionsp. 150
Miscellaneous Character Functionsp. 159
Mathematical Functionsp. 162
Conversion Functionsp. 162
The Concept of Combining Character Functionsp. 165
Hour 12 Understanding Dates and Timesp. 169
How Is a Date Stored?p. 170
Date Functionsp. 172
Date Conversionsp. 176
Part IV Building Sophisticated Database Queriesp. 183
Hour 13 Joining Tables in Queriesp. 185
Selecting Data from Multiple Tablesp. 186
Types of Joinsp. 186
Join Considerationsp. 195
Hour 14 Using Subqueries to Define Unknown Datap. 205
What Is a Subquery?p. 206
Embedding a Subquery Within a Subqueryp. 211
Hour 15 Combing Multiple Queries into Onep. 219
Single Queries Versus Compound Queriesp. 220
Why Would I Ever Want to Use a Compound Query?p. 220
Compound Query Operatorsp. 221
Using an ORDER BY with a Compound Queryp. 227
Using a GROUP BY with a Compound Queryp. 229
Retrieving Accurate Datap. 230
Part V SQL Performance Tuningp. 235
Hour 16 Using Indexes to Improve Performancep. 237
What Is an Index?p. 238
How Do Indexes Work?p. 238
The GREATE INDEX Commandp. 239
Types of Indexesp. 239
When Should Indexes Be Considered?p. 242
When Should Indexes Be Avoided?p. 243
Hour 17 Improving Database Performancep. 247
What Is SQL Statement Tuning?p. 248
Database Tuning Versus SQL Tuningp. 248
Formatting Your SQL Statementp. 248
Full Table Scansp. 254
Other Performance Considerationsp. 255
Performance Toolsp. 258
Part VI Using SQL to Manage Users and Securityp. 263
Hour 18 Managing Database Usersp. 265
Users Are the Reasonp. 266
The Management Processp. 268
Tools Utilized by Database Usersp. 274
Hour 19 Managing Database Securityp. 277
What Is Database Security?p. 278
How Does Security Differ from User Management?p. 278
What Are Privileges?p. 279
Controlling User Accessp. 281
Controlling Privileges Through Rolesp. 286
Part VII Summarized Data Structuresp. 291
Hour 20 Creating and Using Views and Synonymsp. 293
What Is a View?p. 294
Creating Viewsp. 296
Dropping a Viewp. 303
What Is a Synonym?p. 303
Hour 21 Working with the System Catalogp. 309
What Is the System Catalog?p. 310
How Is the System Catalog Created?p. 311
What Is Contained in the System Catalog?p. 311
Examples of System Catalog Tables by Implementationp. 313
Querying the System Catalogp. 315
Updating System Catalog Objectsp. 317
Part VIII Applying SQL Fundamentals in Today's Worldp. 321
Hour 22 Advanced SQL Topicsp. 323
Advanced Topicsp. 323
Cursorsp. 324
Stored Procedures and Functionsp. 327
Triggersp. 329
Dynamic SQLp. 331
Call-Level Interfacep. 331
Using SQL to Generate SQLp. 332
Direct Versus Embedded SQLp. 333
Hour 23 Extending SQL to the Enterprise, the Internet, and the Intranetp. 337
SQL and the Enterprisep. 338
Accessing a Remote Databasep. 339
Accessing a Remote Database Through a Web Interfacep. 341
SQL and the Internetp. 342
SQL and the Intranetp. 343
Hour 24 Extensions to Standard SQLp. 347
Various Implementationsp. 347
Examples of Extensions from Some Implementationsp. 350
Interactive SQL Statementsp. 353
Part VIII Applying SQL Fundamentals in Today's Worldp. 321
A Common SQL Commandsp. 359
SQL Statementsp. 359
SQL Clausesp. 362
B ASCII Tablep. 365
C Answers to Quizzes and Exercisesp. 371
D Create Table Statements for Book Examplesp. 411
E Insert Statements for Data in Book Examplesp. 413
Insert Statementsp. 413
F Glossaryp. 419
Indexp. 423