Introduction to Databases (2)

Slides:



Advertisements
Similar presentations
Critical Reading Strategies: Overview of Research Process
Advertisements

Relational Algebra Relational algebra consists of a set of relational operators Each operator has one or more relations as input and creates a new relation.
COMP 3715 Spring 05. Working with data in a DBMS Any database system must allow user to  Define data Relations Attributes Constraints  Manipulate data.
CS4432: Database Systems II Query Operator & Algebraic Expressions 1.
Chapter 6: Database Evolution Title: AutoAdmin “What-if” Index Analysis Utility Authors: Surajit Chaudhuri, Vivek Narasayya ACM SIGMOD 1998.
Tools of the trade TSQL CIS 407. SQL Server Tools Books on line! Don’t use sql server authentication –Use windows authentication (safer) for developer.
Fundamentals, Design, and Implementation, 9/e Chapter 6 Introduction to Structured Query Language (SQL)
SQL SQL stands for Structured Query Language SQL allows you to access a database SQL is an ANSI standard computer language SQL can execute queries against.
Chapter 7: SQL, the Structured Query Language Soid Quintero & Ervi Bongso CS157B.
Relational DBs and SQL Designing Your Web Database (Ch. 8) → Creating and Working with a MySQL Database (Ch. 9, 10) 1.
CS609 Introduction. Databases Current state? Future?
SQL/lesson 2/Slide 1 of 45 Retrieving Result Sets Objectives In this lesson, you will learn to: * Use wildcards * Use the IS NULL and IS NOT NULL keywords.
Instructor: Jinze Liu Fall Basic Components (2) Relational Database Web-Interface Done before mid-term Must-Have Components (2) Security: access.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Database Management COP4540, SCS, FIU Structured Query Language (Chapter 8)
SE305 Database System Technology 23/10/2014 Quiz-2.
Structured Query Language Introduction. Basic Select SELECT lname, fname, phone FROM employees; Employees Table LNAMEFNAMEPHONE JonesMark SmithSara
Queries SELECT [DISTINCT] FROM ( { }| ),... [WHERE ] [GROUP BY [HAVING ]] [ORDER BY [ ],...]
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 (Part II) INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor.
Presentation Template KwangSoo Yang Florida Atlantic University College of Engineering & Computer Science.
1/18/00CSE 711 data mining1 What is SQL? Query language for structural databases (esp. RDB) Structured Query Language Originated from Sequel 2 by Chamberlin.
SqlExam1Review.ppt EXAM - 1. SQL stands for -- Structured Query Language Putting a manual database on a computer ensures? Data is more current Data is.
1 MySQL and SQL. 2 Topics  Introducing Relational Databases  Terminology  Managing Databases MySQL and SQL.
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.
Introduction to Algorithm Complexity Bit Sum Problem.
Big Data Yuan Xue CS 292 Special topics on.
SQL SQL Ayshah I. Almugahwi Maryam J. Alkhalifa
Teacher Workshop Database Design Pearson Education © 2014.
MySQL Customer Order Example
Structured Query Language
Module 2: Intro to Relational Model
COP Introduction to Database Structures
Prepared by : Moshira M. Ali CS490 Coordinator Arab Open University
CS580 Advanced Database Topics
Introduction to Database Systems, CS420
SQL: Advanced Options, Updates and Views Lecturer: Dr Pavle Mogin
CPSC-608 Database Systems
CS 440 Database Management Systems
Chapter 2: Intro to Relational Model
Relational Algebra Chapter 4, Part A
SQL FUNDAMENTALS CDSE Days 2018.
Relational Algebra 461 The slides for this text are organized into chapters. This lecture covers relational algebra, from Chapter 4. The relational calculus.
CS 405G: Introduction to Database Systems
Relational Algebra.
Database management concepts
Teaching slides Chapter 8.
Relational Algebra Chapter 4 - part I.
Chapter # 7 Introduction to Structured Query Language (SQL) Part II.
Chapter 2: Designing your project
Relational Algebra Chapter 4, Sections 4.1 – 4.2
Chapter 4 Summary Query.
The Relational Model Textbook /7/2018.
Access: SQL Participation Project
CMPT 354: Database System I
Database management concepts
Contents Preface I Introduction Lesson Objectives I-2
Chapter 7 Using SQL in Applications
Chapter 2: Intro to Relational Model
CSC 453 Database Systems Lecture
Example of a Relation attributes (or columns) tuples (or rows)
Chapter 2: Intro to Relational Model
SQL: Structured Query Language
CPSC-608 Database Systems
CPSC-608 Database Systems
Course Instructor: Supriya Gupta Asstt. Prof
Relational Algebra Chapter 4 - part I.
Instructor: Zhe He Department of Computer Science
Select-From-Where Statements Multirelation Queries Subqueries
Presentation transcript:

