CS 5614: (Big) Data Management Systems. B. Aditya Prakash Lecture #2: The Rela0onal Model, and SQL/Rela0onal Algebra
|
|
- Bartholomew Atkinson
- 5 years ago
- Views:
Transcription
1 CS 5614: (Big) Data Management Systems B. Aditya Prakash Lecture #2: The Rela0onal Model, and SQL/Rela0onal Algebra
2 Data Model A Data Model is a nota0on for describing data or informa0on. Structure of data (e.g. arrays, structs) Conceptual model: In databases, structures are at a higher level. Opera@ons on data (Modifica0ons and Queries) Limited Opera0ons: Ease of programmers and efficiency of database. Constraints on data (what the data can be) Examples of data models The Rela0onal Model The Semistructured-Data Model XML and related standards Object-Rela0onal Model Prakash 2017 VT CS
3 The Model Student Course Grade Hermione Grainger Po0ons A Draco Malfoy Po0ons B Harry Pober Po0ons A Ron Weasley Po0ons C Structure: Table (like an array of structs) Opera@ons: Rela0onal alebgra (selec0on, projec0on, condi0ons, etc) Constraints: E.g., grades can be only {A, B, C, F} Prakash 2017 VT CS
4 The Semi-structured model <CoursesTaken> <Student>Hermione Grainger</Student> <Course>Potions</Course> <Grade>A</Grade> <Student>Draco Malfoy</Student> <Course>Potions</Course> <Grade>B</Grade>... </CoursesTaken> Structure: Trees or graphs, tags define role played by different pieces of data. Follow paths in the implied tree from one element to another. Constraints: E.g., can express limita0ons on data types Prakash 2017 VT CS
5 Comparing the two models Flexibility: XML can represent graphs Ease of use: SQL enables programmer to express wishes at high level. Prakash 2017 VT CS
6 The Model Simple: Built around a single concept for modeling data: the rela0on or table. A rela0onal database is a collec0on of rela0ons. Each rela0on is a table with rows and columns. Supports high-level programming language (SQL). Limited but very useful set of opera0ons Has an elegant mathema0cal design theory. Most current DBMS are rela0onal (Oracle, IBM DB2, MS SQL) Prakash 2017 VT CS
7 A rela0on is a two-dimensional table: Rela0on == table. Abribute == column name. Tuple == row (not the header row). Database == collec0on of rela0ons. A rela0on has two parts: Schema defines column heads of the table (abributes). Instance contains the data rows (tuples, rows, or records) of the table. Student Course Grade Hermione Grainger Po0ons A Draco Malfoy Po0ons B Harry Pober Po0ons A Ron Weasley Po0ons C Prakash 2017 VT CS
8 Schema CoursesTaken : Student Course Grade Hermione Grainger Po0ons A Draco Malfoy Po0ons B Harry Pober Po0ons A Ron Weasley Po0ons C The schema of a rela0on is the name of the rela0on followed by a parenthesized list of abributes. CoursesTaken(Student, Course, Grade) A design in a rela0onal model consists of a set of schemas. Such a set of schemas is called a rela0onal database schema. Prakash 2017 VT CS
9 Equivalent CoursesTaken : Student Course Grade Hermione Grainger Po0ons A Draco Malfoy Po0ons B Harry Pober Po0ons A Ron Weasley Po0ons C CoursesTaken(Student, Course, Grade) Rela0on is a set of tuples and not a list of tuples. Order in which we present the tuples does not maber. Very important! The abributes in a schema are also a set (not a list). Schema is the same irrespec0ve of order of abributes. CoursesTaken(Student, Grade, Course) We specify a standard order when we introduce a schema. How many equivalent representa0ons are there for a rela0on with m abributes and n tuples? m! n! Prakash 2017 VT CS
10 Degree and Cardinality CoursesTaken : Student Course Grade Hermione Grainger Po0ons A Draco Malfoy Po0ons B Harry Pober Po0ons A Ron Weasley Po0ons C Degree/Arity is the number of fields/abributes in schema (=3 in the table above) Cardinality is the number of tuples in rela0on (=4 in the table above) Prakash 2017 VT CS
11 Keys of Keys are one form of integrity constraints (IC) No pair of tuples should have iden0cal keys What is the key for CoursesTaken? Student if only one course in the rela0on Pair (Student, Course) if mul0ple courses What if student takes same course many 0mes? Student Course Grade Hermione Grainger Po0ons A Draco Malfoy Po0ons B Harry Pober Po0ons A Ron Weasley Po0ons C Prakash 2017 VT CS
12 Keys of Keys help associate tuples in different rela0ons SID CID Grade A B B... SID Student GPA 123 Hermione Grainger Draco Malfoy Harry Pober Ron Weasley 3.1 Prakash 2017 VT CS
13 Example Create a database for managing class enrollments in a single semester. You should keep track of all students (their names, Ids, and addresses) and professors (name, Id, department). Do not record the address of professors but keep track of their ages. Maintain records of courses also. Like what classroom is assigned to a course, what is the current enrollment, and which department offers it. At most one professor teaches each course. Each student evaluates the professor teaching the course. Note that all course offerings in the semester are unique, i.e. course names and numbers do not overlap. A course can have 0 pre-requisites, excluding itself. A student enrolled in a course must have enrolled in all its pre-requisites. Each student receives a grade in each course. The departments are also unique, and can have at most one chairperson (or dept. head). A chairperson is not allowed to head two or more departments. Prakash 2017 VT CS
14 Example Create a database for managing class enrollments in a single semester. You should keep track of all students (their names, Ids, and addresses) and professors (name, Id, department). Do not record the address of professors but keep track of their ages. Maintain records of courses also. Like what classroom is assigned to a course, what is the current enrollment, and which department offers it. At most one professor teaches each course. Each student evaluates the professor teaching the course. Note that all course offerings in the semester are unique, i.e. course names and numbers do not overlap. A course can have 0 pre-requisites, excluding itself. A student enrolled in a course must have enrolled in all its pre-requisites. Each student receives a grade in each course. The departments are also unique, and can have at most one chairperson (or dept. head). A chairperson is not allowed to head two or more departments. Prakash 2017 VT CS
15 Design for the Example Students (PID: string, Name: string, Address: string) Professors (PID: string, Name: string, Office: string, Age: integer, DepartmentName: string) Courses (Number: integer, DeptName: string, CourseName: string, Classroom: string, Enrollment: integer) Teach (ProfessorPID: string, Number: integer, DeptName: string) Take (StudentPID: string, Number: integer, DeptName: string, Grade: string, ProfessorEvalua0on: integer) Departments (Name: string, ChairmanPID: string) PreReq (Number: integer, DeptName: string, PreReqNumber: integer, PreReqDeptName: string) Prakash 2017 VT CS
16 Design Example: Keys? Students (PID: string, Name: string, Address: string) Professors (PID: string, Name: string, Office: string, Age: integer, DepartmentName: string) Courses (Number: integer, DeptName: string, CourseName: string, Classroom: string, Enrollment: integer) Teach (ProfessorPID: string, Number: integer, DeptName: string) Take (StudentPID: string, Number: integer, DeptName: string, Grade: string, ProfessorEvalua0on: integer) Departments (Name: string, ChairmanPID: string) PreReq (Number: integer, DeptName: string, PreReqNumber: integer, PreReqDeptName: string) Prakash 2017 VT CS
17 Design: Keys? Students (PID: string, Name: string, Address: string) Professors (PID: string, Name: string, Office: string, Age: integer, DepartmentName: string) Courses (Number: integer, DeptName: string, CourseName: string, Classroom: string, Enrollment: integer) Teach (ProfessorPID: string, Number: integer, DeptName: string) Take (StudentPID: string, Number: integer, DeptName: string, Grade: string, ProfessorEvalua0on: integer) Departments (Name: string, ChairmanPID: string) PreReq (Number: integer, DeptName: string, PreReqNumber: integer, PreReqDeptName: string) Prakash 2017 VT CS
18 Issues to Consider in the Design Can we merge Courses and Teach since each professor teaches at most one course? Do we need a separate rela0on to store evalua0ons? How can we handle pre-requisites that are or s, e.g., you can take CS 4604 if you have taken either CS 3114 or CS 2606? How do we generalize this schema to handle data over more than one semester? What modifica0ons does the schema need if more than one professor can teach a course? Prakash 2017 VT CS
19 SQL AND RELATIONAL ALGEBRA Prakash 2017 VT CS
20 Algebra Rela0onal algebra is a nota0on for specifying queries about the contents of rela0ons Nota0on of rela0onal algebra eases the task of reasoning about queries Opera0ons in rela0onal algebra have counterparts in SQL Prakash 2017 VT CS
21 What is SQL SQL = Structured Query Language (pronounced sequel ). Language for defining as well as querying data in an RDBMS. Primary mechanism for querying and modifying the data in an RDBMS. SQL is declara0ve: Say what you want to accomplish, without specifying how. One of the main reasons for the commercial success of RDMBSs. SQL has many standards and implementa0ons: ANSI SQL SQL-92/SQL2 (null opera0ons, outerjoins) SQL-99/SQL3 (recursion, triggers, objects) Vendor-specific varia0ons. Prakash 2017 VT CS
22 What is an Algebra? An algebra is a set of operators and operands Arithme0c: operands are variables and constants, operators are +,,,, /, etc. Set algebra: operands are sets and operators are, U, - An algebra allows us to construct expressions by combining operands and expression using operators has rules for reasoning about expressions a² + 2 a b + 2b, (a + b)² R (R S), R S Prakash 2017 VT CS
23 selec0on projec0on FUNDAMENTAL operators σ condition π att list cartesian product R X S set union R U S set difference R - S (R) (R) Prakash 2017 VT CS 5614 #23
24 The projec0on operator produces from a rela0on R a new rela0on containing only some of R s columns Delete (i.e. not show) abributes not in projec0on list Duplicates eliminated (sets vs mul:sets) To obtain a rela0on containing only the columns A1,A2,... An of R RA: π A1,A2,... An (R) SQL: SELECT DISTINCT A1,A2,... An FROM R; Prakash 2017 VT CS
25 Example S2 sid sname rating age 28 yuppy lubber guppy rusty (S2) π sname,rating π age ( S2) sname rating age yuppy 9 lubber 8 guppy 5 rusty Prakash 2017 VT CS
26 The selec0on operator applied to a rela0on R produces a new rela0on with a subset of R s tuples The tuples in the resul0ng rela0on sa0sfy some condi0on C that involves the abributes of R with duplicate removal RA: σ (R) SQL: SELECT *FROM R WHERE C; The WHERE clause of a SQL command corresponds to σ( ) c Prakash 2017 VT CS
27 Syntax of Syntax of condi0onal (C): similar to condi0onals in programming languages. Values compared are constants and abributes of the rela0ons men0oned in the FROM clause. We may apply usual arithme0c operators to numeric values before comparing them. RA Compare values using standard arithme0c operators. SQL Compare values using =, <>, <, >, <=, >=. Prakash 2017 VT CS
28 Example S2 sid sname rating age 28 yuppy lubber guppy rusty σ S rating >8 ( 2) sid sname rating age 28 yuppy rusty π σ ( ( S )) sname, rating rating>8 2 Combining Operators sname rating yuppy 9 rusty 10 Prakash 2017 VT CS
29 Set Union Standard defini0on: The union of two rela0ons R and S is the set of tuples that are in R, or S or in both. When is it valid? R and S must have iden0cal sets of abributes and the types of the abributes must be the same. The abributes of R and S must occur in the same order. Prakash 2017 VT CS
30 Set Union RA R U S SQL (SELECT * FROM R) UNION (SELECT * FROM S); Prakash 2017 VT CS
31 Set The intersec0on of R and S is the set of tuples in both R and S Same condi0ons hold on R and S as for the union operator RA R S SQL (SELECT * FROM R) INTERSECT (SELECT * FROM S); Prakash 2017 VT CS
32 Set Difference Set of tuples in R but NOT in S Same condi0ons on R and S as union RA R S SQL (SELECT * FROM R) EXCEPT (SELECT * FROM S); R (R S) = R S Prakash 2017 VT CS
33 Difference S1 sid sname rating age 22 dustin lubber rusty S2 sid sname rating age 28 yuppy lubber guppy rusty S1 S2 sid sname rating age 22 dustin Prakash 2017 VT CS
34 What about strings? find student ssns who live on main (st or str or street - ie., main st or main str ) Prakash 2017 VT CS
35 What about strings? find student ssns who live on main (st or str or street) select ssn from student where address like main% %: variable-length don t care _: single-character don t care Prakash 2017 VT CS
36 operators Are we done yet? Q: Give a query we can not answer yet! Prakash 2017 VT CS 5614 #36
37 operators A: any query across two or more tables, eg., find names of students in 4604 Q: what extra operator do we need?? STUDENT Ssn Name Address 123 smith main str 234 jones forbes ave SSN c-id grade A B Prakash 2017 VT CS 5614 #37
38 operators A: any query across two or more tables, eg., find names of students in 4604 Q: what extra operator do we need?? A: surprisingly, cartesian product is enough! STUDENT Ssn Name Address 123 smith main str 234 jones forbes ave SSN c-id grade A B Prakash 2017 VT CS 5614 #38
39 Cartesian Product The Cartesian product (or cross-product or product) of two rela0ons R and S is a the set of pairs that can be formed by pairing each tuple of R with each tuple of S. The result is a rela0on whose schema is the schema for R followed by the schema for S. RA: R X S SQL: SELECT * FROM R, S ; Prakash 2017 VT CS
40 Cartesian Product S1 sid sname rating age 22 dustin lubber rusty sid bid R1 day /10/ /12/96 S1 X R1 (sid) sname rating age (sid) bid day? 22 dustin /10/96 22 dustin /12/96 31 lubber /10/96 31 lubber /12/96 58 rusty /10/96 58 rusty /12/96 We rename abributes to avoid ambiguity or we prefix abribute with the name of the rela0on it belongs to. Prakash 2017 VT CS
41 selec0on projec0on REMINDER: FUNDAMENTAL operators σ condition π att list cartesian product R X S set union R U S set difference R - S (R) (R) Prakash 2017 VT CS 5614 #41
42 ops Surprisingly, they are enough, to help us answer almost any query we want! derived/convenience operators: set intersec0on ---(We have seen this) join (theta join, equi-join, natural join) rename operator division R S ρ ( R) R' Prakash 2017 VT CS 5614 #42
43 Theta-Join The theta-join of two rela0ons R and S is the set of tuples in the Cartesian product of R and S that sa0sfy some condi0on C. RA: R S SQL: SELECT * FROM R, S WHERE C; R S = σ (R x S) C Prakash 2017 VT CS
44 Theta-Join S1 sid sname rating age 22 dustin lubber rusty R1 sid bid day /10/ /12/96 S1 S1.sid<R1.sid R1 (sid) sname rating age (sid) bid day 22 dustin /12/96 31 lubber /12/96 R c S = σ c ( R S) Prakash 2017 VT CS
45 Natural Join The natural join of two rela0ons R and S is a set of pairs of tuples, one from R and one from S, that agree on whatever abributes are common to the schemas of R and S. The schema for the result contains the union of the abributes of R and S. (so duplicate cols. are dropped) Assume the schemas R(A,B, C) and S(B, C,D)./ RA: R S SQL: SELECT R.A, R.B, R.C, S.D FROM R, S WHERE R.B = S.B AND R.C = S.C; Prakash 2017 VT CS
46 Natural Join: Nit-picking What if R and S have not abributes in common? natural join à cartesian product Some (like Oracle) provide a special single NATURAL JOIN operator, but some (like IBM DB2) don t. So assume there is no special SQL natural join operator Prakash 2017 VT CS
47 Operators so far Remove parts of single Projec0on: Selec0on: Combining Projec0on and Selec0on: (A,B) (R) and SELECT A, B FROM R C(R) and SELECT * FROM R WHERE C (A,B) ( C (R)) SELECT A, B FROM R WHERE C Prakash 2017 VT CS
48 so far Set R and S must have the same abributes, same abribute types, and same order of abributes Union: R U S and (R) UNION (S) Intersec0on: R S and (R) INTERSECT (S) Difference: R S and (R) EXCEPT (S) Prakash 2017 VT CS
49 so far Combine the tuples of two Cartesian Product: R X S,. FROM R, S.. Theta Join: R S,. FROM R, S WHERE C./ Natural Join: R S Prakash 2017 VT CS
50 Ordering find student records, sorted in name order select * from student order by name asc asc is the default Prakash 2017 VT CS
51 Ordering find student records, sorted in name order; break 0es by reverse ssn select * from student order by name, ssn desc Prakash 2017 VT CS
52 Q: why? Rename op. ρ AFTER (BEFORE) A: shorthand; self-joins; for example, find the grand-parents of Tom, given PC (parent-id, child-id) Prakash 2017 VT CS 5614 #52
53 Rename op. PC (parent-id, child-id) PC PC PC p-id Mary Peter John c-id Tom Mary Tom PC p-id Mary Peter John c-id Tom Mary Tom Prakash 2017 VT CS 5614 #53
54 Rename op. first, WRONG abempt: PC PC (why? how many columns?) Second WRONG abempt: PC PC. c id= PC. p id PC Prakash 2017 VT CS 5614 #54
55 Rename op. we clearly need two different names for the same table - hence, the rename op. ρ PC ( PC) 1 PC1. c id= PC. p id PC Prakash 2017 VT CS 5614 #55
56 and Renaming RA: give R the name S; R has n abributes, which are ρ (R) S (A1,A2,... An) called A1, A2,..., An in S SQL: Use the AS keyword in the FROM clause: Students AS Students1 renames Students to Students1. SQL: Use the AS keyword in the SELECT clause to rename abributes. Prakash 2017 VT CS
57 and Renaming Name pairs of students who live at the same address: Students (Name, Address) RA: S1.Name,S2.Name ( S1.Address=S2.Address ( S1 (Students) S2 (Students))) SQL: SELECT S1.name, S2.name FROM Students AS S1, Students AS S2 WHERE S1.address = S2.address Prakash 2017 VT CS
58 and Renaming Name pairs of students who live at the same address: SQL: SELECT S1.name, S2.name FROM Students AS S1, Students AS S2 WHERE S1.address = S2.address Are these correct? No!!! the result includes tuples where a student is paired with himself/herself Solu0on: Add the condi0on S1.name <> S2.name. Prakash 2017 VT CS
59 Division Rarely used, but powerful. Example: find suspicious suppliers, ie., suppliers that supplied all the parts in A_BOMB Prakash 2017 VT CS 5614 #59
60 Division SHIPMENT s# p# s1 p1 s2 p1 s1 p2 s3 p1 s5 p3 ABOMB p# p1 p2 = BAD_S s# s1 Prakash 2017 VT CS 5614 #60
61 Division Observa0ons: ~reverse of cartesian product It can be derived from the 5 fundamental operators (!!) How? Prakash 2017 VT CS 5614 #61
62 Division Answer: r s = π ( R S )( r) π ( R S )[( π ( R S )( r) s) r] Observa0on: find good suppliers, and subtract! (double nega@on) Prakash 2017 VT CS 5614 #62
63 Division Answer: r SHIPMENT s# p# s1 p1 s2 p1 s1 p2 s3 p1 s5 p3 s ABOMB p# p1 p2 = BAD_S s# s1 r s = π ( R S )( r) π ( R S )[( π ( R S )( r) s) r] R: a=ributes of r S: a=ributes of s Observa0on: find good suppliers, and subtract! (double nega@on) Prakash 2017 VT CS 5614 #63
64 Division Answer: r SHIPMENT s# p# s1 p1 s2 p1 s1 p2 s3 p1 s5 p3 s ABOMB p# p1 p2 = BAD_S s# s1 r s = π ( R S )( r) π ( R S )[( π ( R S )( r) s) r] All suppliers All bad parts Prakash 2017 VT CS 5614 #64
65 Division Answer: SHIPMENT s# p# s1 p1 s2 p1 s1 p2 s3 p1 s5 p3 ABOMB p# p1 p2 = BAD_S s# s1 r s = π ( R S )( r) π ( R S )[( π ( R S )( r) s) r] all possible suspicious shipments Prakash 2017 VT CS 5614 #65
66 Division Answer: SHIPMENT s# p# s1 p1 s2 p1 s1 p2 s3 p1 s5 p3 ABOMB p# p1 p2 = BAD_S s# s1 r s = π ( R S )( r) π ( R S )[( π ( R S )( r) s) r] all possible suspicious shipments that didn t happen Prakash 2017 VT CS 5614 #66
67 Division Answer: SHIPMENT s# p# s1 p1 s2 p1 s1 p2 s3 p1 s5 p3 ABOMB p# p1 p2 = BAD_S s# s1 r s = π ( R S )( r) π ( R S )[( π ( R S )( r) s) r] all suppliers who missed at least one suspicious shipment, i.e.: good suppliers Prakash 2017 VT CS 5614 #67
68 Quick Quiz: Independence of Operators R \ S = R (R S) R./ C = C (R S) R./ S =?? Prakash 2017 VT CS
69 Quick Quiz: Independence of R./ S Operators Suppose R and S share the abributes A1,A2,..An Let L be the list of abributes in R \Union list of abributes in S (so no duplicate abributes) Let C be the condi0on R.A1 = S.A1 AND R.A2 = S.A2 AND.. R.An = S.An R./ S = L ( C (R S)) Prakash 2017 VT CS
70 Linear for Algebra Rela0onal algebra expressions can become very long. Use linear nota0on to store results of intermediate expressions. A rela0on name and a parenthesized list of abributes for that rela0on Use Answer as the conven0onal name for the final result The assignment symbol := Any expression in rela0onal algebra on the right Prakash 2017 VT CS
71 Example of Linear Name pairs of students who live at the same address. Normal expression: S1.Name,S2.Name ( S1.Address=S2.Address ( S1 (Students) S2 (Students))) Prakash 2017 VT CS
72 Example of Linear Normal expression: S1.Name,S2.Name ( S1.Address=S2.Address ( S1 (Students) S2 (Students))) Linear Nota0on: Pairs(P1, N1, A1, P2, N2, A2) := S1 (Students) S2 (Students) Matched(P1, N1, A1, P2, N2, A2) := A1=A2(Pairs(P1, N1, A1, P2, N2, A2)) Answer(Name1, Name2) := N1,N2 (Matched(P1, N1, A1, P2, N2, A2)) Prakash 2017 VT CS
73 Queries Involving SELECT A, B FROM R, S WHERE C; Nested loops: for each tuple t1 in R for each tuple t2 in S if the abributes in t1 and t2 sa0sfy C output the tuples involving abributes A and B Prakash 2017 VT CS
74 Queries Involving SELECT A, B FROM R, S WHERE C; Conversion to rela0onal algebra: A,B ( C (R S)) Compute R X S Apply selec0on operator σ() to R X S Project the result tuples to abributes A and B Prakash 2017 VT CS
CS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #3: SQL and Rela2onal Algebra- - - Part 1
CS 4604: Introduc0on to Database Management Systems B. Aditya Prakash Lecture #3: SQL and Rela2onal Algebra- - - Part 1 Reminder: Rela0onal Algebra Rela2onal algebra is a nota2on for specifying queries
More informationCS 4604: Introduction to Database Management Systems. B. Aditya Prakash Lecture #2: The Relational Model and Relational Algebra
CS 4604: Introduction to Database Management Systems B. Aditya Prakash Lecture #2: The Relational Model and Relational Algebra Course Outline Weeks 1 4: Query/ Manipulation Languages and Data Modeling
More informationThe Relational Model
The Relational Model T. M. Murali August 26, 2009 Course Outline Weeks 1 5, 13: Query/Manipulation Languages The relational model Relational Algebra SQL Data definition Programming with SQL Weeks 6 8:
More informationFaloutsos - Pavlo CMU SCS /615
Faloutsos - Pavlo 15-415/615 Carnegie Mellon Univ. School of Computer Science 15-415/615 - DB Applications C. Faloutsos & A. Pavlo Lecture #4: Relational Algebra Overview history concepts Formal query
More informationOverview. Carnegie Mellon Univ. School of Computer Science /615 - DB Applications. Concepts - reminder. History
Faloutsos - Pavlo 15-415/615 Carnegie Mellon Univ. School of Computer Science 15-415/615 - DB Applications C. Faloutsos & A. Pavlo Lecture #4: Relational Algebra Overview history concepts Formal query
More informationCS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #4: SQL---Part 2
CS 4604: Introduc0on to Database Management Systems B. Aditya Prakash Lecture #4: SQL---Part 2 Overview - detailed - SQL DML other parts: views modifications joins DDL constraints Prakash 2016 VT CS 4604
More informationCS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #4: Subqueries in SQL
CS 4604: Introduc0on to Database Management Systems B. Aditya Prakash Lecture #4: Subqueries in SQL Announcements Project assignment 1 due today Homework 1 released today due next Friday 2/8 SQL and RelaEonal
More informationSQL Subqueries. T. M. Murali. September 2, T. M. Murali September 2, 2009 CS 4604: SQL Subqueries
SQL Subqueries T. M. Murali September 2, 2009 Linear Notation for Relational Algebra Relational algebra expressions can become very long. Use linear notation to store results of intemediate expressions.
More informationRela+onal Algebra. Rela+onal Query Languages. CISC437/637, Lecture #6 Ben Cartere?e
Rela+onal Algebra CISC437/637, Lecture #6 Ben Cartere?e Copyright Ben Cartere?e 1 Rela+onal Query Languages A query language allows manipula+on and retrieval of data from a database The rela+onal model
More informationRelational Algebra. [R&G] Chapter 4, Part A CS4320 1
Relational Algebra [R&G] Chapter 4, Part A CS4320 1 Relational Query Languages Query languages: Allow manipulation and retrieval of data from a database. Relational model supports simple, powerful QLs:
More informationDatabase Management Systems. Chapter 4. Relational Algebra. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1
Database Management Systems Chapter 4 Relational Algebra Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Formal Relational Query Languages Two mathematical Query Languages form the basis
More informationRelational Algebra. Note: Slides are posted on the class website, protected by a password written on the board
Note: Slides are posted on the class website, protected by a password written on the board Reading: see class home page www.cs.umb.edu/cs630. Relational Algebra CS430/630 Lecture 2 Slides based on Database
More informationDatabase Management System. Relational Algebra and operations
Database Management System Relational Algebra and operations Basic operations: Selection ( ) Selects a subset of rows from relation. Projection ( ) Deletes unwanted columns from relation. Cross-product
More informationMIS Database Systems Relational Algebra
MIS 335 - Database Systems Relational Algebra http://www.mis.boun.edu.tr/durahim/ Ahmet Onur Durahim Learning Objectives Basics of Query Languages Relational Algebra Selection Projection Union, Intersection,
More informationCAS CS 460/660 Introduction to Database Systems. Relational Algebra 1.1
CAS CS 460/660 Introduction to Database Systems Relational Algebra 1.1 Relational Query Languages Query languages: Allow manipulation and retrieval of data from a database. Relational model supports simple,
More informationOverview of DB & IR. ICS 624 Spring Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa
ICS 624 Spring 2011 Overview of DB & IR Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 1/12/2011 Lipyeow Lim -- University of Hawaii at Manoa 1 Example
More informationRelational Algebra Homework 0 Due Tonight, 5pm! R & G, Chapter 4 Room Swap for Tuesday Discussion Section Homework 1 will be posted Tomorrow
Relational Algebra R & G, Chapter 4 By relieving the brain of all unnecessary work, a good notation sets it free to concentrate on more advanced problems, and, in effect, increases the mental power of
More informationCIS 330: Applied Database Systems. ER to Relational Relational Algebra
CIS 330: Applied Database Systems ER to Relational Relational Algebra 1 Logical DB Design: ER to Relational Entity sets to tables: ssn name Employees lot CREATE TABLE Employees (ssn CHAR(11), name CHAR(20),
More informationRelational Algebra. Relational Query Languages
Relational Algebra π CS 186 Fall 2002, Lecture 7 R & G, Chapter 4 By relieving the brain of all unnecessary work, a good notation sets it free to concentrate on more advanced problems, and, in effect,
More informationRelational Algebra 1
Relational Algebra 1 Relational Algebra Last time: started on Relational Algebra What your SQL queries are translated to for evaluation A formal query language based on operators Rel Rel Op Rel Op Rel
More informationIntroduction to Data Management. Lecture #11 (Relational Algebra)
Introduction to Data Management Lecture #11 (Relational Algebra) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v HW and exams:
More informationDatabase Applications (15-415)
Database Applications (15-415) SQL-Part I Lecture 7, January 31, 2016 Mohammad Hammoud Today Last Session: Relational Calculus & Summary Today s Session: Standard Query Language (SQL)- Part I Announcements:
More informationLecture 16. The Relational Model
Lecture 16 The Relational Model Lecture 16 Today s Lecture 1. The Relational Model & Relational Algebra 2. Relational Algebra Pt. II [Optional: may skip] 2 Lecture 16 > Section 1 1. The Relational Model
More informationRelational Algebra. Chapter 4, Part A. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1
Relational Algebra Chapter 4, Part A Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Relational Query Languages Query languages: Allow manipulation and retrieval of data from a database.
More informationWhy Study the Relational Model? The Relational Model. Relational Database: Definitions. The SQL Query Language. Relational Query Languages
Why Study the Relational Model? The Relational Model Most widely used model. Vendors: IBM, Informix, Microsoft, Oracle, Sybase, etc. Legacy systems in older models E.G., IBM s IMS Recent competitor: object-oriented
More informationToday s topics. Null Values. Nulls and Views in SQL. Standard Boolean 2-valued logic 9/5/17. 2-valued logic does not work for nulls
Today s topics CompSci 516 Data Intensive Computing Systems Lecture 4 Relational Algebra and Relational Calculus Instructor: Sudeepa Roy Finish NULLs and Views in SQL from Lecture 3 Relational Algebra
More informationv Conceptual Design: ER model v Logical Design: ER to relational model v Querying and manipulating data
Outline Conceptual Design: ER model Relational Algebra Calculus Yanlei Diao UMass Amherst Logical Design: ER to relational model Querying and manipulating data Practical language: SQL Declarative: say
More information4/10/2018. Relational Algebra (RA) 1. Selection (σ) 2. Projection (Π) Note that RA Operators are Compositional! 3.
Lecture 33: The Relational Model 2 Professor Xiannong Meng Spring 2018 Lecture and activity contents are based on what Prof Chris Ré of Stanford used in his CS 145 in the fall 2016 term with permission
More informationCSC 261/461 Database Systems Lecture 13. Fall 2017
CSC 261/461 Database Systems Lecture 13 Fall 2017 Announcement Start learning HTML, CSS, JavaScript, PHP + SQL We will cover the basics next week https://www.w3schools.com/php/php_mysql_intro.asp Project
More informationCSCC43H: Introduction to Databases. Lecture 3
CSCC43H: Introduction to Databases Lecture 3 Wael Aboulsaadat Acknowledgment: these slides are partially based on Prof. Garcia-Molina & Prof. Ullman slides accompanying the course s textbook. CSCC43: Introduction
More informationCarnegie Mellon Univ. Dept. of Computer Science Database Applications. General Overview - rel. model. Overview - detailed - SQL
Carnegie Mellon Univ. Dept. of Computer Science 15-415 - Database Applications Faloutsos Lecture#6: Rel. model - SQL part1 General Overview - rel. model Formal query languages rel algebra and calculi Commercial
More informationRelational Query Languages. Preliminaries. Formal Relational Query Languages. Example Schema, with table contents. Relational Algebra
Note: Slides are posted on the class website, protected by a password written on the board Reading: see class home page www.cs.umb.edu/cs630. Relational Algebra CS430/630 Lecture 2 Relational Query Languages
More informationRelational Query Languages
1 ITCS 3160 DATA BASE DESIGN AND IMPLEMENTATION JING YANG 2010 FALL Class 9: The Relational Algebra and Relational Calculus Relational Query Languages 2 Query languages: Allow manipulation and retrieval
More informationSQL - Lecture 3 (Aggregation, etc.)
SQL - Lecture 3 (Aggregation, etc.) INFS 614 INFS614 1 Example Instances S1 S2 R1 sid bid day 22 101 10/10/96 58 103 11/12/96 sid sname rating age 22 dustin 7 45.0 31 lubber 8 55.5 58 rusty 10 35.0 sid
More informationRelational Query Languages. Relational Algebra. Preliminaries. Formal Relational Query Languages. Relational Algebra: 5 Basic Operations
Relational Algebra R & G, Chapter 4 By relieving the brain of all unnecessary work, a good notation sets it free to concentrate on more advanced problems, and, in effect, increases the mental power of
More informationRelational Algebra 1. Week 4
Relational Algebra 1 Week 4 Relational Query Languages Query languages: Allow manipulation and retrieval of data from a database. Relational model supports simple, powerful QLs: Strong formal foundation
More informationRelational Algebra 1
Relational Algebra 1 Relational Query Languages v Query languages: Allow manipulation and retrieval of data from a database. v Relational model supports simple, powerful QLs: Strong formal foundation based
More informationCS 4604: Introduction to Database Management Systems. B. Aditya Prakash Lecture #10: Query Processing
CS 4604: Introduction to Database Management Systems B. Aditya Prakash Lecture #10: Query Processing Outline introduction selection projection join set & aggregate operations Prakash 2018 VT CS 4604 2
More informationDatabase Systems. Course Administration. 10/13/2010 Lecture #4
Database Systems 10/13/2010 Lecture #4 1 Course Administration Assignment #1 is due at the end of next week s class. Course slides will now have black background Printer friendly: set the printing color
More informationRelational algebra. Iztok Savnik, FAMNIT. IDB, Algebra
Relational algebra Iztok Savnik, FAMNIT Slides & Textbook Textbook: Raghu Ramakrishnan, Johannes Gehrke, Database Management Systems, McGraw-Hill, 3 rd ed., 2007. Slides: From Cow Book : R.Ramakrishnan,
More informationCIS 330: Applied Database Systems
1 CIS 330: Applied Database Systems Lecture 7: SQL Johannes Gehrke johannes@cs.cornell.edu http://www.cs.cornell.edu/johannes Logistics Office hours role call: Mondays, 3-4pm Tuesdays, 4:30-5:30 Wednesdays,
More informationCS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #7: En-ty/Rela-onal Model---Part 3
CS 4604: Introduc0on to Database Management Systems B. Aditya Prakash Lecture #7: En-ty/Rela-onal Model---Part 3 Purpose of E/R Model The E/R model allows us to sketch the design of a database informally.
More informationDatabase Applications (15-415)
Database Applications (15-415) Relational Algebra Lecture 5, January 24, 2016 Mohammad Hammoud Today Last Session: The relational model Today s Session: Relational algebra Relational query languages (in
More informationDatabase Applications (15-415)
Database Applications (15-415) ER to Relational & Relational Algebra Lecture 4, January 20, 2015 Mohammad Hammoud Today Last Session: The relational model Today s Session: ER to relational Relational algebra
More informationL22: The Relational Model (continued) CS3200 Database design (sp18 s2) 4/5/2018
L22: The Relational Model (continued) CS3200 Database design (sp18 s2) https://course.ccs.neu.edu/cs3200sp18s2/ 4/5/2018 256 Announcements! Please pick up your exam if you have not yet HW6 will include
More informationCS3DB3/SE4DB3/SE6DB3 TUTORIAL
CS3DB3/SE4DB3/SE6DB3 TUTORIAL Xiao Jiao Wang Feb 25, 2015 Relational Algebra IMPORTANT: relational engines work on bags, no set!!! Union, intersection, and difference Union: Intersection: Difference: Note:
More informationDatabase Applications (15-415)
Database Applications (15-415) DBMS Internals- Part VII Lecture 15, March 17, 2014 Mohammad Hammoud Today Last Session: DBMS Internals- Part VI Algorithms for Relational Operations Today s Session: DBMS
More informationDatabase Applications (15-415)
Database Applications (15-415) DBMS Internals- Part VIII Lecture 16, March 19, 2014 Mohammad Hammoud Today Last Session: DBMS Internals- Part VII Algorithms for Relational Operations (Cont d) Today s Session:
More informationRelational Model, Relational Algebra, and SQL
Relational Model, Relational Algebra, and SQL August 29, 2007 1 Relational Model Data model. constraints. Set of conceptual tools for describing of data, data semantics, data relationships, and data integrity
More informationStandard stuff. Class webpage: cs.rhodes.edu/db Textbook: get it somewhere; used is fine. Prerequisite: CS 241 Coursework:
Databases Standard stuff Class webpage: cs.rhodes.edu/db Textbook: get it somewhere; used is fine Stay up with reading! Prerequisite: CS 241 Coursework: Homework, group project, midterm, final Be prepared
More informationSQL: Queries, Constraints, Triggers
SQL: Queries, Constraints, Triggers [R&G] Chapter 5 CS4320 1 Example Instances We will use these instances of the Sailors and Reserves relations in our examples. If the key for the Reserves relation contained
More informationBasic operators: selection, projection, cross product, union, difference,
CS145 Lecture Notes #6 Relational Algebra Steps in Building and Using a Database 1. Design schema 2. Create schema in DBMS 3. Load initial data 4. Repeat: execute queries and updates on the database Database
More informationReview: Where have we been?
SQL Basic Review Query languages provide 2 key advantages: Less work for user asking query More opportunities for optimization Algebra and safe calculus are simple and powerful models for query languages
More informationLecture 3 More SQL. Instructor: Sudeepa Roy. CompSci 516: Database Systems
CompSci 516 Database Systems Lecture 3 More SQL Instructor: Sudeepa Roy Duke CS, Fall 2018 CompSci 516: Database Systems 1 Announcements HW1 is published on Sakai: Resources -> HW -> HW1 folder Due on
More informationLecture 2 SQL. Instructor: Sudeepa Roy. CompSci 516: Data Intensive Computing Systems
CompSci 516 Data Intensive Computing Systems Lecture 2 SQL Instructor: Sudeepa Roy Duke CS, Spring 2016 CompSci 516: Data Intensive Computing Systems 1 Announcement If you are enrolled to the class, but
More informationRelational Algebra Part I. CS 377: Database Systems
Relational Algebra Part I CS 377: Database Systems Recap of Last Week ER Model: Design good conceptual models to store information Relational Model: Table representation with structures and constraints
More informationIntroduction to Data Management. Lecture #14 (Relational Languages IV)
Introduction to Data Management Lecture #14 (Relational Languages IV) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 It s time again for...
More informationIan Kenny. November 28, 2017
Ian Kenny November 28, 2017 Introductory Databases Relational Algebra Introduction In this lecture we will cover Relational Algebra. Relational Algebra is the foundation upon which SQL is built and is
More informationRELATIONAL ALGEBRA. CS 564- Fall ACKs: Dan Suciu, Jignesh Patel, AnHai Doan
RELATIONAL ALGEBRA CS 564- Fall 2016 ACKs: Dan Suciu, Jignesh Patel, AnHai Doan RELATIONAL QUERY LANGUAGES allow the manipulation and retrieval of data from a database two types of query languages: Declarative:
More informationQuery and Join Op/miza/on 11/5
Query and Join Op/miza/on 11/5 Overview Recap of Merge Join Op/miza/on Logical Op/miza/on Histograms (How Es/mates Work. Big problem!) Physical Op/mizer (if we have /me) Recap on Merge Key (Simple) Idea
More informationSQL: Queries, Programming, Triggers
SQL: Queries, Programming, Triggers CSC343 Introduction to Databases - A. Vaisman 1 Example Instances We will use these instances of the Sailors and Reserves relations in our examples. If the key for the
More informationRelational Algebra and SQL
Relational Algebra and SQL Relational Algebra. This algebra is an important form of query language for the relational model. The operators of the relational algebra: divided into the following classes:
More informationRelational Model and Relational Algebra
Relational Model and Relational Algebra CMPSCI 445 Database Systems Fall 2008 Some slide content courtesy of Zack Ives, Ramakrishnan & Gehrke, Dan Suciu, Ullman & Widom Next lectures: Querying relational
More informationAnnouncements. Relational Model & Algebra. Example. Relational data model. Example. Schema versus instance. Lecture notes
Announcements Relational Model & Algebra CPS 216 Advanced Database Systems Lecture notes Notes version (incomplete) available in the morning on the day of lecture Slides version (complete) available after
More informationImplementation of Relational Operations
Implementation of Relational Operations Module 4, Lecture 1 Database Management Systems, R. Ramakrishnan 1 Relational Operations We will consider how to implement: Selection ( ) Selects a subset of rows
More informationECS 165B: Database System Implementa6on Lecture 7
ECS 165B: Database System Implementa6on Lecture 7 UC Davis April 12, 2010 Acknowledgements: por6ons based on slides by Raghu Ramakrishnan and Johannes Gehrke. Class Agenda Last 6me: Dynamic aspects of
More informationCompSci 516 Database Systems. Lecture 2 SQL. Instructor: Sudeepa Roy
CompSci 516 Database Systems Lecture 2 SQL Instructor: Sudeepa Roy Duke CS, Fall 2018 1 Announcements If you are enrolled to the class, but have not received the email from Piazza, please send me an email
More informationLecture Query evaluation. Combining operators. Logical query optimization. By Marina Barsky Winter 2016, University of Toronto
Lecture 02.03. Query evaluation Combining operators. Logical query optimization By Marina Barsky Winter 2016, University of Toronto Quick recap: Relational Algebra Operators Core operators: Selection σ
More informationRelational Algebra for sets Introduction to relational algebra for bags
Relational Algebra for sets Introduction to relational algebra for bags Thursday, September 27, 2012 1 1 Terminology for Relational Databases Slide repeated from Lecture 1... Account Number Owner Balance
More informationEvaluation of Relational Operations
Evaluation of Relational Operations Yanlei Diao UMass Amherst March 13 and 15, 2006 Slides Courtesy of R. Ramakrishnan and J. Gehrke 1 Relational Operations We will consider how to implement: Selection
More informationCS 317/387. A Relation is a Table. Schemas. Towards SQL - Relational Algebra. name manf Winterbrew Pete s Bud Lite Anheuser-Busch Beers
CS 317/387 Towards SQL - Relational Algebra A Relation is a Table Attributes (column headers) Tuples (rows) name manf Winterbrew Pete s Bud Lite Anheuser-Busch Beers Schemas Relation schema = relation
More informationRelational Algebra. Study Chapter Comp 521 Files and Databases Fall
Relational Algebra Study Chapter 4.1-4.2 Comp 521 Files and Databases Fall 2010 1 Relational Query Languages Query languages: Allow manipulation and retrieval of data from a database. Relational model
More informationSQL - Data Query language
SQL - Data Query language Eduardo J Ruiz October 20, 2009 1 Basic Structure The simple structure for a SQL query is the following: select a1...an from t1... tr where C Where t 1... t r is a list of relations
More informationCompSci 516: Database Systems
CompSci 516 Database Systems Lecture 4 Relational Algebra and Relational Calculus Instructor: Sudeepa Roy Duke CS, Fall 2018 CompSci 516: Database Systems 1 Reminder: HW1 Announcements Sakai : Resources
More informationCS 582 Database Management Systems II
Review of SQL Basics SQL overview Several parts Data-definition language (DDL): insert, delete, modify schemas Data-manipulation language (DML): insert, delete, modify tuples Integrity View definition
More informationAnnouncements (September 14) SQL: Part I SQL. Creating and dropping tables. Basic queries: SFW statement. Example: reading a table
Announcements (September 14) 2 SQL: Part I Books should have arrived by now Homework #1 due next Tuesday Project milestone #1 due in 4 weeks CPS 116 Introduction to Database Systems SQL 3 Creating and
More informationIntroduction to Data Management. Lecture #13 (Relational Calculus, Continued) It s time for another installment of...
Introduction to Data Management Lecture #13 (Relational Calculus, Continued) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 It s time for another
More informationLecture 3 SQL - 2. Today s topic. Recap: Lecture 2. Basic SQL Query. Conceptual Evaluation Strategy 9/3/17. Instructor: Sudeepa Roy
CompSci 516 Data Intensive Computing Systems Lecture 3 SQL - 2 Instructor: Sudeepa Roy Announcements HW1 reminder: Due on 09/21 (Thurs), 11:55 pm, no late days Project proposal reminder: Due on 09/20 (Wed),
More informationThe SQL Query Language. Creating Relations in SQL. Adding and Deleting Tuples. Destroying and Alterating Relations. Conceptual Evaluation Strategy
The SQ Query anguage Developed by IBM (system R) in the 1970s Need for a standard since it is used by many vendors Standards: SQ-86 SQ-89 (minor revision) SQ-92 (major revision, current standard) SQ-99
More informationIntroduction to Data Management. Lecture #11 (Relational Languages I)
Introduction to Data Management Lecture #11 (Relational Languages I) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements Homework stuff
More informationEvaluation of Relational Operations. Relational Operations
Evaluation of Relational Operations Chapter 14, Part A (Joins) Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Relational Operations v We will consider how to implement: Selection ( )
More informationEvaluation of Relational Operations
Evaluation of Relational Operations Chapter 12, Part A Database Management Systems, R. Ramakrishnan and J. Gehrke 1 Relational Operations We will consider how to implement: Selection ( ) Selects a subset
More informationCS 377 Database Systems
CS 377 Database Systems Relational Algebra and Calculus Li Xiong Department of Mathematics and Computer Science Emory University 1 ER Diagram of Company Database 2 3 4 5 Relational Algebra and Relational
More informationChapter 3: Introduction to SQL. Chapter 3: Introduction to SQL
Chapter 3: Introduction to SQL Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 3: Introduction to SQL Overview of The SQL Query Language Data Definition Basic Query
More information15-415/615 Faloutsos 1
Carnegie Mellon Univ. Dept. of Computer Science 15-415/615 - DB Applications Lecture #14: Implementation of Relational Operations (R&G ch. 12 and 14) 15-415/615 Faloutsos 1 Outline introduction selection
More informationLecture #8 (Still More Relational Theory...!)
Introduction to Data Management Lecture #8 (Still More Relational Theory...!) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v
More informationAdministriva. CS 133: Databases. General Themes. Goals for Today. Fall 2018 Lec 11 10/11 Query Evaluation Prof. Beth Trushkowsky
Administriva Lab 2 Final version due next Wednesday CS 133: Databases Fall 2018 Lec 11 10/11 Query Evaluation Prof. Beth Trushkowsky Problem sets PSet 5 due today No PSet out this week optional practice
More informationOptimization Overview
Lecture 17 Optimization Overview Lecture 17 Lecture 17 Today s Lecture 1. Logical Optimization 2. Physical Optimization 3. Course Summary 2 Lecture 17 Logical vs. Physical Optimization Logical optimization:
More informationRelational Query Languages: Relational Algebra. Juliana Freire
Relational Query Languages: Relational Algebra Relational Query Languages Query languages: Allow manipulation and retrieval of data from a database. Relational model supports simple, powerful QLs: Simple
More informationSQL Part 2. Kathleen Durant PhD Northeastern University CS3200 Lesson 6
SQL Part 2 Kathleen Durant PhD Northeastern University CS3200 Lesson 6 1 Outline for today More of the SELECT command Review of the SET operations Aggregator functions GROUP BY functionality JOIN construct
More informationRelational Model & Algebra. Announcements (Thu. Aug. 27) Relational data model. CPS 116 Introduction to Database Systems
Relational Model & Algebra CPS 116 Introduction to Database Systems Announcements (Thu. Aug. 27) 2 Homework #1 will be assigned next Tuesday Office hours: see also course website Jun: LSRC D327 Tue. 1.5
More informationRelational Databases. Relational Databases. Extended Functional view of Information Manager. e.g. Schema & Example instance of student Relation
Relational Databases Relational Databases 1 Relational Model of Data 2 Relational Algebra (and connection to Datalog) Relational database: a set of relations/tables Relation schema : specifies name of
More informationKeys, SQL, and Views CMPSCI 645
Keys, SQL, and Views CMPSCI 645 SQL Overview SQL Preliminaries Integrity constraints Query capabilities SELECT-FROM- WHERE blocks, Basic features, ordering, duplicates Set ops (union, intersect, except)
More informationRelational Databases
Relational Databases Jan Chomicki University at Buffalo Jan Chomicki () Relational databases 1 / 49 Plan of the course 1 Relational databases 2 Relational database design 3 Conceptual database design 4
More informationThe SQL data-definition language (DDL) allows defining :
Introduction to SQL Introduction to SQL Overview of the SQL Query Language Data Definition Basic Query Structure Additional Basic Operations Set Operations Null Values Aggregate Functions Nested Subqueries
More informationSQL. SQL Queries. CISC437/637, Lecture #8 Ben Cartere9e. Basic form of a SQL query: 3/17/10
SQL CISC437/637, Lecture #8 Ben Cartere9e Copyright Ben Cartere9e 1 SQL Queries Basic form of a SQL query: SELECT [DISTINCT] target FROM relations WHERE qualification target is a list of a9ributes/fields
More informationDatabases - Relational Algebra. (GF Royle, N Spadaccini ) Databases - Relational Algebra 1 / 24
Databases - Relational Algebra (GF Royle, N Spadaccini 2006-2010) Databases - Relational Algebra 1 / 24 This lecture This lecture covers relational algebra which is the formal language underlying the manipulation
More informationThis lecture. Projection. Relational Algebra. Suppose we have a relation
This lecture Databases - Relational Algebra This lecture covers relational algebra which is the formal language underlying the manipulation of relations. We follow the notation from Chapter 4 of Ramakrishnan
More informationThe Relational Model. Week 2
The Relational Model Week 2 1 Relations A relation is a more concrete construction, of something we have seen before, the ER diagram. name S.S.N students street city A relation is (just!) a table! We will
More informationRelational Model 2: Relational Algebra
Yufei Tao Department of Computer Science and Engineering Chinese University of Hong Kong The relational model defines: 1 the format by which data should be stored; 2 the operations for querying the data.
More information