SQL queries for mere mortals. Michael J. Hernandez, John L. Viescas - SQL queries for mere mortals Sql for mere mortals fb2

SQL for mere mortals + SQL in 10 minutes
Sams Teach Yourself SQL in 10 Minutes
Author: Ben Forta
Translator: V. Ginzburg
Languages: Russian
Publisher: Williams
Series: Learn in 10 Minutes
ISBN 978-5-8459-1858-1, 978-0-672-33607-2; 2014

Pages 288 pp.
Format 84x108 / 32 (130x200 mm)
Circulation 2000 copies.
Hardcover Paperback

The SQL book in 10 minutes offers simple and practical solutions for those who want to get results quickly. After completing all 22 lessons, each of which will take no more than 10 minutes, you will learn about everything you need to practice SQL applications... The examples given in the book are suitable for IBM DB2, Microsoft Access, Microsoft SQL Server, MySQL, Oracle, PostgreSQL, SQLite, MariaDB, and Apache OpenOffice Base.
access to all links
Visual examples will help you understand how SQL statements are structured.
Tips provide short cuts to solutions.
Warnings help you avoid common mistakes.
Notes will provide additional clarification.
What you can learn in 10 minutes:


  • - basic SQL statements;
    - Creation of complex SQL queries with many sentences and operators;
    - extraction, sorting and formatting of data;
    - obtaining specific data using different methods filtration;
    - the use of summary functions to obtain summary data;
    - joining relational tables;
    - adding, updating and deleting data;
    - creation and modification of tables;
    - working with views, stored procedures and much more.
Ben Forta is director of development at Adobe Systems. Author of many bestsellers, including books on databases, SQL and ColdFusion. Has extensive experience in database design and application development.

Understanding SQL
Author: Martin Graber
Translator: V. Yastrebov
Languages: Russian
Publisher: Lori
ISBN 978-5-85582-301-1; 2014
additional characteristics
Pages 378 pp.
Format 70x100 / 16 (170x240 mm)
Circulation 200 copies.
Hardcover Paperback

SQL FOR ELEMENTS is a complete introduction to Structured Query Language, written especially for beginners. If you are new to database management, this book will teach you how to work with SQL easily and fluently using simple queries and complex operations. To master SQL:
- Understand the concepts related to database management with a concise and simple introduction into relational databases.
- Follow these instructions for use main teams SQL for searching information located in data tables and working with it. Learn to select and summarize data, as well as skillfully manage it.
- Effectively work with compound data tables by applying advanced query techniques to more than one table at a time, constructing complex queries and subqueries.
- Create new datasheets for retail business applications. Learn important principles for effective database design and data integrity and protection techniques.
- Learn to apply SQL with programming languages ​​using the dedicated programmer chapter.

SQL FOR SIMPLE MORTAL is a must-have guide to any structured query language implementation, including a quick reference to standard SQL and a description of the common properties of non-standard SQL.



SQL FOR ELEMENTS is a complete introduction to Structured Query Language, written especially for beginners. If you are new to database management, this book will teach you how to work with SQL easily and fluently using simple queries and complex operations. To master SQL:

  • Grasp the meaning of database management concepts with a concise and simple introduction to relational databases.
  • Follow these instructions for using basic SQL commands to find and work with information in data tables. Learn to select and summarize data, as well as skillfully manage it.
  • Work efficiently with compound data tables by applying advanced query techniques to more than one table at a time by constructing complex queries and subqueries.
  • Create new datasheets for retail business applications. Learn important principles for effective database design and data integrity and protection techniques.
  • Learn to apply SQL with programming languages ​​using the dedicated programmer chapter.

SQL FOR SIMPLE MORTAL is a must-have guide to any structured query language implementation, including a quick reference to standard SQL and a description of the common properties of non-standard SQL.

1. Introduction to relational databases
2. Introduction to SQL
3. Using SQL to fetch data from tables
4. Using relational and boolean operators to create more complex predicates
5. Using special operators in "conditions"
6. Summarizing data using aggregation functions
7. Formatting query results
8. Using multiple tables in one query
9. Connection operation, the operands of which are represented by one table
10. Nesting requests
11. Related subqueries
12. Using the EXISTS operator
13. Using the ANY, ALL and SOME Operators
14. Using the UNION clause
15. Entering, deleting and changing field values
16. Using Subqueries with Update Commands
17. Creating tables
18. Restrictions on the set of valid data values
19. Maintaining data integrity
20. Introduction to Views
21. Changing values ​​using views
22. Determination of data access rights
23. Global Aspects of SQL
24. How order is maintained in the SQL database
25. Using SQL with other programming languages ​​(embedded SQL)
Applications
A. Answers to exercises
B. SQL data types
C. Some general deviations from the SQL standard
D. Syntax and Command Reference
E. Tables used in examples
F. SQL Today

