Syllabus Introduction Website Management Systems

Slides:



Advertisements
Similar presentations
1 Lecture 5: SQL Schema & Views. 2 Data Definition in SQL So far we have see the Data Manipulation Language, DML Next: Data Definition Language (DDL)
Advertisements

1 Lecture 02: SQL. 2 Outline Data in SQL Simple Queries in SQL (6.1) Queries with more than one relation (6.2) Recomeded reading: Chapter 3, Simple Queries.
SQL Introduction Standard language for querying and manipulating data Structured Query Language Many standards out there: SQL92, SQL2, SQL3. Vendors support.
พีชคณิตแบบสัมพันธ์ (Relational Algebra) บทที่ 3 อ. ดร. ชุรี เตชะวุฒิ CS (204)321 ระบบฐานข้อมูล 1 (Database System I)
Relational Algebra, Join and QBE Yong Choi School of Business CSUB, Bakersfield.
Lecture 07: Relational Algebra
1 Relational Algebra. Motivation Write a Java program Translate it into a program in assembly language Execute the assembly language program As a rough.
Relational Algebra (end) SQL April 19 th, Complex Queries Product ( pid, name, price, category, maker-cid) Purchase (buyer-ssn, seller-ssn, store,
Slides adapted from Rao (ASU) & Franklin (Berkeley) Structure How will search and querying on these three types of data differ? A generic web page containing.
Relational Algebra Maybe -- SQL. Confused by Normal Forms ? 3NF BCNF 4NF If a database doesn’t violate 4NF (BCNF) then it doesn’t violate BCNF (3NF) !
Relational Algebra 1 Chapter 5.1 V3.0 Napier University Dr Gordon Russell.
1 Lecture 12: SQL Friday, October 26, Outline Simple Queries in SQL (5.1) Queries with more than one relation (5.2) Subqueries (5.3) Duplicates.
Chapter 2 The Relational Database Model
Lecture #3 Functional Dependencies Normalization Relational Algebra Thursday, October 12, 2000.
1 Lecture 07: Relational Algebra. 2 Outline Relational Algebra (Section 6.1)
Chapter 11.1 and 11.2 Data Manipulation: Relational Algebra and SQL Brian Cobarrubia Introduction to Database Management Systems October 4, 2007.
Complex Queries (1) Product ( pname, price, category, maker)
Relational Schema Design (end) Relational Algebra Finally, querying the database!
One More Normal Form Consider the dependencies: Product Company Company, State Product Is it in BCNF?
Relation Decomposition A, A, … A 12n Given a relation R with attributes Create two relations R1 and R2 with attributes B, B, … B 12m C, C, … C 12l Such.
Integrity Constraints An important functionality of a DBMS is to enable the specification of integrity constraints and to enforce them. Knowledge of integrity.
Exercises Product ( pname, price, category, maker) Purchase (buyer, seller, store, product) Company (cname, stock price, country) Person( per-name, phone.
The Relational Database Model
Today Collection of unrelated stuff Questions? HW –4 -5 & drop lowest –emphasize project Projects Functional Dependencies? –Someone asked why: Keys, Normal.
M Taimoor Khan Course Objectives 1) Basic Concepts 2) Tools 3) Database architecture and design 4) Flow of data (DFDs)
M Taimoor Khan Course Objectives 1) Basic Concepts 2) Tools 3) Database architecture and design 4) Flow of data (DFDs)
1 Lecture 7: Normal Forms, Relational Algebra Monday, 10/15/2001.
Relational Algebra 2. Relational Algebra Formalism for creating new relations from existing ones Its place in the big picture: Declartive query language.
Advanced Relational Algebra & SQL (Part1 )
CSE 326: Data Structures Lecture #22 Databases and Sorting Alon Halevy Spring Quarter 2001.
Introduction to Database Systems CSE 444 Lecture #1 September,
Ritu CHaturvedi Some figures are adapted from T. COnnolly
Summary of Relational Algebra
Relational Algebra.
Introduction to Database Systems CSE 444
Lecture 5: Conceptual Database Design
COMP3017 Advanced Databases
Fundamental of Database Systems
Relational Algebra at a Glance
Lecture 8: Relational Algebra
Conceptual Database Design
CS 440 Database Management Systems
Chapter 2: Intro to Relational Model
Relational Algebra Chapter 4, Part A
Translation of ER-diagram into Relational Schema
Relational Algebra 461 The slides for this text are organized into chapters. This lecture covers relational algebra, from Chapter 4. The relational calculus.
Lecture 10: Relational Algebra (continued), Datalog
LECTURE 3: Relational Algebra
Relational Algebra Chapter 4, Sections 4.1 – 4.2
CSE544 Lecture 1: Introduction
Databases.
SQL Introduction Standard language for querying and manipulating data
Lecture 9: Relational Algebra (continued), Datalog
Lecture 12: SQL Friday, October 20, 2000.
Introduction to Database Systems CSE 444
Lecture 33: The Relational Model 2
Where are we? Until now: Modeling databases (ODL, E/R): all about the schema Now: Manipulating the data: queries, updates, SQL Then: looking inside -
Lecture 4: SQL Thursday, January 11, 2001.
Why use a DBMS in your website?
Integrity Constraints
Relational Algebra Friday, 11/14/2003.
Lecture 3 Monday, April 8, 2002.
CS639: Data Management for Data Science
Terminology Product Attribute names Name Price Category Manufacturer
Lecture 3: Relational Algebra and SQL
Introduction to Database Systems CSE 444
Introduction to Database Systems CSE 444
Lecture 11: Functional Dependencies
Presentation transcript:

Syllabus Introduction Website Management Systems XML, XSL, Scripting Database Connectivity Scalability Search Engine Technology Information Integration Personalization Security Electronic Commerce 4/28/2019 11:00 PM 1

Database Outline DBMS Overview Relational Algebra SQL ODBC/JDBC/Cocoon SQL Processor 4/28/2019 11:00 PM 2

Why use a DBMS in your website? Suppose we are building web-based music distribution site. Several questions arise: How do we store the data? (file organization, etc.) How do we query the data? (write programs…) Make sure that updates don’t mess things up? Provide different views on the data? (registrar versus students) How do we deal with crashes? Way too complicated! Buy a database system! 4/28/2019 11:00 PM 3

Functionality of a DBMS Storage management Abstract data model High level query and data manipulation language Efficient query processing Transaction processing Resiliency: recovery from crashes Different views of the data, security Interface with programming languages 4/28/2019 11:00 PM 4

Building an Application with a Database System Requirements modeling (conceptual, pictures) Decide what entities should be part of the application and how they should be linked. Schema design and implementation Decide on a set of tables, attributes. Define the tables in the database system. Populate database (insert tuples). Write application programs using the DBMS Now much easier, with data management API 4/28/2019 11:00 PM 5

Conceptual Modeling name category name ssn Takes Course Student quarter Advises Teaches Professor name field address 4/28/2019 11:00 PM 6

Schema Design & Implementation Table Students Separates the logical view from the physical view of the data. 4/28/2019 11:00 PM 7

Querying a Database Find all the students taking CSE490i in Q1, 2000 S(tructured) Q(uery) L(anguage) select E.name from Enroll E where E.course=CS490i and E.quarter=“Winter, 2000” Query processor figures out how to answer the query efficiently. 4/28/2019 11:00 PM 8

Relational Algebra Operators Basic Binary Set Operators tuple sets as input, new set as output Basic Binary Set Operators Result is table (set) with same attributes Sets must be compatible! R1(A1,A2,A3)  R2(B1,B2,B3)  Domain(Ai) = Domain(Bi) Union All tuples in either R1 or in R2 Intersection All tuples in both R1 and R2 Difference All tuples in R1 but not in R2 Complement - what’s the universe? Selection, Projection, Cartesian Product, Join 4/28/2019 11:00 PM 9

Selection s Grab a subset of the tuples in a relation that satisfy a given condition Use and, or, not, >, <… to build condition Unary operation… returns set with same attributes, but ‘selects’ rows 4/28/2019 11:00 PM 10

Selection Example Employee SSN Name DepartmentID Salary 999999999 John 1 30,000 777777777 Tony 1 32,000 888888888 Alice 2 45,000 SSN Name DepartmentID Salary 888888888 Alice 2 45,000 Select (Salary > 40000) 4/28/2019 11:00 PM 11

Projection p Unary operation, selects columns Returned schema is different, So returned tuples are not subset of original set Contrast with selection Eliminates duplicate tuples 4/28/2019 11:00 PM 12

4/28/2019 11:00 PM 13

Cartesian Product X Binary Operation Result is set of tuples combining all elements of R1 with all elements of R2, for R1  R2 Schema is union of Schema(R1) & Schema(R2) Notice we could do selection on result to get meaningful info! 4/28/2019 11:00 PM 14

Cartesian Product Example 4/28/2019 11:00 PM 15

Join Most common (and exciting!) operator… Combines 2 relations Selecting only related tuples Equivalent to Cross product followed by selection Result has all attributes of the two relations Equijoin Join condition is equality between two attributes Natural join Equijoin on attributes of same name result has only one copy of join condition attribute 4/28/2019 11:00 PM 16

Example: Natural Join Employee Dependents 4/28/2019 11:00 PM 17

Complex Queries Product ( pname, price, category, maker) Purchase (buyer, seller, store, prodname) Company (cname, stock price, country) Person( per-name, phone number, city) Find phone numbers of people who bought gizmos from Fred. Find telephony products that somebody bought 4/28/2019 11:00 PM 18

Exercises Product ( pname, price, category, maker) Purchase (buyer, seller, store, prodname) Company (cname, stock price, country) Person( per-name, phone number, city) Ex #1: Find people who bought telephony products. Ex #2: Find names of people who bought American products Ex #3: Find names of people who bought American products and did not buy French products Ex #4: Find names of people who bought American products and they live in Seattle. Ex #5: Find people who bought stuff from Joe or bought products from a company whose stock prices is more than $50. 4/28/2019 11:00 PM 19

Operations on Bags (and why we care) Basic operations: Projection Selection Union Intersection Set difference Cartesian product Join (natural join, theta join) 4/28/2019 11:00 PM 20