Introduction to Databases (2) COP 6726: New Directions in Database Systems Introduction to Databases (2)

Critical Reading

Six questions for Critical Reading What is the problem? Why is it important? Why is it challenging (or hard)? What are the limitations of the related work? What is the novelty? What are the contributions? What is the validation methodology?

1. What is the problem? What is the problem addressed in the paper? Is it clearly stated? Does the author make the important issues clear?

2. Why is it important? Is the problem significant / relevant? Is there any reason to care about the problem (practical applications / real world applications) and paper’s results? Is the problem new?

3. Why is it challenging? What is the difficulty of solving the problem? Computationally complex? (NP completeness?) Large search space? Hard to solve?

4. What are the limitations of the related work? What is the novelty? Has the problem been solved before? Is this a trivial variation on or extension of previous results? Is the author aware of related and previous work, both recent and old? What are the assumptions and limitations of related work? Which limitation is solved in the paper? Critique an assumption that you believe is unreasonable. What is the impact of removing this unreasonable assumption on the solution proposed by the authors?

5. What are the contributions? Is the problem the extension of the related work? Which part is extended? Is the problem new? What are the proposed approaches, algorithms, and ideas? Is there any experimental and analytical evaluation?

6. What is the validation methodology? Case study? Statistical hypothesis testing? Analytical evaluation? Computational complexity? Theorem and lemmas, proofs? Experimental evaluation? The strengths and weaknesses of the methodology? Why did authors choose this/these methodology?

Paper & Presentation (20%) Project (30%) Proposal (10%) Paper & Presentation (20%) Problem Definition Question Input, output, objective, constraints Importance Societal applications Long-standing open problems Hardness Challenges Large search space Response time constraints Uncertainty (e.g.. Model) Formal characterization (e.g., NP-complete) Approach First step in the right direction Description Key idea which can address the problem The challenges: special case and general case Examples / Justification Design decisions Pseudo code Execution trace Novelty Literature Survey Provide Examples as compared with the state of the art. Literature survey Detailed theorem, case study, exceptions General List other applications Detailed other applications.

Proposal (Due Oct. 12) Proposal should include a plan of work: Tasks Schedule, resource, need People (e.g., skill and role)

SQL PostgreSQL

SQL is a very-high-level language. Avoid a lot of data-manipulation details needed in procedural languages like C++ or Java. Database management system figures out “best” way to execute query (e.g., query optimization.)

Select-From-Where Statements SELECT attributes FROM one or more tables WHERE condition about tuples of the tables ORDER BY attributes GROUP BY attributes

Example All our SQL queries will be based on the following database schema. Underline indicates key attributes. customer (customer_id, title, fname, lname, addressline, town, zipcode, phone) item (item_id, description, cost_price, sell_price) orderinfo( orderinfo_id, customer_id, date_placed, date_shipped, shipping) stock (item_id, quantity) orderline (orderinfo_id, item_id, quantity) barcode (barcode_ean, item_id)

ER Diagram orderinfo Customer item

Database Schemas

Define a new Schema CREATE SCHEMA schema_name; CREATE SCHEMA cop6726; SET search_path TO myschema,public;

Example CREATE TABLE CREATE TABLE cop6726.customer ( customer_id serial, title char(4), fname varchar(32), lname varchar(32) not null, addressline varchar(64), town varchar(32), zipcode char(10) not null, phone varchar(16), CONSTRAINT customer_pk PRIMARY KEY (customer_id));

Example INSERT rows (or tuples) INSERT INTO cop6726.customer (title, fname, lname, addressline, town, zipcode, phone) VALUES ('Miss','Jenny','Stones','27 Rowan Avenue','Hightown','NT2 1AQ','023 9876'); INSERT INTO cop6726.item(description, cost_price, sell_price) VALUES ('Wood Puzzle', 15.23, 21.95);