An introduction to relational databases

... We will also use both terms interchangeably when discussing SQL. You are already familiar with simple tables. For all their brevity and simplicity, they are quite suitable for demonstrating the most important features of the language, as you will see for yourself later. Sometimes we will introduce other tables or look at other data in one of these tables in order to show some additional features their application. We are now ready to dive into SQL directly. The next chapter, to
which you will have to return from time to time, gives a general idea of ​​the language and guides you in the material presented in the book.

Introduction to SQL

This chapter covers a lot of basic information that gives you a basic understanding of SQL. You learned how it is structured, how it is used, how data is expressed in it, how and by whom it is defined (and what conflicts arise), as well as some of the conventions and terminology used to describe it. The next chapter explains in detail the formation and operation of commands. You will become familiar with the command that allows you to extract information from tables, which is one of the most commonly used in SQL. You will be able to retrieve certain information yourself from the database.

Global aspects of SQL

  • Synonyms (how to create new names for data objects)
  • Database space (dbspace) (how to split the space available in the database)
  • Transaction processing (how to save or discard changes in the database)
  • Concurrency control (how SQL allows you to eliminate the influence of commands on each other)

Synonyms are objects, have names and (sometimes) owners, but do not exist independently and independently of the table whose name they replace. They can be shared and therefore accessible to everyone who has access to the object, or they can only belong to specific user... Dbspaces are database subsections allocated to users. It is best to store linked tables that are frequently joined in the same database space. COMMIT and ROLLBACK are commands used to save as a group all database changes, starting from previous command COMMIT or ROLLBACK, or from the start of a session, or to abandon them. Concurrency control determines the extent to which concurrent commands affect each other. This is where the "working" differences in how databases work and how to isolate the results of command execution emerge.

How order is maintained in a SQL database

So, SQL systems use a lot of tables, which is called the system catalog of the database structure. These tables can be queried, but they cannot be updated. In addition, comment columns can be added (and deleted) to the SYSTEMCATALOG and SYSTEMCOLUMNS tables. Creating views for these tables is an excellent way to pinpoint the information that users have access to. This concludes our discussion of SQL in interactive mode. The next chapter will consider the issues of using SQL directly in programs written in programming languages; such use allows you to take advantage of the interaction of the program with the database.

Using SQL with other programming languages ​​(embedded SQL)

SQL commands are included in procedural programming languages ​​to combine the strengths of the two approaches. Implementing this feature requires some SQL extensions. Embedded SQL commands are translated using a program called a precompiler (preprocessor) to create a program that the language compiler can understand high level... Embedded SQL commands are replaced by calls to subroutines that are created using the embedded preprocessor; these routines are called accessors. With this approach, ANSI supports embedded SQL for languages Pascal programming, FORTRAN, COBOL, PL / 1. Other languages ​​are also used by developers. The most important of these is C. When describing embedded SQL, pay particular attention to the following:

  • All embedded SQL commands begin with EXEC SQL and end depending on the high-level language used.
  • All high-level language variables used in SQL commands must be included in the SQL declaration section before they are used.
  • When high-level language variables are used in SQL commands, a colon must be used before their names.
  • Output for queries can be stored directly in high-level language variables using INTO if and only if the query fetches a single row.
  • Cursors can be used to store and access query output one line at a time. Cursors are declared (along with the query definition whose output contains the cursor), opened (which corresponds to the execution of the query), and closed (which corresponds to removing the output from the cursor, breaking the link between the output and the cursor). While the cursor is open, you can use the FETCH command to access the output of the query: one line for each execution of the FETCH command.
  • Cursors can be updatable or read-only. To be updatable, a cursor must meet all of the same criteria as a view. It should not use the clauses ORDER VU and UNION, which are not allowed in the view. The non-updateable cursor is a read-only cursor.
  • If the cursor is updatable, it can be used to manipulate the rows that are used by the inline SQL UPDATE and DELETE commands from the WHERE CURRENT OF clause. DELETE or UPDATE must belong to the table accessed through the query cursor.
  • SQLCODE can be declared as a numeric variable for every embedded SQL program. The values ​​of this variable are set automatically after each SQL command is executed.
  • If the SQL command runs normally, but does not generate output or does not perform the expected changes in the database, SQLCODE is set to 100. If the command fails, then SQLCODE takes some negative value describing the cause of the error, depending on the specific SQL system. Otherwise, SQLCODE is zero.
  • The WHENEVER clause can be used to determine the action to take if the SQLCODE is 100 (NOT FOUND) or negative (SQLERROR - SQL execution error). This action is to go to a certain point in the program (GOTO<метка>) or to perform an “empty action” (CONTINUE, equivalent to “do nothing”). The default is “empty action”.
  • Only numeric variables can be used as indicators. Indicator variables follow other variable names in the SQL command without any delimiter characters, except for the word INDICATOR.
  • Typically, the value of an indicator variable is O. If a SQL command tries to place a NULL value in a high-level language variable that uses this indicator, then it takes a negative value. This property can be used for error protection and as a flag to flag NULL values ​​in SQL that will be specially interpreted in the main program.
  • Indicator variables can be used to insert NULL values ​​into SQL INSERT or UPDATE commands. They take positive values ​​when a string truncation situation occurs.
