Object-Oriented Query Languages: Object Query Language (OQL)
|
|
|
- Wilfred Stevenson
- 9 years ago
- Views:
Transcription
1 INF212 Database Theory Object-Oriented Query Languages: Object Query Language (OQL) Edited by N. Akkøk spring 2003 and spring 2005 from Pål Halvorsen s slides (spring 2002) Also contains slides made by Arthur M. Keller, Vera Goebel, Ragnar Normann
2 OQL Queries/sub-queries Return types Quantifiers Object creation Aggregation Using host languages Overview Operators on set or bag objects Grouping with properties Page 2
3 Motivation: Object Query Language (OQL) Relational languages suffer from impedance mismatch when we try to connect them to conventional languages like C or C++ The data models of C and SQL are radically different, e.g., C does not have relations, sets, or bags as primitive types OQL is the query language in the ODMG standard OQL is an attempt by the OO community to extend languages like C++ with SQL-like, relation-at-a-time dictions. Like SQL, OQL is a declarative (not procedural) language Page 3
4 OQL uses ODL OQL is designed to operate on data described in ODL: For every class we can declare an extent = name for the current set of objects of the class. Remember to refer to the extent, not the class name, in queries. Page 4
5 OQL: Object- and Value-Equality Two objects of the same type (instances of the same class) cannot be equal, but they may have the same values Example: Object O 1 and O 2 are instance of the of the same class The OQL expression O 1 = O 2 will always be FALSE The OQL expression *O 1 = *O 2 can be TRUE if the two objects have the same state, i.e., same value of all attributes Page 5
6 OQL: Computations Mutable objects are manipulated by executing defined methods for this class Select in OQL may have side effects, i.e., it can change the state in the database (OQL does not have an own update function in contrast to SQL) Methods are called by navigating along paths; there is no difference for addressing of attributes, relationships, or methods. Page 6
7 OQL: Types Basic types: string, integer, float, boolean, character, enumerations, etc. Type constructors: Struct for structures. Collection types: set, bag, list, array. (NOTE: dictionary is not suported) Set(Struct()) and Bag(Struct()) play special roles akin to relations. Page 7
8 OQL: Path Expressions We access components using dot-notations Let x be an object of class C: If a is an attribute of C, then x.a is the value of a in the x object. If r is a relationship of C, then x.r is the value to which x is connected by r, i.e., could be an object or a collection of objects, depending on the type of r If m is a method of C, then x.m( ) is the result of applying m to x. We can form expressions with several dots (only last element may be a collection) OQL allows arrows as a synonym for the dot, i.e, x a is equal to x.a, opposed to for example in C Page 8
9 OQL: The Bar-Beer-Sell (BBS) Example ODL class Bar (extent Bars) { attribute string name; attribute string addr; relationship Set<Sell> beerssold inverse Sell::bar; } class Beer (extent Beers) { attribute string name; attribute string manf; relationship Set<Sell> soldby inverse Sell::beer; } class Sell (extent Sells) { attribute float price; relationship Bar bar inverse Bar::beersSold; relationship Beer beer inverse Beer::soldBy; void raise_price(float price); } Page 9
10 OQL: Path Expressions for BBS Example Let s be a variable whose type is Sell s.price is the price in the object s (the beer sold in this bar) s.raise_price(x) raises the price of s.beer in s.bar with x s.bar is a pointer to the bar mentioned in s s.bar.addr is the address of the bar mentioned in s Note: cascade of dots OK because s.bar is an object, not a collection Let b be a variable whose type is Bar b.name is the name of the bar b.beerssold is a set of beers that this bar sells (set of pointers to Sell) Illegal use of path expressions: b.beerssold.price Note: illegal because b.beerssold is a set of objects, not a single object Typical Usage: If x is an object, you can extend the path expression, like s is extended with s.beer and s.beer.name above If x is a collection, like b.beerssold above, it can be used anywhere a collection is appropriate (e.g., FROM), if you want to access attributes of x. Page 10
11 OQL: Select-From-Where Similar to SQL syntax: SELECT <list of values> FROM <list of collections and typical members> WHERE <condition> Collections in FROM can be: 1. Extents 2. Expressions that evaluate to a collection Following a collection is a name for a typical member, optionally preceded by the keyword AS Note: there may be several different queries giving the same answer Page 11
12 OQL BBS Example: Select-From-Where Get menu at Joe s focusing on Sells objects: SELECT s.beer.name, s.price FROM Sells s WHERE s.bar.name = "Joe's" Notice double-quoted strings in OQL (SQL has single-quoted) Get Joe s menu, this time focusing on the Bar objects: SELECT s.beer.name, s.price FROM Bars b, b.beerssold s WHERE b.name = "Joe's" Notice that the typical object b in the first collection of FROM is used to help define the second collection. Page 12
13 OQL: Comparison Operators Values can generally be compared using operators: =!= < > <= >= : equality : different form : less than : greater than : less or equal : greater or equal Additional text comparison operators IN checks if a character is in a text string: <c> IN <text> LIKE checks if two texts are equal: <text 1 > LIKE <text 2 > <text 2 > may contain special characters: _ or? : one arbitrary character * or % : any arbitrary text string Page 13
14 OQL,BBS Example: Comparison Operators Example: find name and price of all bees at Joe s starting with B and consisting of the text string ud SELECT s.beer.name, s.price FROM Bars b, b.beerssold s WHERE b.name = "Joe's" AND s.beer.name LIKE "B*" AND s.beer.name LIKE "*ud*" AND NOTE 1: The name of the bar is equal to Joe s NOTE 2: The beer name starts with B followed by arbitrary characters NOTE 3: NOTE 3: The beer name contains ud starting with and followed by arbitrary characters Page 14
15 OQL: Quantifiers We can test whether all members, at least one member, some members, etc. satisfy some condition Boolean-valued expressions for use in WHERE-clauses. All: FOR ALL x IN <collection> : <condition> At least one: EXISTS x IN <collection> : <condition> EXISTS x Only one: UNIQUE x Some/any: <collection> <comparison> SOME/ANY <condition> where <comparison > = <, >, <=, >=, or = The expression has value TRUE if the condition is true NOT reverses the boolean value Page 15
16 OQL BBS Example: Quantifiers - I Example: Find all bars that sell some beer for more than $5 SELECT b.name FROM Bars b WHERE EXISTS s IN b.beerssold : s.price > 5.00 Example: How would you find the bars that only sold beers for more than $5? SELECT b.name FROM Bars b WHERE FOR ALL s IN b.beerssold : s.price > 5.00 Page 16
17 OQL BBS Example: Quantifiers - II Example: Find the bars such that the only beers they sell for more than $5 are manufactured by Pete s SELECT b.name FROM Bars b WHERE FOR ALL be IN ( SELECT s.beer be.manf = "Pete's" FROM b.beerssold s WHERE s.price > 5.00 ) : NOTE 2: NOTE 2: all these expensive beers must be manufactured by Pete s NOTE 1: find all beers in a bar where the price is more than $5 Page 17
18 OQL: Type of the Result Default: bag of structs, field names taken from the ends of path names in SELECT clause. Example: menu at Joe s : SELECT s.beer.name, s.price FROM Sells s WHERE s.bar.name = "Joe's" has result type: Bag(Struct(name: string, price: real)) Page 18
19 OQL: Rename Fields The result type Bag(Struct(name: string, price: real)) may not have appropriate names for the results attributes Rename by prefixing the path with the desired name and a colon Example: rename attributes of the menu at Joe s : SELECT beername: s.beer.name, s.price FROM Bars b, b.beerssold s WHERE b.name = "Joe's has type: Bag(Struct(beername: string, price: real)) Page 19
20 OQL: Change the Collection Type - I A bag of structs (default) returned by the SFW-statement is not always appropriate Use SELECT DISTINCT to get a set of structs Example: SELECT DISTINCT s.beer.name, s.price FROM Bars b, b.beerssold s WHERE b.name = "Joe's" Page 20
21 OQL: Change the Collection Type - II Use ORDER BY clause to get a list of structs Example: joemenu = SELECT s.beer.name, s.price FROM Bars b, b.beerssold s WHERE b.name = "Joe's" ORDER BY s.price ASC ASC = ascending (default); DESC = descending We can extract from a list as if it were an array, e.g., cheapest_beer = joemenu[0].name; Page 21
22 OQL: Subqueries Used where the result can be a collection type is appropriate, i.e., mainly in FROM clauses and with quantifiers like EXISTS, FOR ALL, etc. Example: subquery in FROM: Find the manufacturers of the beers served at Joe's SELECT DISTINCT b.manf FROM ( SELECT s.beer FROM Sells s WHERE s.bar.name = "Joe's" ) b Page 22
23 OQL: Assigning Values to Host Language Variables Unlike SQL, which needs to move data between tuples and variables, OQL fits naturally into a host language Select-From-Where produces collections of objects It is possible to assign any variable of proper type a value that is a result from OQL expressions Example (C++ like): Name of bars that only sold beers for more than $5 Set<string> expensive_bars; expensive_bars = SELECT DISTINCT b.name FROM Bars b WHERE FOR ALL s IN b.beerssold : s.price > 5.00 Page 23
24 OQL: Extraction of Collection Elements I A collection with a single member: Extract the member with ELEMENT. Example: Find the price Joe s charges for Bud and put the result in a variable p: p = ELEMENT( SELECT s.price FROM Sells s WHERE s.bar.name = "Joe's" AND s.beer.name = "Bud") Page 24
25 OQL: Extraction of Collection Elements II Extracting all elements of a collection, one at a time: 1. Turn the collection into a list. 2. Extract elements of a list with <list_name>[i] Example (C-like): Print Joe's menu, in order of price, with beers of the same price listed alphabetically L = SELECT s.beer.name, s.price FROM Sells s WHERE s.bar.name = "Joe's" ORDER BY s.price, s.beer.name; NOTE 1: make a list printf("beer\tprice\n\n"); NOTE 2: The i th element in L is obtained from L[i-1]. The index i starts at 0 for( i=0; i<=count(l); i++) printf("%s\t%f\n", L[i].name, L[i].price); Page 25
26 OQL: Creating New Objects A Select-From-Where statement allows us to create new objects whose type is defined in by the types returned in the SELECT statement Example SELECT beername: s.beer.name, s.price FROM Bars b, b.beerssold s NOTE: Defines a new object WHERE b.name = "Joe's Bar" Bag<Struct( beername: string, price: integer)> Constructor functions: create new instances of a class or other defined type (details depend on host language) Example: insert a new beer newbeer = Beer(name: "XXX", manufacturer: "YYY ) Effects: Create a new Beer object, which becomes part of the extent Beers The value of the host language variable newbeer is this object Page 26
27 OQL: Aggregation The five operators avg, sum, min, max, and count apply to any collection, as long as the operators make sense for the element type. Example: Find the average price of beer at Joe s. x = AVG( SELECT s.price FROM Sells s WHERE s.bar.name = "Joe's"); Note: result of SELECT is technically a bag of 1-field structs, which is identified with the bag of the values of that field. Page 27
28 OQL: Union, Intersection, and Difference We may apply union, intersection, and difference operators on any objects of Set or Bag type Use keywords UNION, INTERSECT, and EXCEPT, respectively Result type is a Bag if one object is of type Bag; Set otherwise Example: Find the name of all beers served at Joe s that are not served at Steve s ( SELECT s.beer.name FROM Sells s WHERE s.bar.name = "Joe's ) EXCEPT ( SELECT s.beer.name FROM Sells s WHERE s.bar.name = "Steve's ) NOTE 1: find all beers served at Joe s NOTE 2: find all beers served at Steve s NOTE 3: remove beers served at Steve s for beers served at Joe s Page 28
29 OQL: Grouping I OQL supports grouping similar to SQL - some differences Example in SQL: find average price of beers in all bars SELECT bar.name, AVG(price) FROM Sells GROUP BY bar; Is the bar value the name of the group, or the common value for the bar component of all tuples in the group? In SQL it doesn't matter, but in OQL, you can create groups from the values of any function(s), not just attributes. Thus, groups are identified by common values, not name. Example: group by first letter of bar names (method needed). Page 29
30 OQL: Grouping II General form: GROUP BY f 1 : e 1, f 2 : e 2,..., f n : e n Thus, made by the OQL clause: Keywords GROUP BY Comma separated list of partition attributes: name colon, and expression Example: SELECT... FROM... GROUP BY barname: s.bar.name Page 30
31 OQL: Grouping Outline Initial collection: defined by FROM, WHERE Intermediate collection: with function values and partition Output collection Group by values of function(s) Terms from SELECT clause NOTE 1: the selected objects (WHERE) from the collection of objects in FROM, but technically it is a Bag of structs NOTE 2: actual values returned from initial collection when applying GROUP BY expressions: Struct(f 1 :v 1,..., partition:p). First fields indicate the group, P is a bag of values belonging to this group NOTE 3: NOTE 3: The SELECT clause may select from intermediate collection, i.e., f 1,f 2,..,f n and partition values may only be referred through aggregate functions on the members of bag P. Page 31
32 OQL BBS Example: Grouping I Example: Find the average price of beer at each bar SELECT FROM GROUP BY barname, avgprice: AVG(SELECT p.s.price FROM partition p) Sells s barname: s.bar.name Page 32
33 OQL BBS Example: Grouping II SELECT barname, avgprice: AVG( SELECT p.s.price FROM partition p) FROM Sells s GROUP BY barname: s.bar.name 1. Initial collection: Sells But technically, it is a bag of structs of the form Struct(s: s1) where s1 is a Sell object. Note, the lone field is named s. In general, there are fields for all of the typical objects in the FROM clause. Page 33
34 OQL BBS Example: Grouping III SELECT barname, avgprice: AVG( FROM Sells s GROUP BY barname: s.bar.name SELECT p.s.price FROM partition p) 2. Intermediate collection One function: s.bar.name maps Sell objects s to the value of the name of the bar referred to by s Collection is a set of structs of type: Struct{barName:string, partition:set<struct{s:sell}>} For example: Struct(barName = "Joe's",partition = {s 1,,s n }) where s 1,,s n are all the structs with one field, named s, whose value is one of the Sell objects that represent Joe's Bar selling some beer. Page 34
35 OQL BBS Example: Grouping IV SELECT barname, avgprice: AVG( SELECT p.s.price FROM partition p) FROM Sells s GROUP BY barname: s.bar.name 3. Output collection: consists of beer-average price pairs, one for each struct in the intermediate collection Type of structures in the output: Struct{barName: string, avgprice: real} Note that the subquery in the SELECT clause variables in the partition is referred through the AVG aggregate function We let p range over all structs in partition. Each of these structs contains a single field named s and has a Sell object as its value. Thus, p.s.price extracts the price from one of the Sell objects belonging to this particular bar. Typical output struct - example: Struct(barName = "Joe's", avgprice = 2.83) Page 35
36 Another OQL BBS Example: Grouping I Example: Find, for each beer, the number of bars that charge a low price ( 2.00) and a high price ( 4.00) for that beer Strategy: group by three things: The beer name, a boolean function that is true if the price is low, and a boolean function that is true if the price is high. SELECT beername, low, high, count: COUNT(partition) FROM Beers b, b.soldby s GROUP BY beername: b.name, low: s.price <= 2.00, high: s.price >= 4.00 Page 36
37 SELECT FROM GROUP BY OQL: Another BBS Example: Grouping II bname, low, high, count: COUNT(partition) Beers b, b.soldby s bname: b.name, low: s.price <= 2.00, high: s.price >= Initial collection: Pairs (b, s), where b is a Beer object, and s is a Sell (b.soldby) object representing the sale of that beer at some bar Type of collection members: Struct{b: Beer, s: Sell} Page 37
38 OQL: Another BBS Example: Grouping III SELECT bname, low, high, count: COUNT(partition) FROM Beers b, b.soldby s GROUP BY bname: b.name, low: s.price <= 2.00, high: s.price >= Intermediate collection: Quadruples consisting of a beer name, booleans telling whether this group is for high prices, low prices, and the partition for that group The partition is a set of structs of the type: Struct{b: Beer, s: Sell} A typical partition value: Struct(b:"Bud" object,s:a Sell object involving Bud) Page 38
39 Another OQL BBS Example: Grouping IV 2. Intermediate collection (continued): Type of quadruples in the intermediate collection: Struct{ bname: string, low: boolean, high: boolean, partition: Set<Struct{b: Beer, s:sell}>} Typical structs in intermediate collection: bname low high partition Bud TRUE FALSE S low Bud FALSE TRUE S high Bud FALSE FALSE S mid NOTE 5: NOTE 5: the partition with low = high = TRUE must be empty and will not appear NOTE 1: S X are the sets of beer-sells pairs (b, s) NOTE 2: S low : price is low ( 2) NOTE 3: S high : price is high ( 4) NOTE 4: S mid : medium price (between 2 and 4) Page 39
40 Another OQL BBS Example: Grouping V SELECT bname, low, high, count: COUNT(partition) FROM Beers b, b.soldby s GROUP BY bname: b.name, low: s.price <= 2.00, high: s.price >= Output collection: The first three components of each group's struct are copied to the output The last (partition) is counted An example of the result: bname low high count Bud TRUE FALSE 27 Bud FALSE TRUE 14 Bud FALSE FALSE 36 Page 40
41 OQL: Having GROUP BY may be followed by HAVING to eliminate some of the groups created by GROUP BY The condition applies to the partition field in each structure in the intermediate collection If condition in HAVING clause is FALSE, the group does not contribute to the output collection Page 41
42 OQL BBS Example: Having Example: Find the average price of beers at each bar, but only in those bars where the most expensive beer cost more than 10$ SELECT FROM barname,avgprice: AVG(SELECT p.s.price FROM partition p) Sells s GROUP BY barname: s.bar.name HAVING MAX( SELECT p.s.price FROM partition p) > 10 NOTE 1: Same as above, finds average price of beers in a bar NOTE 2: Select only those groups where the maximum price is larger than 10 Page 42
43 OQL Summary Queries/subqueries Select-From-Where Return types bags, sets, or lists Quantifiers for all, exists, etc. Object creation both new elements and returned form queries Aggregation count, max, min, avg, sum Using host languages OQL fits naturally Operators on set or bag objects union, intersect, except Grouping with properties group by with having Page 43
Relational Database: Additional Operations on Relations; SQL
Relational Database: Additional Operations on Relations; SQL Greg Plaxton Theory in Programming Practice, Fall 2005 Department of Computer Science University of Texas at Austin Overview The course packet
Relational Algebra. Basic Operations Algebra of Bags
Relational Algebra Basic Operations Algebra of Bags 1 What is an Algebra Mathematical system consisting of: Operands --- variables or values from which new values can be constructed. Operators --- symbols
Real SQL Programming. Persistent Stored Modules (PSM) PL/SQL Embedded SQL
Real SQL Programming Persistent Stored Modules (PSM) PL/SQL Embedded SQL 1 SQL in Real Programs We have seen only how SQL is used at the generic query interface --- an environment where we sit at a terminal
Instant SQL Programming
Instant SQL Programming Joe Celko Wrox Press Ltd. INSTANT Table of Contents Introduction 1 What Can SQL Do for Me? 2 Who Should Use This Book? 2 How To Use This Book 3 What You Should Know 3 Conventions
Oracle SQL. Course Summary. Duration. Objectives
Oracle SQL Course Summary Identify the major structural components of the Oracle Database 11g Create reports of aggregated data Write SELECT statements that include queries Retrieve row and column data
Oracle Database: SQL and PL/SQL Fundamentals
Oracle University Contact Us: 1.800.529.0165 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This course is designed to deliver the fundamentals of SQL and PL/SQL along
COMP 5138 Relational Database Management Systems. Week 5 : Basic SQL. Today s Agenda. Overview. Basic SQL Queries. Joins Queries
COMP 5138 Relational Database Management Systems Week 5 : Basic COMP5138 "Relational Database Managment Systems" J. Davis 2006 5-1 Today s Agenda Overview Basic Queries Joins Queries Aggregate Functions
Oracle Database: SQL and PL/SQL Fundamentals NEW
Oracle University Contact Us: + 38516306373 Oracle Database: SQL and PL/SQL Fundamentals NEW Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training delivers the
Chapter 8. SQL-99: SchemaDefinition, Constraints, and Queries and Views
Chapter 8 SQL-99: SchemaDefinition, Constraints, and Queries and Views Data Definition, Constraints, and Schema Changes Used to CREATE, DROP, and ALTER the descriptions of the tables (relations) of a database
Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification
Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 Outline More Complex SQL Retrieval Queries
Chapter 5. SQL: Queries, Constraints, Triggers
Chapter 5 SQL: Queries, Constraints, Triggers 1 Overview: aspects of SQL DML: Data Management Language. Pose queries (Ch. 5) and insert, delete, modify rows (Ch. 3) DDL: Data Definition Language. Creation,
Oracle Database: SQL and PL/SQL Fundamentals
Oracle University Contact Us: +966 12 739 894 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training is designed to
Financial Data Access with SQL, Excel & VBA
Computational Finance and Risk Management Financial Data Access with SQL, Excel & VBA Guy Yollin Instructor, Applied Mathematics University of Washington Guy Yollin (Copyright 2012) Data Access with SQL,
Comp 5311 Database Management Systems. 3. Structured Query Language 1
Comp 5311 Database Management Systems 3. Structured Query Language 1 1 Aspects of SQL Most common Query Language used in all commercial systems Discussion is based on the SQL92 Standard. Commercial products
More on SQL. Juliana Freire. Some slides adapted from J. Ullman, L. Delcambre, R. Ramakrishnan, G. Lindstrom and Silberschatz, Korth and Sudarshan
More on SQL Some slides adapted from J. Ullman, L. Delcambre, R. Ramakrishnan, G. Lindstrom and Silberschatz, Korth and Sudarshan SELECT A1, A2,, Am FROM R1, R2,, Rn WHERE C1, C2,, Ck Interpreting a Query
3.GETTING STARTED WITH ORACLE8i
Oracle For Beginners Page : 1 3.GETTING STARTED WITH ORACLE8i Creating a table Datatypes Displaying table definition using DESCRIBE Inserting rows into a table Selecting rows from a table Editing SQL buffer
2874CD1EssentialSQL.qxd 6/25/01 3:06 PM Page 1 Essential SQL Copyright 2001 SYBEX, Inc., Alameda, CA www.sybex.com
Essential SQL 2 Essential SQL This bonus chapter is provided with Mastering Delphi 6. It is a basic introduction to SQL to accompany Chapter 14, Client/Server Programming. RDBMS packages are generally
Introduction to Microsoft Jet SQL
Introduction to Microsoft Jet SQL Microsoft Jet SQL is a relational database language based on the SQL 1989 standard of the American Standards Institute (ANSI). Microsoft Jet SQL contains two kinds of
SQL Basics. Introduction to Standard Query Language
SQL Basics Introduction to Standard Query Language SQL What Is It? Structured Query Language Common Language For Variety of Databases ANSI Standard BUT. Two Types of SQL DML Data Manipulation Language
Microsoft Access 3: Understanding and Creating Queries
Microsoft Access 3: Understanding and Creating Queries In Access Level 2, we learned how to perform basic data retrievals by using Search & Replace functions and Sort & Filter functions. For more complex
SQL. Short introduction
SQL Short introduction 1 Overview SQL, which stands for Structured Query Language, is used to communicate with a database. Through SQL one can create, manipulate, query and delete tables and contents.
Information Systems (Informationssysteme)
Information Systems (Informationssysteme) Jens Teubner, TU Dortmund jensteubner@cstu-dortmundde Summer 2015 c Jens Teubner Information Systems Summer 2015 1 Part III A Very Brief Introduction to SQL c
types, but key declarations and constraints Similar CREATE X commands for other schema ëdrop X name" deletes the created element of beer VARCHARè20è,
Dening a Database Schema CREATE TABLE name èlist of elementsè. Principal elements are attributes and their types, but key declarations and constraints also appear. Similar CREATE X commands for other schema
Object Oriented Databases. OOAD Fall 2012 Arjun Gopalakrishna Bhavya Udayashankar
Object Oriented Databases OOAD Fall 2012 Arjun Gopalakrishna Bhavya Udayashankar Executive Summary The presentation on Object Oriented Databases gives a basic introduction to the concepts governing OODBs
A Brief Introduction to MySQL
A Brief Introduction to MySQL by Derek Schuurman Introduction to Databases A database is a structured collection of logically related data. One common type of database is the relational database, a term
Database Query 1: SQL Basics
Database Query 1: SQL Basics CIS 3730 Designing and Managing Data J.G. Zheng Fall 2010 1 Overview Using Structured Query Language (SQL) to get the data you want from relational databases Learning basic
1. Write the query of Exercise 6.19 using TRC and DRC: Find the names of all brokers who have made money in all accounts assigned to them.
1. Write the query of Exercise 6.19 using TRC and DRC: Find the names of all brokers who have made money in all accounts assigned to them. TRC: DRC: {B.Name Broker(B) AND A Account (A.BrokerId = B.Id A.Gain
Complex Data and Object-Oriented. Databases
Complex Data and Object-Oriented Topics Databases The object-oriented database model (JDO) The object-relational model Implementation challenges Learning objectives Explain what an object-oriented data
David M. Kroenke and David J. Auer Database Processing: Fundamentals, Design and Implementation
David M. Kroenke and David J. Auer Database Processing: Fundamentals, Design and Implementation Chapter Two: Introduction to Structured Query Language 2-1 Chapter Objectives To understand the use of extracted
Databases 2011 The Relational Model and SQL
Databases 2011 Christian S. Jensen Computer Science, Aarhus University What is a Database? Main Entry: da ta base Pronunciation: \ˈdā-tə-ˌbās, ˈda- also ˈdä-\ Function: noun Date: circa 1962 : a usually
A Comparison of Database Query Languages: SQL, SPARQL, CQL, DMX
ISSN: 2393-8528 Contents lists available at www.ijicse.in International Journal of Innovative Computer Science & Engineering Volume 3 Issue 2; March-April-2016; Page No. 09-13 A Comparison of Database
IT2304: Database Systems 1 (DBS 1)
: Database Systems 1 (DBS 1) (Compulsory) 1. OUTLINE OF SYLLABUS Topic Minimum number of hours Introduction to DBMS 07 Relational Data Model 03 Data manipulation using Relational Algebra 06 Data manipulation
MICROSOFT ACCESS STEP BY STEP GUIDE
IGCSE ICT SECTION 11 DATA MANIPULATION MICROSOFT ACCESS STEP BY STEP GUIDE Mark Nicholls ICT Lounge P a g e 1 Contents Task 35 details Page 3 Opening a new Database. Page 4 Importing.csv file into the
Boats bid bname color 101 Interlake blue 102 Interlake red 103 Clipper green 104 Marine red. Figure 1: Instances of Sailors, Boats and Reserves
Tutorial 5: SQL By Chaofa Gao Tables used in this note: Sailors(sid: integer, sname: string, rating: integer, age: real); Boats(bid: integer, bname: string, color: string); Reserves(sid: integer, bid:
Relational Databases
Relational Databases Jan Chomicki University at Buffalo Jan Chomicki () Relational databases 1 / 18 Relational data model Domain domain: predefined set of atomic values: integers, strings,... every attribute
Real SQL Programming. Embedded SQL Call-Level Interface Java Database Connectivity
Real SQL Programming Embedded SQL Call-Level Interface Java Database Connectivity 1 SQL in Real Programs We have seen only how SQL is used at the generic query interface --- an environment where we sit
IT2305 Database Systems I (Compulsory)
Database Systems I (Compulsory) INTRODUCTION This is one of the 4 modules designed for Semester 2 of Bachelor of Information Technology Degree program. CREDITS: 04 LEARNING OUTCOMES On completion of this
Oracle Database 11g SQL
AO3 - Version: 2 19 June 2016 Oracle Database 11g SQL Oracle Database 11g SQL AO3 - Version: 2 3 days Course Description: This course provides the essential SQL skills that allow developers to write queries
Using AND in a Query: Step 1: Open Query Design
Using AND in a Query: Step 1: Open Query Design From the Database window, choose Query on the Objects bar. The list of saved queries is displayed, as shown in this figure. Click the Design button. The
Query-by-Example (QBE)
Query-by-Example (QBE) Module 3, Lecture 6 Example is the school of mankind, and they will learn at no other. -- Edmund Burke (1729-1797) Database Management Systems, R. Ramakrishnan 1 QBE: Intro A GUI
Chapter 6 The database Language SQL as a tutorial
Chapter 6 The database Language SQL as a tutorial About SQL SQL is a standard database language, adopted by many commercial systems. ANSI SQL, SQL-92 or SQL2, SQL99 or SQL3 extends SQL2 with objectrelational
Relational Algebra and SQL
Relational Algebra and SQL Johannes Gehrke [email protected] http://www.cs.cornell.edu/johannes Slides from Database Management Systems, 3 rd Edition, Ramakrishnan and Gehrke. Database Management
Data Stream Management and Complex Event Processing in Esper. INF5100, Autumn 2010 Jarle Søberg
Data Stream Management and Complex Event Processing in Esper INF5100, Autumn 2010 Jarle Søberg Outline Overview of Esper DSMS and CEP concepts in Esper Examples taken from the documentation A lot of possibilities
Database Applications Microsoft Access
Database Applications Microsoft Access Lesson 4 Working with Queries Difference Between Queries and Filters Filters are temporary Filters are placed on data in a single table Queries are saved as individual
SQL: Queries, Programming, Triggers
SQL: Queries, Programming, Triggers Chapter 5 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 R1 Example Instances We will use these instances of the Sailors and Reserves relations in
Example Instances. SQL: Queries, Programming, Triggers. Conceptual Evaluation Strategy. Basic SQL Query. A Note on Range Variables
SQL: Queries, Programming, Triggers Chapter 5 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Example Instances We will use these instances of the Sailors and Reserves relations in our
Database Design and Programming
Database Design and Programming Peter Schneider-Kamp DM 505, Spring 2012, 3 rd Quarter 1 Course Organisation Literature Database Systems: The Complete Book Evaluation Project and 1-day take-home exam,
Introduction to Python
Caltech/LEAD Summer 2012 Computer Science Lecture 2: July 10, 2012 Introduction to Python The Python shell Outline Python as a calculator Arithmetic expressions Operator precedence Variables and assignment
Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff
D80198GC10 Oracle Database 12c SQL and Fundamentals Summary Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff Level Professional Delivery Method Instructor-led
SQL - QUICK GUIDE. Allows users to access data in relational database management systems.
http://www.tutorialspoint.com/sql/sql-quick-guide.htm SQL - QUICK GUIDE Copyright tutorialspoint.com What is SQL? SQL is Structured Query Language, which is a computer language for storing, manipulating
Introduction to SQL for Data Scientists
Introduction to SQL for Data Scientists Ben O. Smith College of Business Administration University of Nebraska at Omaha Learning Objectives By the end of this document you will learn: 1. How to perform
SQL Server 2008 Core Skills. Gary Young 2011
SQL Server 2008 Core Skills Gary Young 2011 Confucius I hear and I forget I see and I remember I do and I understand Core Skills Syllabus Theory of relational databases SQL Server tools Getting help Data
PSU 2012. SQL: Introduction. SQL: Introduction. Relational Databases. Activity 1 Examining Tables and Diagrams
PSU 2012 SQL: Introduction SQL: Introduction The PowerSchool database contains data that you access through a web page interface. The interface is easy to use, but sometimes you need more flexibility.
Inquiry Formulas. student guide
Inquiry Formulas student guide NOTICE This documentation and the Axium software programs may only be used in accordance with the accompanying Ajera License Agreement. You may not use, copy, modify, or
Programming with SQL
Unit 43: Programming with SQL Learning Outcomes A candidate following a programme of learning leading to this unit will be able to: Create queries to retrieve information from relational databases using
Moving from CS 61A Scheme to CS 61B Java
Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you
Paper 70-27 An Introduction to SAS PROC SQL Timothy J Harrington, Venturi Partners Consulting, Waukegan, Illinois
Paper 70-27 An Introduction to SAS PROC SQL Timothy J Harrington, Venturi Partners Consulting, Waukegan, Illinois Abstract This paper introduces SAS users with at least a basic understanding of SAS data
The SQL Query Language. Creating Relations in SQL. Referential Integrity in SQL. Basic SQL Query. Primary and Candidate Keys in SQL
COS 597A: Principles of Database and Information Systems SQL: Overview and highlights The SQL Query Language Structured Query Language Developed by IBM (system R) in the 1970s Need for a standard since
Exercise 4 Learning Python language fundamentals
Exercise 4 Learning Python language fundamentals Work with numbers Python can be used as a powerful calculator. Practicing math calculations in Python will help you not only perform these tasks, but also
Oracle Database 12c: Introduction to SQL Ed 1.1
Oracle University Contact Us: 1.800.529.0165 Oracle Database 12c: Introduction to SQL Ed 1.1 Duration: 5 Days What you will learn This Oracle Database: Introduction to SQL training helps you write subqueries,
Oracle Database 10g: Introduction to SQL
Oracle University Contact Us: 1.800.529.0165 Oracle Database 10g: Introduction to SQL Duration: 5 Days What you will learn This course offers students an introduction to Oracle Database 10g database technology.
Lab 9 Access PreLab Copy the prelab folder, Lab09 PreLab9_Access_intro
Lab 9 Access PreLab Copy the prelab folder, Lab09 PreLab9_Access_intro, to your M: drive. To do the second part of the prelab, you will need to have available a database from that folder. Creating a new
Access 2010: Creating Queries Table of Contents INTRODUCTION TO QUERIES... 2 QUERY JOINS... 2 INNER JOINS... 3 OUTER JOINS...
Access 2010: Creating Queries Table of Contents INTRODUCTION TO QUERIES... 2 QUERY JOINS... 2 INNER JOINS... 3 OUTER JOINS... 3 CHANGE A JOIN PROPERTY... 4 REMOVING A JOIN... 4 CREATE QUERIES... 4 THE
T-SQL STANDARD ELEMENTS
T-SQL STANDARD ELEMENTS SLIDE Overview Types of commands and statement elements Basic SELECT statements Categories of T-SQL statements Data Manipulation Language (DML*) Statements for querying and modifying
Introduction to database design
Introduction to database design KBL chapter 5 (pages 127-187) Rasmus Pagh Some figures are borrowed from the ppt slides from the book used in the course, Database systems by Kiefer, Bernstein, Lewis Copyright
Using SQL Queries in Crystal Reports
PPENDIX Using SQL Queries in Crystal Reports In this appendix Review of SQL Commands PDF 924 n Introduction to SQL PDF 924 PDF 924 ppendix Using SQL Queries in Crystal Reports The SQL Commands feature
Oracle Database: SQL and PL/SQL Fundamentals NEW
Oracle University Contact Us: 001-855-844-3881 & 001-800-514-06-97 Oracle Database: SQL and PL/SQL Fundamentals NEW Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals
Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.
Handout 1 CS603 Object-Oriented Programming Fall 15 Page 1 of 11 Handout 1 Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Java
Information Systems SQL. Nikolaj Popov
Information Systems SQL Nikolaj Popov Research Institute for Symbolic Computation Johannes Kepler University of Linz, Austria [email protected] Outline SQL Table Creation Populating and Modifying
Database Administration with MySQL
Database Administration with MySQL Suitable For: Database administrators and system administrators who need to manage MySQL based services. Prerequisites: Practical knowledge of SQL Some knowledge of relational
UNIT 6. Structured Query Language (SQL) Text: Chapter 5
UNIT 6 Structured Query Language (SQL) Text: Chapter 5 Learning Goals Given a database (a set of tables ) you will be able to express a query in SQL, involving set operators, subqueries and aggregations
We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.
LING115 Lecture Note Session #4 Python (1) 1. Introduction As we have seen in previous sessions, we can use Linux shell commands to do simple text processing. We now know, for example, how to count words.
Query 4. Lesson Objectives 4. Review 5. Smart Query 5. Create a Smart Query 6. Create a Smart Query Definition from an Ad-hoc Query 9
TABLE OF CONTENTS Query 4 Lesson Objectives 4 Review 5 Smart Query 5 Create a Smart Query 6 Create a Smart Query Definition from an Ad-hoc Query 9 Query Functions and Features 13 Summarize Output Fields
SQL: Queries, Programming, Triggers
SQL: Queries, Programming, Triggers CSC343 Introduction to Databases - A. Vaisman 1 R1 Example Instances We will use these instances of the Sailors and Reserves relations in our examples. If the key for
Performing Queries Using PROC SQL (1)
SAS SQL Contents Performing queries using PROC SQL Performing advanced queries using PROC SQL Combining tables horizontally using PROC SQL Combining tables vertically using PROC SQL 2 Performing Queries
History of SQL. Relational Database Languages. Tuple relational calculus ALPHA (Codd, 1970s) QUEL (based on ALPHA) Datalog (rule-based, like PROLOG)
Relational Database Languages Tuple relational calculus ALPHA (Codd, 1970s) QUEL (based on ALPHA) Datalog (rule-based, like PROLOG) Domain relational calculus QBE (used in Access) History of SQL Standards:
Part A: Data Definition Language (DDL) Schema and Catalog CREAT TABLE. Referential Triggered Actions. CSC 742 Database Management Systems
CSC 74 Database Management Systems Topic #0: SQL Part A: Data Definition Language (DDL) Spring 00 CSC 74: DBMS by Dr. Peng Ning Spring 00 CSC 74: DBMS by Dr. Peng Ning Schema and Catalog Schema A collection
Transactions, Views, Indexes. Controlling Concurrent Behavior Virtual and Materialized Views Speeding Accesses to Data
Transactions, Views, Indexes Controlling Concurrent Behavior Virtual and Materialized Views Speeding Accesses to Data 1 Why Transactions? Database systems are normally being accessed by many users or processes
SQL Nested & Complex Queries. CS 377: Database Systems
SQL Nested & Complex Queries CS 377: Database Systems Recap: Basic SQL Retrieval Query A SQL query can consist of several clauses, but only SELECT and FROM are mandatory SELECT FROM
Introduction to SQL and SQL in R. LISA Short Courses Xinran Hu
Introduction to SQL and SQL in R LISA Short Courses Xinran Hu 1 Laboratory for Interdisciplinary Statistical Analysis LISA helps VT researchers benefit from the use of Statistics Collaboration: Visit our
Oracle Database: Introduction to SQL
Oracle University Contact Us: +381 11 2016811 Oracle Database: Introduction to SQL Duration: 5 Days What you will learn Understanding the basic concepts of relational databases ensure refined code by developers.
Introduction to Java Applications. 2005 Pearson Education, Inc. All rights reserved.
1 2 Introduction to Java Applications 2.2 First Program in Java: Printing a Line of Text 2 Application Executes when you use the java command to launch the Java Virtual Machine (JVM) Sample program Displays
This is a training module for Maximo Asset Management V7.1. It demonstrates how to use the E-Audit function.
This is a training module for Maximo Asset Management V7.1. It demonstrates how to use the E-Audit function. Page 1 of 14 This module covers these topics: - Enabling audit for a Maximo database table -
IS 312, Information Systems for Business Database Project in Access
IS 312, Information Systems for Business Database Project in Access Department of Accounting & Information Systems College of Business & Economics 2010-2015 by David W. Miller, Ph.D. This document created
SQL Tables, Keys, Views, Indexes
CS145 Lecture Notes #8 SQL Tables, Keys, Views, Indexes Creating & Dropping Tables Basic syntax: CREATE TABLE ( DROP TABLE ;,,..., ); Types available: INT or INTEGER REAL or FLOAT CHAR( ), VARCHAR( ) DATE,
Oracle Database: Introduction to SQL
Oracle University Contact Us: 1.800.529.0165 Oracle Database: Introduction to SQL Duration: 5 Days What you will learn View a newer version of this course This Oracle Database: Introduction to SQL training
Exercise 1: Python Language Basics
Exercise 1: Python Language Basics In this exercise we will cover the basic principles of the Python language. All languages have a standard set of functionality including the ability to comment code,
Entity-Relationship Model. Purpose of E/R Model. Entity Sets
Entity-Relationship Model Diagrams Class hierarchies Weak entity sets 1 Purpose of E/R Model The E/R model allows us to sketch the design of a database informally. Designs are pictures called entityrelationship
To increase performaces SQL has been extended in order to have some new operations avaiable. They are:
OLAP To increase performaces SQL has been extended in order to have some new operations avaiable. They are:. roll up: aggregates different events to reduce details used to describe them (looking at higher
How To Create A Table In Sql 2.5.2.2 (Ahem)
Database Systems Unit 5 Database Implementation: SQL Data Definition Language Learning Goals In this unit you will learn how to transfer a logical data model into a physical database, how to extend or
Ad Hoc Advanced Table of Contents
Ad Hoc Advanced Table of Contents Functions... 1 Adding a Function to the Adhoc Query:... 1 Constant... 2 Coalesce... 4 Concatenate... 6 Add/Subtract... 7 Logical Expressions... 8 Creating a Logical Expression:...
Visual Basic Programming. An Introduction
Visual Basic Programming An Introduction Why Visual Basic? Programming for the Windows User Interface is extremely complicated. Other Graphical User Interfaces (GUI) are no better. Visual Basic provides
Creating QBE Queries in Microsoft SQL Server
Creating QBE Queries in Microsoft SQL Server When you ask SQL Server or any other DBMS (including Access) a question about the data in a database, the question is called a query. A query is simply a question
Microsoft' Excel & Access Integration
Microsoft' Excel & Access Integration with Office 2007 Michael Alexander and Geoffrey Clark J1807 ; pwiueyb Wiley Publishing, Inc. Contents About the Authors Acknowledgments Introduction Part I: Basic
Oracle 10g PL/SQL Training
Oracle 10g PL/SQL Training Course Number: ORCL PS01 Length: 3 Day(s) Certification Exam This course will help you prepare for the following exams: 1Z0 042 1Z0 043 Course Overview PL/SQL is Oracle's Procedural
Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.
Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to
Unit 10: Microsoft Access Queries
Microsoft Access Queries Unit 10: Microsoft Access Queries Introduction Queries are a fundamental means of accessing and displaying data from tables. Queries used to view, update, and analyze data in different
5.1 Database Schema. 5.1.1 Schema Generation in SQL
5.1 Database Schema The database schema is the complete model of the structure of the application domain (here: relational schema): relations names of attributes domains of attributes keys additional constraints