DataSet

Retrieve all columns SELECT * FROM cop6726.customer;

Choosing Column(s) (Projection) SELECT customer_id FROM cop6726.customer;

SQL SELECT customer_id, title FROM cop6726.customer;

Overriding Column Names SELECT town, lname AS "Last Name" FROM cop6726.customer;

Order the Data SELECT town, lname FROM cop6726.customer ORDER BY town;

Order the Data SELECT town, lname FROM cop6726.customer ORDER BY town DESC, lname ASC;

Suppressing Duplication SELECT town FROM cop6726.customer ORDER BY town; SELECT DISTINCT town FROM cop6726.customer;

Performing Calculation SELECT description, cost_price FROM cop6726.item; SELECT description, cost_price * 10 FROM cop6726.item;

Choosing Row(s) (Selection) SELECT title, fname, lname FROM cop6726.customer; SELECT title, fname, lname FROM cop6726.customer WHERE title='Mr';

Choosing Row(s) (Selection) SELECT customer_id, town, lname FROM cop6726.customer WHERE customer_id BETWEEN 1 AND 5; WHERE customer_id >= 1 AND customer_id <=5;

Pattern Matching (Selection) SELECT fname, lname FROM cop6726.customer WHERE fname LIKE '_n%'; WHERE fname LIKE '%n%';

Limiting the results SELECT customer_id, town FROM cop6726.customer LIMIT 3;

Equi-Join SELECT customer.customer_id, orderinfo.date_placed FROM cop6726.customer, cop6726.orderinfo WHERE customer.customer_id = orderinfo.customer_id; orderinfo custsomer

Equi-Join

Alias SELECT c.customer_id, o.date_placed FROM cop6726.customer c, cop6726.orderinfo o WHERE c.customer_id = o.customer_id;

Ordering Rows SELECT c.customer_id, o.date_placed FROM cop6726.customer c, cop6726.orderinfo o WHERE c.customer_id = o.customer_id ORDER BY c.customer_id;

Equi-Join SELECT c.customer_id, o.date_placed FROM cop6726.customer c, cop6726.orderinfo o WHERE c.customer_id = o.customer_id AND c.customer_id = 8;

Equi-Join SELECT c.customer_id, o.date_placed FROM cop6726.customer c, cop6726.orderinfo o WHERE c.customer_id = 8; AND c.customer_id = o.customer_id

Cartesian Product (Cross Product) SELECT c.customer_id, o.date_placed FROM cop6726.customer c, cop6726.orderinfo o WHERE c.customer_id = 8;

Cartesian Product (Cross Product)

Self Join SELECT o1.orderinfo_id, o1.customer_id, o2.orderinfo_id, o2.customer_id FROM cop6726.orderinfo o1, cop6726.orderinfo o2 WHERE o1.customer_id < o2.customer_id;

Self Join SELECT o1.orderinfo_id, o1.customer_id, o2.orderinfo_id, o2.customer_id FROM cop6726.orderinfo o1, cop6726.orderinfo o2 WHERE o1.customer_id < o2.customer_id;

Self Join SELECT o1.orderinfo_id, o1.customer_id, o2.orderinfo_id, o2.customer_id FROM cop6726.orderinfo o1, cop6726.orderinfo o2 WHERE o1.customer_id < o2.customer_id;

Self Join SELECT o1.orderinfo_id, o1.customer_id, o2.orderinfo_id, o2.customer_id FROM cop6726.orderinfo o1, cop6726.orderinfo o2 WHERE o1.customer_id < o2.customer_id;

GROUP BY SELECT o.customer_id FROM cop6726.orderinfo o GROUP BY o.customer_id;

Aggregation Function SELECT o.customer_id, count (shipping) FROM cop6726.orderinfo o GROUP BY o.customer_id; SELECT o.customer_id, avg (shipping) FROM cop6726.orderinfo o GROUP BY o.customer_id; SELECT o.customer_id, sum (shipping) FROM cop6726.orderinfo o GROUP BY o.customer_id; SELECT o.customer_id, max (shipping) FROM cop6726.orderinfo o GROUP BY o.customer_id; SELECT o.customer_id, min (shipping) FROM cop6726.orderinfo o GROUP BY o.customer_id;

Take Home Message Critical Reading ( 6 questions) Basic SQL