Databases General Michael J. Hernandez, John L. Viescas - SQL queries for mere mortals

Michael J. Hernandez, John L. Viescas - SQL queries for mere mortals

03.09.2009

The SQL Queries for Mortals book is an excellent introduction to SQL queries. A real programmer (mere mortal) spends a lot of time writing SQL queries and less time designing the database itself. The schemes are run by high-paid DBAs with private offices and sports cars. Most programmers are busy trying to make SQL work under a hard-coded schema.

Authors
Michael J. Hernandez is a well-known relational database consultant and owner of the Seattle-based DataTex Consulting Group. He often speaks at various conferences. He also wrote the book Database Design for Mere Mortals.

John L. Viescas- President of Viescas Consulting, Inc., a renowned database consulting company. He is also the author of the bestselling book Running Microsoft Access 2000 and The Programmer's Quick Reference Guide to SQL.

Download the book SQL queries for mere mortals

SQL Books - SQL Queries for Mortals

Over the past few years, from a language known only to computer scientists, SQL has evolved into a widely used language. international standard... The total number of SQL compliant databases shipped each year is now in the millions. If you are accessing corporate information on the Internet or over an intranet, then you are probably using SQL. The SQL Queries for Mortals book will help novice users learn the basics of SQL queries and will be a must-have reference guide for experienced and advanced users.

SQL queries for mere mortals. SQL Book Description

This book is an excellent introduction to SQL queries and complements the previous book Database Design for Mortals by Addison-Wesley. It can be said that this is an even better introduction than the first book. A real programmer (i.e. a mere mortal) spends more time writing SQL queries and less time designing the database itself. The schemes are run by high-paid DBAs with private offices and sports cars. Most programmers are trying to make SQL work under a hard-coded schema.
By virtue of my profession, I set up databases and teach advanced SQL, so I can confirm that most of the texts in SQL are the same
attractive to read, like Egyptian hieroglyphs. Once the program starts working, the programmer who wrote it moves on to the next problem, never looking back at what was done. And when something is wrong with this program, another person sends desperate messages to discussion groups on the Internet, where John and Mike will save him with a few wise words and rewriting the code. For years they have helped people solve their problems related to SQL... Finally, it's time to put it all in a book that anyone can use!
It is not difficult at all and does not take any other time to write good program... If you understand what you are doing, then most problems can be solved quite simply. First of all, you need to learn the basics. This book provides you with the chance to learn these basics in an understandable and well-written manner. Then you need to understand when and how to adapt a simple solution to a specific DBMS and specific SQL implementation. When the basics are firmly grasped, contact me and I will teach you really non-trivial things.

Over the past few years, SQL has evolved from a language known only to computer scientists to a widely used international standard. The total number of SQL compliant databases shipped each year is now in the millions. If you are accessing corporate information on the Internet or over an intranet, then you are probably using SQL. The SQL Queries for Mortals book will help novice users learn the basics of SQL queries and will be an indispensable reference guide for experienced and advanced users.


