SQL:1999, Formerly Known As SQL3

Total Page:16

File Type:pdf, Size:1020Kb

SQL:1999, Formerly Known As SQL3 SQL:1999, formerly known as SQL3 Andrew Eisenberg Jim Melton Sybase, Concord, MA 01742 Sandy, UT 84093 [email protected] [email protected] number of Working Groups to actually do the Background technical work—WG3 (Database Languages) is responsible for the SQL standard, while WG4 is For several years now, you’ve been hearing and progressing the SQL/MM (SQL MultiMedia, a suite reading about an emerging standard that everybody of standards that specify type libraries using SQL’s has been calling SQL3. Intended as a major object-oriented facilities). enhancement of the current second generation SQL In the United States, IT standards are standard, commonly called SQL-92 because of the handled by the American National Standards year it was published, SQL3 was originally planned Institute’s Accredited Standards Development to be issued in about 1996…but things didn’t go as Committee NCITS (National Committee for planned. Information Technology Standardization, formerly As you may be aware, SQL3 has been known more simply as “X3”). NCITS Technical characterized as “object-oriented SQL” and is the Committee H2 (formerly “X3H2”) is responsible for foundation for several object-relational database several data management-related standards, including management systems (including Oracle’s ORACLE8, SQL and SQL/MM. Informix’ Universal Server, IBM’s DB2 Universal When the first generation of SQL was Database, and Cloudscape’s Cloudscape, among developed (SQL-86 and its minor enhancement SQL- others). This is widely viewed as a “good thing”, but 89), much—perhaps most—of the development work it has had a downside, too: it took nearly 7 years to was done in the USA by X3H2 and other nations develop, instead of the planned 3 or 4. participated largely in the mode of reviewing and As we shall show, SQL:1999 is much more critiquing the work ANSI proposed. By the time than merely SQL-92 plus object technology. It SQL-89 was published, the international community involves additional features that we consider to fall was becoming very active in writing proposals for the into SQL’s relational heritage, as well as a total specification that became SQL-92; that has not restructuring of the standards documents themselves changed while SQL:1999 was being developed, nor with an eye towards more effective standards do we believe it’s likely to change in the future— progression in the future. SQL is truly an international collaborative effort. A work of explanation is in order about the Standards Development informal names we’re using for various editions of Process the SQL standard. The first versions of the standard are widely known as SQL-86 (or SQL-87, since the The two de jure organizations actively involved in ISO version wasn’t published until early 1987), SQL- SQL standardization, and therefore in the 89, and SQL-92, while the version just now being development of SQL:1999, are ANSI and ISO. finalized should become known as SQL:1999. Why More specifically, the international the difference…why not “SQL-99”? Well, simply community works through ISO/IEC JTC1 (Joint because we have to start thinking about what the next Technical Committee 1), a committee formed by the generation will be called, and “SQL-02” seemed International Organization for Standardization in more likely to be confused with “SQL2” (which was conjunction with the International Electrotechnical the project name under which SQL-92 was Commission. JTC1’s responsibility is to develop and developed)…not to mention the fact that “02” isn’t maintain standards related to Information really greater than “99”. In other words, we don’t Technology. Within JTC1, Subcommittee SC32, want even the name of the SQL standard to suffer titled Data Management and Interchange, was from the year 2000 problem! recently formed to take over standardization of several standards related to database and metadata that had been developed by other organizations (such Contents of SQL:1999 as the now-disbanded SC21). SC32, in turn, formed a With that background under our belts, it’s time to take a survey of the actual contents of SQL:1999. While we recognize that most readers of this column will not know the precise contents of even SQL-92, WHERE COL1 > COL2 AND space limitations prohibit our presenting the complete COL3 = COL4 OR feature set of SQL:1999. Consequently, we’re going UNIQUE(COL6) IS NOT FALSE to restrict our overview to just those features that are new to this most recent generation of the SQL SQL:1999 also has two new composite standard. types: ARRAY and ROW. The ARRAY type allows The features of SQL:1999 can be crudely one to store collections of values directly in a column partitioned into its “relational features” and its of a database table. For example: “object-oriented features”. We’ll cover them in that sequence for convenience. WEEKDAYS VARCHAR(10) ARRAY[7] would allow one to store the names of all seven Relational Features weekdays directly in a single row in the database. Although we call this category of features Does this mean that SQL:1999 allows databases that “relational”, you’ll quickly recognize that it’s more do not satisfy first normal form? Indeed, it does, in appropriately categorized as “features that relate to the sense that it allows “repeating groups”, which SQL’s traditional role and data model”…a somewhat first normal form prohibits. (However, some have less pithy phrase. The features here are not strictly argued that SQL:1999’s ARRAY type merely allows limited to the relational model, but are also unrelated storage of information that can be decomposed, much to object orientation. as the SUBSTRING function can decompose These features are often divided into about character strings—and therefore doesn’t truly violate five groups: new data types, new predicates, the spirit of first normal form.) enhanced semantics, additional security, and active The ROW type in SQL:1999 is an extension database. We’ll look at each in turn. of the (anonymous) row type that SQL has always had and depended on having. It gives database New Data Types designers the additional power of storing structured values in single columns of the database: SQL:1999 has four new data types (although one of them has some identifiable variants). The first CREATE TABLE employee ( of these types is the LARGE OBJECT, or LOB, type. EMP_ID INTEGER, This is the type with variants: CHARACTER NAME ROW ( LARGE OBJECT (CLOB) and BINARY LARGE GIVEN VARCHAR(30), OBJECT (BLOB). CLOBs behave a lot like character FAMILY VARCHAR(30) ), strings, but have restrictions that disallow their use in ADDRESS ROW ( PRIMARY KEYs or UNIQUE predicates, in STREET VARCHAR(50), FOREIGN KEYs, and in comparisons other than CITY VARCHAR(30), purely equality or inequality tests. BLOBs have STATE CHAR(2) ) similar restrictions. (By implication, LOBs cannot be SALARY REAL ) used in GROUP BY or ORDER BY clauses, either.) Applications would typically not transfer entire LOB SELECT E.NAME.FAMILY values to and from the database (after initial storage, FROM employee E that is), but would manipulate LOB values through a special client-side type called a LOB locator. In While you might argue that this also violates first SQL:1999, a locator is a unique binary value that acts normal form, most observers recognize it as just as a sort of surrogate for a value held within the another “decomposable” data type. database; locators can be used in operations (such as SQL:1999 adds yet another data type-related SUBSTRING) without the overhead of transferring facility, called “distinct types”. Recognizing that it’s an entire LOB value across the client-server generally unlikely that an application would want, interface. say to directly compare an employee’s shoe size with Another new data type is the BOOLEAN his or her IQ, the language allows programmers to type, which allows SQL to directly record truth declare SHOE_SIZE and IQ to each be “based on” values true, false, and unknown. Complex INTEGER, but prohibit direct mixing of those two combinations of predicates can also be expressed in types in expressions. Thus, an expression like: ways that are somewhat more user-friendly than the usual sort of restructuring might make them: WHERE MY_SHOE_SIZE > MY_IQ of UNIX’s characters were already in use for other (where the variable name implies its data type) would purposes in SQL. be recognized as a syntax error. Each of those two The other new predicate, DISTINCT, is very types may be “represented” as an INTEGER, but the similar in operation to SQL’s ordinary UNIQUE SQL system doesn’t allow them to be mixed in predicate; the important difference is that two null expressions—nor for either to be, say, multiplied by values are considered not equal to one another and an INTEGER: would thus satisfy the UNIQUE predicate, but not all applications want that to be the case. The DISTINCT SET MY_IQ = MY_IQ * 2 predicate considers two null values to be not distinct from one another (even though they are neither equal Instead, programs have to explicitly express their to nor not equal to one another) and thus those two deliberate intent when doing such mixing: null values would cause a DISTINCT predicate not to be satisfied. WHERE MY_SHOE_SIZE > CAST (MY_IQ AS SHOE_SIZE) SET MY_IQ = SQL:1999’s New Semantics MY_IQ * CAST(2 AS IQ) It’s difficult to know exactly where to draw the line when talking about new semantics in SQL:1999, but In addition to these types, SQL:1999 has we’ll give a short list of what we believe to be the also introduced user-defined types, but they fall into most important new behavioral aspects of the the object-oriented feature list.
Recommended publications
  • Sql Create Table Variable from Select
    Sql Create Table Variable From Select Do-nothing Dory resurrect, his incurvature distasting crows satanically. Sacrilegious and bushwhacking Jamey homologising, but Harcourt first-hand coiffures her muntjac. Intertarsal and crawlier Towney fanes tenfold and euhemerizing his assistance briskly and terrifyingly. How to clean starting value inside of data from select statements and where to use matlab compiler to store sql, and then a regular join You may not supported for that you are either hive temporary variable table. Before we examine the specific methods let's create an obscure procedure. INSERT INTO EXEC sql server exec into table. Now you can show insert update delete and invent all operations with building such as in pay following a write i like the Declare TempTable. When done use t or t or when to compact a table variable t. Procedure should create the temporary tables instead has regular tables. Lesson 4 Creating Tables SQLCourse. EXISTS tmp GO round TABLE tmp id int NULL SELECT empire FROM. SQL Server How small Create a Temp Table with Dynamic. When done look sir the Execution Plan save the SELECT Statement SQL Server is. Proc sql create whole health will select weight married from myliboutdata ORDER to weight ASC. How to add static value while INSERT INTO with cinnamon in a. Ssrs invalid object name temp table. Introduction to Table Variable Deferred Compilation SQL. How many pass the bash array in 'right IN' clause will select query. Creating a pope from public Query Vertica. Thus attitude is no performance cost for packaging a SELECT statement into an inline.
    [Show full text]
  • Look out the Window Functions and Free Your SQL
    Concepts Syntax Other Look Out The Window Functions and free your SQL Gianni Ciolli 2ndQuadrant Italia PostgreSQL Conference Europe 2011 October 18-21, Amsterdam Look Out The Window Functions Gianni Ciolli Concepts Syntax Other Outline 1 Concepts Aggregates Different aggregations Partitions Window frames 2 Syntax Frames from 9.0 Frames in 8.4 3 Other A larger example Question time Look Out The Window Functions Gianni Ciolli Concepts Syntax Other Aggregates Aggregates 1 Example of an aggregate Problem 1 How many rows there are in table a? Solution SELECT count(*) FROM a; • Here count is an aggregate function (SQL keyword AGGREGATE). Look Out The Window Functions Gianni Ciolli Concepts Syntax Other Aggregates Aggregates 2 Functions and Aggregates • FUNCTIONs: • input: one row • output: either one row or a set of rows: • AGGREGATEs: • input: a set of rows • output: one row Look Out The Window Functions Gianni Ciolli Concepts Syntax Other Different aggregations Different aggregations 1 Without window functions, and with them GROUP BY col1, . , coln window functions any supported only PostgreSQL PostgreSQL version version 8.4+ compute aggregates compute aggregates via by creating groups partitions and window frames output is one row output is one row for each group for each input row Look Out The Window Functions Gianni Ciolli Concepts Syntax Other Different aggregations Different aggregations 2 Without window functions, and with them GROUP BY col1, . , coln window functions only one way of aggregating different rows in the same for each group
    [Show full text]
  • How to Get Data from Oracle to Postgresql and Vice Versa Who We Are
    How to get data from Oracle to PostgreSQL and vice versa Who we are The Company > Founded in 2010 > More than 70 specialists > Specialized in the Middleware Infrastructure > The invisible part of IT > Customers in Switzerland and all over Europe Our Offer > Consulting > Service Level Agreements (SLA) > Trainings > License Management How to get data from Oracle to PostgreSQL and vice versa 19.06.2020 Page 2 About me Daniel Westermann Principal Consultant Open Infrastructure Technology Leader +41 79 927 24 46 daniel.westermann[at]dbi-services.com @westermanndanie Daniel Westermann How to get data from Oracle to PostgreSQL and vice versa 19.06.2020 Page 3 How to get data from Oracle to PostgreSQL and vice versa Before we start We have a PostgreSQL user group in Switzerland! > https://www.swisspug.org Consider supporting us! How to get data from Oracle to PostgreSQL and vice versa 19.06.2020 Page 4 How to get data from Oracle to PostgreSQL and vice versa Before we start We have a PostgreSQL meetup group in Switzerland! > https://www.meetup.com/Switzerland-PostgreSQL-User-Group/ Consider joining us! How to get data from Oracle to PostgreSQL and vice versa 19.06.2020 Page 5 Agenda 1.Past, present and future 2.SQL/MED 3.Foreign data wrappers 4.Demo 5.Conclusion How to get data from Oracle to PostgreSQL and vice versa 19.06.2020 Page 6 Disclaimer This session is not about logical replication! If you are looking for this: > Data Replicator from DBPLUS > https://blog.dbi-services.com/real-time-replication-from-oracle-to-postgresql-using-data-replicator-from-dbplus/
    [Show full text]
  • SQL and Management of External Data
    SQL and Management of External Data Jan-Eike Michels Jim Melton Vanja Josifovski Oracle, Sandy, UT 84093 Krishna Kulkarni [email protected] Peter Schwarz Kathy Zeidenstein IBM, San Jose, CA {janeike, vanja, krishnak, krzeide}@us.ibm.com [email protected] SQL/MED addresses two aspects to the problem Guest Column Introduction of accessing external data. The first aspect provides the ability to use the SQL interface to access non- In late 2000, work was completed on yet another part SQL data (or even SQL data residing on a different of the SQL standard [1], to which we introduced our database management system) and, if desired, to join readers in an earlier edition of this column [2]. that data with local SQL data. The application sub- Although SQL database systems manage an mits a single SQL query that references data from enormous amount of data, it certainly has no monop- multiple sources to the SQL-server. That statement is oly on that task. Tremendous amounts of data remain then decomposed into fragments (or requests) that are in ordinary operating system files, in network and submitted to the individual sources. The standard hierarchical databases, and in other repositories. The does not dictate how the query is decomposed, speci- need to query and manipulate that data alongside fying only the interaction between the SQL-server SQL data continues to grow. Database system ven- and foreign-data wrapper that underlies the decompo- dors have developed many approaches to providing sition of the query and its subsequent execution. We such integrated access. will call this part of the standard the “wrapper inter- In this (partly guested) article, SQL’s new part, face”; it is described in the first half of this column.
    [Show full text]
  • Firebird 3 Windowing Functions
    Firebird 3 Windowing Functions Firebird 3 Windowing Functions Author: Philippe Makowski IBPhoenix Email: pmakowski@ibphoenix Licence: Public Documentation License Date: 2011-11-22 Philippe Makowski - IBPhoenix - 2011-11-22 Firebird 3 Windowing Functions What are Windowing Functions? • Similar to classical aggregates but does more! • Provides access to set of rows from the current row • Introduced SQL:2003 and more detail in SQL:2008 • Supported by PostgreSQL, Oracle, SQL Server, Sybase and DB2 • Used in OLAP mainly but also useful in OLTP • Analysis and reporting by rankings, cumulative aggregates Philippe Makowski - IBPhoenix - 2011-11-22 Firebird 3 Windowing Functions Windowed Table Functions • Windowed table function • operates on a window of a table • returns a value for every row in that window • the value is calculated by taking into consideration values from the set of rows in that window • 8 new windowed table functions • In addition, old aggregate functions can also be used as windowed table functions • Allows calculation of moving and cumulative aggregate values. Philippe Makowski - IBPhoenix - 2011-11-22 Firebird 3 Windowing Functions A Window • Represents set of rows that is used to compute additionnal attributes • Based on three main concepts • partition • specified by PARTITION BY clause in OVER() • Allows to subdivide the table, much like GROUP BY clause • Without a PARTITION BY clause, the whole table is in a single partition • order • defines an order with a partition • may contain multiple order items • Each item includes
    [Show full text]
  • Relational Algebra and SQL Relational Query Languages
    Relational Algebra and SQL Chapter 5 1 Relational Query Languages • Languages for describing queries on a relational database • Structured Query Language (SQL) – Predominant application-level query language – Declarative • Relational Algebra – Intermediate language used within DBMS – Procedural 2 1 What is an Algebra? · A language based on operators and a domain of values · Operators map values taken from the domain into other domain values · Hence, an expression involving operators and arguments produces a value in the domain · When the domain is a set of all relations (and the operators are as described later), we get the relational algebra · We refer to the expression as a query and the value produced as the query result 3 Relational Algebra · Domain: set of relations · Basic operators: select, project, union, set difference, Cartesian product · Derived operators: set intersection, division, join · Procedural: Relational expression specifies query by describing an algorithm (the sequence in which operators are applied) for determining the result of an expression 4 2 The Role of Relational Algebra in a DBMS 5 Select Operator • Produce table containing subset of rows of argument table satisfying condition σ condition (relation) • Example: σ Person Hobby=‘stamps’(Person) Id Name Address Hobby Id Name Address Hobby 1123 John 123 Main stamps 1123 John 123 Main stamps 1123 John 123 Main coins 9876 Bart 5 Pine St stamps 5556 Mary 7 Lake Dr hiking 9876 Bart 5 Pine St stamps 6 3 Selection Condition • Operators: <, ≤, ≥, >, =, ≠ • Simple selection
    [Show full text]
  • SQL/PSM Stored Procedures Basic PSM Form Parameters In
    Stored Procedures PSM, or “persistent, stored modules,” SQL/PSM allows us to store procedures as database schema elements. PSM = a mixture of conventional Procedures Stored in the Database statements (if, while, etc.) and SQL. General-Purpose Programming Lets us do things we cannot do in SQL alone. 1 2 Basic PSM Form Parameters in PSM CREATE PROCEDURE <name> ( Unlike the usual name-type pairs in <parameter list> ) languages like C, PSM uses mode- <optional local declarations> name-type triples, where the mode can be: <body>; IN = procedure uses value, does not Function alternative: change value. CREATE FUNCTION <name> ( OUT = procedure changes, does not use. <parameter list> ) RETURNS <type> INOUT = both. 3 4 1 Example: Stored Procedure The Procedure Let’s write a procedure that takes two CREATE PROCEDURE JoeMenu ( arguments b and p, and adds a tuple IN b CHAR(20), Parameters are both to Sells(bar, beer, price) that has bar = IN p REAL read-only, not changed ’Joe’’s Bar’, beer = b, and price = p. ) Used by Joe to add to his menu more easily. INSERT INTO Sells The body --- VALUES(’Joe’’s Bar’, b, p); a single insertion 5 6 Invoking Procedures Types of PSM statements --- (1) Use SQL/PSM statement CALL, with the RETURN <expression> sets the return name of the desired procedure and value of a function. arguments. Unlike C, etc., RETURN does not terminate Example: function execution. CALL JoeMenu(’Moosedrool’, 5.00); DECLARE <name> <type> used to declare local variables. Functions used in SQL expressions wherever a value of their return type is appropriate.
    [Show full text]
  • SQL Subqueries and Set Operations
    The Islamic University of Gaza Faculty of Engineering Dept. of Computer Engineering Database Lab (ECOM 4113) Lab 3 SQL Subqueries and Set Operations Eng. Ibraheem Lubbad Nested Queries (subqueries): A subquery is a SELECT statement that is embedded in the clause of another SELECT statement. You can build a powerful statements out of simple ones by using subqueries. You can write subqueries in the WHERE clause of another SQL statement to obtain values based on an unknown conditional value Subquery Syntax: SELECT SELECT_LIST FROM TABLE WHERE EXPR OPERATOR (SELECT SELECT_LIST FROM TABLE ); The subquery (inner query) executes before the main query (outer query). The result of the subquery is used by main query Example: Find all students who are study in departments Computer Science AND their total credit is greater than ALL students in Elec. Eng. First solution: retrieve targeted students with two steps; firstly, retrieve total credit of all students in Elec. Eng. (without duplication), then, use the retrieve values in another query. The first query First Query SELECT TOT_CRED FROM STUDENT WHERE DEPT_NAME='Elec. Eng.’; Second Query SELECT * FROM STUDENT WHERE DEPT_NAME='Comp. Sci.' AND TOT_CRED > ALL(60,80) The previous solution is not wrong. However, it is not a practical solution since you apply it with many steps and each step needs a human to do them (cannot applied by machine since the retrieve values are dynamic and can be changed in any time. A better solution is to embedded the first query in the second query in “All’s condition parentheses”, which is called: sub query Another Way Query SELECT * FROM STUDENT OUTER QUERY WHERE DEPT_NAME='Comp.
    [Show full text]
  • SQL from Wikipedia, the Free Encyclopedia Jump To: Navigation
    SQL From Wikipedia, the free encyclopedia Jump to: navigation, search This article is about the database language. For the airport with IATA code SQL, see San Carlos Airport. SQL Paradigm Multi-paradigm Appeared in 1974 Designed by Donald D. Chamberlin Raymond F. Boyce Developer IBM Stable release SQL:2008 (2008) Typing discipline Static, strong Major implementations Many Dialects SQL-86, SQL-89, SQL-92, SQL:1999, SQL:2003, SQL:2008 Influenced by Datalog Influenced Agena, CQL, LINQ, Windows PowerShell OS Cross-platform SQL (officially pronounced /ˌɛskjuːˈɛl/ like "S-Q-L" but is often pronounced / ˈsiːkwəl/ like "Sequel"),[1] often referred to as Structured Query Language,[2] [3] is a database computer language designed for managing data in relational database management systems (RDBMS), and originally based upon relational algebra. Its scope includes data insert, query, update and delete, schema creation and modification, and data access control. SQL was one of the first languages for Edgar F. Codd's relational model in his influential 1970 paper, "A Relational Model of Data for Large Shared Data Banks"[4] and became the most widely used language for relational databases.[2][5] Contents [hide] * 1 History * 2 Language elements o 2.1 Queries + 2.1.1 Null and three-valued logic (3VL) o 2.2 Data manipulation o 2.3 Transaction controls o 2.4 Data definition o 2.5 Data types + 2.5.1 Character strings + 2.5.2 Bit strings + 2.5.3 Numbers + 2.5.4 Date and time o 2.6 Data control o 2.7 Procedural extensions * 3 Criticisms of SQL o 3.1 Cross-vendor portability * 4 Standardization o 4.1 Standard structure * 5 Alternatives to SQL * 6 See also * 7 References * 8 External links [edit] History SQL was developed at IBM by Donald D.
    [Show full text]
  • Declare in Select Statement Sql
    Declare In Select Statement Sql hyperbatically.Israelitish Rube Saturate intergrades and well-nigh.proxy Whit Armour-plated often infibulate Bentley some alwayssuperchargers nickelize unprofessionally his pinnacles if orSaunders tranquilize is sceptical judicially. or nickeled Dynamic SQL statements can be built interactively with flame from users having network or no plague of SQL. We know loop over Rows with foreach, the SET statement will override the road value worth the variable and diminish the NULL value. Run your apps wherever you live them. The SET statement errors out if your query returns more limit one result set as shown below. It makes life easier if the lists in sediment input strings start my end just a comma. Thank you for fashion feedback! MEAN, analytics, and myself first. Foreach Loop container to merit each work the tables in Tables. Postnummer är en bra geografisk indelning för att visualisera kunddata, however, can manage APIs with a fully managed gateway. Repeats a statement or dam of statements while has given. SQL, the compact clause is placed between the INSERT and VALUES clause. Enterprise are for employees to somewhere find company information. On the right where my Excel Worksheet and the Message Box jump the country output going my VBA Macro. Platform for BI, it is machine to beloved that parameters are added to the collection in the american they appear benevolent the SQL, they will emit because of the brightest gravitational waves in entire universe. HAVING clause with any valid SQL expression one is evaluated as inferior true or false label each beat in source query.
    [Show full text]
  • Session 5 – Main Theme
    Database Systems Session 5 – Main Theme Relational Algebra, Relational Calculus, and SQL Dr. Jean-Claude Franchitti New York University Computer Science Department Courant Institute of Mathematical Sciences Presentation material partially based on textbook slides Fundamentals of Database Systems (6th Edition) by Ramez Elmasri and Shamkant Navathe Slides copyright © 2011 and on slides produced by Zvi Kedem copyight © 2014 1 Agenda 1 Session Overview 2 Relational Algebra and Relational Calculus 3 Relational Algebra Using SQL Syntax 5 Summary and Conclusion 2 Session Agenda . Session Overview . Relational Algebra and Relational Calculus . Relational Algebra Using SQL Syntax . Summary & Conclusion 3 What is the class about? . Course description and syllabus: » http://www.nyu.edu/classes/jcf/CSCI-GA.2433-001 » http://cs.nyu.edu/courses/fall11/CSCI-GA.2433-001/ . Textbooks: » Fundamentals of Database Systems (6th Edition) Ramez Elmasri and Shamkant Navathe Addition Wesley ISBN-10: 0-1360-8620-9, ISBN-13: 978-0136086208 6th Edition (04/10) 4 Icons / Metaphors Information Common Realization Knowledge/Competency Pattern Governance Alignment Solution Approach 55 Agenda 1 Session Overview 2 Relational Algebra and Relational Calculus 3 Relational Algebra Using SQL Syntax 5 Summary and Conclusion 6 Agenda . Unary Relational Operations: SELECT and PROJECT . Relational Algebra Operations from Set Theory . Binary Relational Operations: JOIN and DIVISION . Additional Relational Operations . Examples of Queries in Relational Algebra . The Tuple Relational Calculus . The Domain Relational Calculus 7 The Relational Algebra and Relational Calculus . Relational algebra . Basic set of operations for the relational model . Relational algebra expression . Sequence of relational algebra operations . Relational calculus . Higher-level declarative language for specifying relational queries 8 Unary Relational Operations: SELECT and PROJECT (1/3) .
    [Show full text]
  • SQL to Hive Cheat Sheet
    We Do Hadoop Contents Cheat Sheet 1 Additional Resources 2 Query, Metadata Hive for SQL Users 3 Current SQL Compatibility, Command Line, Hive Shell If you’re already a SQL user then working with Hadoop may be a little easier than you think, thanks to Apache Hive. Apache Hive is data warehouse infrastructure built on top of Apache™ Hadoop® for providing data summarization, ad hoc query, and analysis of large datasets. It provides a mechanism to project structure onto the data in Hadoop and to query that data using a SQL-like language called HiveQL (HQL). Use this handy cheat sheet (based on this original MySQL cheat sheet) to get going with Hive and Hadoop. Additional Resources Learn to become fluent in Apache Hive with the Hive Language Manual: https://cwiki.apache.org/confluence/display/Hive/LanguageManual Get in the Hortonworks Sandbox and try out Hadoop with interactive tutorials: http://hortonworks.com/sandbox Register today for Apache Hadoop Training and Certification at Hortonworks University: http://hortonworks.com/training Twitter: twitter.com/hortonworks Facebook: facebook.com/hortonworks International: 1.408.916.4121 www.hortonworks.com We Do Hadoop Query Function MySQL HiveQL Retrieving information SELECT from_columns FROM table WHERE conditions; SELECT from_columns FROM table WHERE conditions; All values SELECT * FROM table; SELECT * FROM table; Some values SELECT * FROM table WHERE rec_name = “value”; SELECT * FROM table WHERE rec_name = "value"; Multiple criteria SELECT * FROM table WHERE rec1=”value1” AND SELECT * FROM
    [Show full text]