Synopses & Reviews
Anyone who interacts with today's modern databases needs to know SQL (Structured Query Language), the standard language for generating, manipulating, and retrieving database information. In recent years, the dramatic rise in the popularity of relational databases and multi-user databases has fueled a healthy demand for application developers and others who can write SQL code efficiently and correctly.
If you're new to databases, or need a SQL refresher, Learning SQL on SQL Server 2005 is an ideal step-by-step introduction to this database query tool, with everything you need for programming SQL using Microsoft's SQL Server 2005-one of the most powerful and popular database engines used today. Plenty of books explain database theory. This guide lets you apply the theory as you learn SQL. You don't need prior database knowledge, or even prior computer knowledge.
Based on a popular university-level course designed by authors Sikha Saha Bagui and Richard Walsh Earp, Learning SQL on SQL Server 2005 starts with very simple SQL concepts, and slowly builds into more complex query development. Every topic, concept, and idea comes with examples of code and output, along with exercises to help you gain proficiency in SQL and SQL Server 2005. With this book, you'll learn:
- Beginning SQL commands, such as how and where to type an SQL query, and how to create, populate, alter and delete tables
- How to customize SQL Server 2005's settings and about SQL Server 2005's functions
- About joins, a common database mechanism for combining tables
- Query development, the use of views and other derived structures, and simple set operations
- Subqueries, aggregate functions and correlated subqueries, as well as indexes and constraints that can be added to tables in SQL Server 2005
Whether you're an undergraduate computer science or MIS student, a self-learner who has access to the new Microsoft database, or work for your company's IT department, Learning SQL on SQL Server 2005 will get you up to speed on SQL in no time.
Anyone who needs to interact with today's modern databases needs to know SQL (Structured Query Language), the standard programming language for generating, manipulating, and retrieving information from a relational database. "Learning SQL on SQL Server 2005" offers a complete introduction to the language for those of you who need to learn Microsoft's SQL Server 2005. The book assumes no prior database knowledge, whether you work for your company's IT department, are an undergraduate computer science or MIS course student, or a self-learner who has access to the latest Microsoft database. "Learning SQL on SQL Server 2005" is based on the authors' introductory database course that uses SQL Server.
Earp and Bagui offer a complete introduction to SQL (Structure Query Language), the standard programming language for generating, manipulating, and retrieving information from a relational database, for those who need to learn Microsoft's SQL Server 2005.
About the Author
Dr. Sikha Bagui is an Assistant Professor in the Computer Science Department at the University of West Florida in Pensacola. She and Richard Walsh Earp have teamed up to write "Learning SQL: A Step-By-Step Guide using Oracle" and "Learning SQL: A Step-By-Step Guide using Access" for Addison-Wesley, and "Conceptual Database Design Using ER Diagrams" for CRC Press. Dr. Bagui and Richard Earp have also collaborated on several articles for academic journals in their field, and have designed an introductory database course.
Table of Contents
Dedication; Preface; Why This Book?; SQL and SQL Server; Audience and Coverage; A Few Notes About SQL Server 2005 Installation; Conventions Used in This Book; Using Code Examples; How to Contact Us; Acknowledgments; Chapter 1: Starting Microsoft SQL Server 2005; 1.1 Starting Microsoft SQL Server 2005 and SQL Server 2005's Management Studio; 1.2 Creating a Database in Microsoft SQL Server 2005; 1.3 The Query Editor; 1.4 Creating Tables Using the Load Script; 1.5 Viewing Table Definitions; 1.6 Modifying Table Definitions; 1.7 Viewing Table Data; 1.8 Deleting a Table; 1.9 Deleting a Database; 1.10 Entering a SQL Query or Statement; 1.11 Parsing a Query; 1.12 Executing a Query; 1.13 Saving a Query; 1.14 Displaying the Results; 1.15 Stopping Execution of a Long Query; 1.16 Printing the Query and Results; 1.17 Customizing SQL Server 2005; 1.18 Summary; 1.19 Review Questions; 1.20 Exercises; Chapter 2: Beginning SQL Commands in SQL Server; 2.1 Displaying Data with the SELECT Statement; 2.2 Displaying or SELECTing Rows or Tuples from a Table; 2.3 The COUNT Function; 2.4 The ROWCOUNT Function; 2.5 Using Aliases; 2.6 Synonyms; 2.7 Adding Comments to SQL Statements; 2.8 Some Conventions for Writing SQL Statements; 2.9 A Few Notes About SQL Server 2005 Syntax; 2.10 Summary; 2.11 Review Questions; 2.12 Exercises; Chapter 3: Creating, Populating, Altering, and Deleting Tables; 3.1 Data Types in SQL Server 2005; 3.2 Creating a Table; 3.3 Inserting Values into a Table; 3.4 The UPDATE Command; 3.5 The ALTER TABLE Command; 3.6 The DELETE Command; 3.7 Deleting a Table; 3.8 Summary; 3.9 Review Questions; 3.10 Exercises; 3.11 References; Chapter 4: Joins; 4.1 The JOIN; 4.2 The Cartesian Product; 4.3 Equi-Joins and Non-Equi-Joins; 4.4 Self Joins; 4.5 Using ORDER BY with a Join; 4.6 Joining More Than Two Tables; 4.7 The OUTER JOIN; 4.8 Summary; 4.9 Review Questions; 4.10 Exercises; Chapter 5: Functions; 5.1 Aggregate Functions; 5.2 Row-Level Functions; 5.3 Other Functions; 5.4 String Functions; 5.5 CONVERSION Functions; 5.6 DATE Functions; 5.7 Summary; 5.8 Review Questions; 5.9 Exercises; Chapter 6: Query Development and Derived Structures; 6.1 Query Development; 6.2 Parentheses in SQL Expressions; 6.3 Derived Structures; 6.4 Query Development with Derived Structures; 6.5 Summary; 6.6 Review Questions; 6.7 Exercises; Chapter 7: Set Operations; 7.1 Introducing Set Operations; 7.2 The UNION Operation; 7.3 The UNION ALL Operation; 7.4 Handling UNION and UNION ALL Situations with an Unequal Number of Columns; 7.5 The IN and NOT..IN Predicates; 7.6 The Difference Operation; 7.7 The Union and the Join; 7.8 A UNION Used to Implement a Full Outer Join; 7.9 Summary; 7.10 Review Questions; 7.11 Exercises; 7.12 Optional Exercise; Chapter 8: Joins Versus Subqueries; 8.1 Subquery with an IN Predicate; 8.2 The Subquery as a Join; 8.3 When the Join Cannot Be Turned into a Subquery; 8.4 More Examples Involving Joins and IN; 8.5 Using Subqueries with Operators; 8.6 Summary; 8.7 Review Questions; 8.8 Exercises; Chapter 9: Aggregation and GROUP BY; 9.1 A SELECT in Modified BNF; 9.2 The GROUP BY Clause; 9.3 The HAVING Clause; 9.4 GROUP BY and HAVING: Aggregates of Aggregates; 9.5 Auditing in Subqueries; 9.6 Nulls Revisited; 9.7 Summary; 9.8 Review Questions; 9.9 Exercises; Chapter 10: Correlated Subqueries; 10.1 Noncorrelated Subqueries; 10.2 Correlated Subqueries; 10.3 Existence Queries and Correlation; 10.4 SQL Universal and Existential Qualifiers; 10.5 Summary; 10.6 Review Questions; 10.7 Exercises; Chapter 11: Indexes and Constraints on Tables; 11.1 The "Simple" CREATE TABLE; 11.2 Indexes; 11.3 Constraints; 11.4 Summary; 11.5 Review Questions; 11.6 Exercises; The Student Database and Other Tables Used in This Book; ; Script Used to Create the Student_course Database; Glossary of Terms; Important Commands and Functions; Colophon;