Content.
Part I Relational databases and SQL. 1
Chapter 1 What is "relational" ?. 3
Database types3
Short story relational model. 4
Anatomy of a relational database. 5
Why all this is needed. fourteen
Outcomes.16
Chapter 2 Ensuring the reliability of the database structure. 17
Why is this chapter placed here. 17
Why a well thought out structure is needed. eighteen
Setting up fields. eighteen
Setting up tables. 26
Installation and correction of connections. 36
And it's all?. 43
Results. 43
Chapter 3 A Brief History of SQL. 45
The origins of SQL. 45
Early implementations. 47
"and then there was the Standard." 48
Development of the ANSI / ISO standard. 49
What the future holds. 54
Why learn SQL. 56
Results. 57
Part II SQL Basics. 59
Chapter 4 Building Simple Queries. 61
Familiarity with SQL. 61
SELECT statement. 62
A quick digression: Data versus information.64
Translation of the query into SQL. 66
Eliminate Duplicate Rows. 72
Sorting information. 74
Saving work79
Examples of operators. 79
Outcome. 87
Tasks for an independent solution. 88
Chapter 5 How to get more than just columns. 91
SELECT clause, take two. 92
Outside of Azov96
What is "expression" 97
What are you trying to express. 97
Expression types. 100
Using expressions in the SELECT clause. 109
Null value. 117
Examples of operators. 120
Results. 127
Tasks for an independent solution. 128
Chapter B Data Filtering 131
Clarification obtained using WHERE. 131
Definition of search conditions. 135
Using multiple conditions. 156
Re-encounter with NULL: Cautionary note. 168
Expression of conditions different ways. 172
Examples of operators. 173
Results. 179
Tasks for an independent solution. 179
Part III Working with multiple tables. 183
Chapter 7 Thinking in sets. 185
What is the set. 186
Operations on sets. 186
Intersection. 187
Difference. 192
Union. 199
Set operations in SQL. 203
Results. 212
Chapter 8 Internal connections. 214
What is JOIN. 214
INNER JOIN. 215
Application of the INNER JOIN. 231 conditions
Operator examples. 233
Results. 251
Tasks for independent solution. 251
Chapter 9 External Connections. 255
What is OUTER JOIN.255
LEFT / RIGHT OUTER JOIN.257
FULL OUTER JOIN.276
Using OUTER JOIN. 281
Operator examples. 282
Results. 295
Tasks for independent solution296
Chapter 10 UNION Operations 298
What is UNION.298
Writing queries with UNION.300
Application of UNION.311
Operator examples. 312
Outcomes. 322
Tasks for independent solution. 322
Chapter 11 * Subqueries325
What is a subquery. 326
Subqueries as Column Expressions. 327
Subqueries as Filters. 332
Using Subqueries. 347
Operator examples349
Outcome. 361
Tasks for independent solution. 362
Part IV Data summarization and grouping. 365
Chapter 12 * Simple Sum. 367
Aggregate Functions. 367
Using aggregate functions in filters. 381
Operator examples. 384
Results. 390
Tasks for independent solution. 390
Chapter 13 Grouping data. 393
Why do I need to group data. 393
GROUP BY clause. 395
Imposing some restrictions. 404
Using GROUP BY.408
Operator examples. 409
Outcomes. 417
Tasks for independent solution. 418
Chapter 14 Filtering Grouped Data 420
Narrowing the groups. 420
Filters: Feel the Difference. 425
Using HAVING. 432
Examples of operators. 433
Results. 441
Tasks for an independent solution. 441
Conclusion. 445
Applications 447
Appendix A Diagrams of the SQL Standard. 449
Appendix C Database Structures Used
as examples. 455
Appendix C Recommended Reading. 459

Foreword
SQL Queries for Mortals is an excellent introduction to SQL queries and complements the previous book Designing a Database for Mortals by Addison-Wesley. It can be said that this is an even better introduction than the first book. A real programmer (i.e., a mere mortal) spends more time writing SQL queries and less time designing the database itself. The schemes are run by high-paid DBAs with private offices and sports cars. Most programmers are trying to make SQL work under a hard-coded schema.
As a profession, I customize databases and teach advanced SQL, so I can attest that most SQL texts are as easy to read as Egyptian hieroglyphs. Once the program starts running, the programmer who wrote it moves on to the next problem, never looking back at what was done. And when something is wrong with this program, another person sends desperate messages to discussion groups on the Internet, where John and Mike will save him with a few wise words and rewriting the code. They have been helping people solve their SQL problems for years. Finally, it's time to put it all in a book that anyone can use!


Free download e-book in a convenient format, watch and read:
Download the book SQL Queries for Mortals, A Practical Guide to Manipulating Data in SQL, Michael J. Hernandez, John L. Viescas., 2003 - fileskachat.com, fast and free download.

Download pdf
Below you can buy this book on best price with a discount with delivery throughout Russia.