Hugh Darwen SQL: A Comparative Survey

2

Download free eBooks at bookboon.com

SQL: A Comparative Survey 2th edition © 2014 Hugh Darwen & bookboon.com ISBN 978-87-403-0778-8

3

Download free eBooks at bookboon.com SQL: A Comparative Survey Contents

Contents

Preface 9

1 Introduction 11 1.1 Introduction 11 1.5 “Collection of Variables” 13 1.6 What Is an SQL ? 14 1.7 “Table” Not Equal to “Relation” 15 1.8 Anatomy of a Table 16 1.9 What Is a DBMS? 17 1.10 SQL Is a Database Language 17 1.11 What Does an SQL DBMS Do? 18 1.12 Creating and Destroying Base Tables 18 1.13 Taking Note of Integrity Rules 20 1.14 Taking Note of Authorisations 21 1.15 Updating Variables 22 1.16 Providing Results of Queries 25

�e Graduate Programme I joined MITAS because for Engineers and Geoscientists I wanted real responsibili� www.discovermitas.comMaersk.com/Mitas �e Graduate Programme I joined MITAS because for Engineers and Geoscientists I wanted real responsibili� Maersk.com/Mitas

Month 16 I wwasas a construction Month 16 supervisorI waswas in a construction the North Sea supervisor in advising and the North Sea Real work helpinghe foremen advising and IInternationalnternationaal opportunities �ree�ree wworkoro placements ssolveReal work problems helpinghe foremen IInternationalnternationaal opportunities �ree�ree wworkoro placements ssolve problems

4 Click on the ad to read more Download free eBooks at bookboon.com SQL: A Comparative Survey Contents

2 Values, Types, Variables, Operators 26 2.1 Introduction 26 2.2 Anatomy of A Command 29 2.3 Important Distinctions 30 2.4 A Closer Look at a Read-Only Operator (+) 30 2.5 Read-only Operators in SQL 30 2.6 What Is a Type? 36 2.7 What Is a Type Used For? 39 2.8 The Type of a Table 40 2.9 Table Literals 42 2.10 Types and Representations 44 2.11 What Is a Variable? 50 2.12 Updating a Variable 55 2.13 Conclusion 57

3 Predicates and Propositions 59 3.1 Introduction 59 3.2 What Is a Predicate? 60 3.3 Substitution and Instantiation 61 3.4 How a Table Represents an Extension… 62 3.5 Deriving Predicates from Predicates 62

www.job.oticon.dk

5 Click on the ad to read more Download free eBooks at bookboon.com SQL: A Comparative Survey Contents

4 — The Foundation 73 4.1 Introduction 73 4.2 Relations and Predicates 81 4.3 Relational Operators and Logical Operators 81 4.4 JOIN and AND 82 4.5 Renaming Columns 86 4.6 Projection and Existential Quantification 88 4.7 Restriction and AND 92 4.8 Extension and AND 94 4.9 UNION and OR 96 4.10 Semidifference and NOT 100 4.11 Concluding Remarks 104 EXERCISES 105

5 Building on The Foundation 107 5.1 Introduction 107 5.2 Semijoin and Composition 108 5.3 Aggregate Operators 114 5.4 Tables within a Table 118

In the past 5 years we have drilled around 95,000 km —that’s more than twice around the world.

Who are we? We are the world’s leading provider of reservoir characterization, drilling, production, and processing technologies to the oil and gas industry.

Who are we looking for? We offer countless opportunities in the following domains: n Operations n Research, Engineering, and Manufacturing n Geoscience and Petrotechnical n Commercial and Business

We’re looking for high-energy, self-motivated graduates with vision and integrity to join our team. What will you be? careers.slb.com

6 Click on the ad to read more Download free eBooks at bookboon.com SQL: A Comparative Survey Contents

5.5 Using Aggregation on Nested Tables 120 5.6 Summarization in SQL 124 5.7 Grouping and Ungrouping in SQL 126 5.8 Wrapping and unwrapping in SQL 131 5.9 Table Comparison 132 5.10 Other Operators on Tables and Rows 133 EXERCISES 134

6 Constraints and Updating 136 6.1 Introduction 136 6.2 A Closer Look at Constraints and Consistency 140 6.3 Expressing Constraint Conditions 141 6.4 Useful Shorthands for E