CSCI 6315 Applied Database Systems – Exercise (3)

Slides:



Advertisements
Similar presentations
SQL: The Query Language Part 2
Advertisements

SQL: The Query Language Part 1 R &G - Chapter 5 Life is just a bowl of queries. -Anon (not Forrest Gump)
Complex Integrity Constraints in SQL. Constraints over a Single Table Table Constraint: Create TABLE Sailors (sid INTEGER, sname CHAR(10), rating INTEGER,
1 Relational Algebra & Calculus Chapter 4, Part A (Relational Algebra) Query Formulation Exercise.
SQL: Queries.
1 Database Systems 10.8, 2008 Lecture #4. 2 Course Administration Assignment #1 is due next Wed (outside 336/338). Course slides will now have black background.
Relational Calculus   Logic, like whiskey, loses its beneficial effect when taken in too large quantities. --Lord Dunsany.
1 Advanced SQL Queries. 2 Example Tables Used Reserves sidbidday /10/04 11/12/04 Sailors sidsnameratingage Dustin Lubber Rusty.
1 TRC vs DRC 한욱신. 2 Queries in TRC and DRC  TRC Q = {t| f(t)} where t is a (free) tuple variable and f(t) is a well-formed formula  DRC.
Chapter (7): Advanced SQL
Relational Algebra Rohit Khokher. Relational Algebra Set Oriented Operations UnionIntersectionDifference Cartesian Product Relation Oriented Operations.
Introduction to Database Systems 1 SQL: The Query Language Relation Model : Topic 4.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Relational Algebra Chapter 4, Part A Modified by Donghui Zhang.
Schema BankWorld Customer(C_Name, C_Street, C_City) Depositor(Account_#, C_Name) Loan(Loan_#, B_Name, Amount) Borrower(C_Name, Loan_#)
SQL and Relational Algebra Zaki Malik September 02, 2008.
1 Relational Algebra & Calculus. 2 Relational Query Languages  Query languages: Allow manipulation and retrieval of data from a database.  Relational.
SQL (2).
CMPT 258 Database Systems SQL: Queries, Constraints, Triggers (Chapter 5) Part II home.manhattan.edu/~tina.tian.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 Relational Algebra Chapter 4, Part A.
1 The Oracle Database System Querying the Data Database Course The Hebrew University of Jerusalem.
Exercises ReservesSailorsBoats Find names of sailors who’ve reserved boat #103 Basic operations: Selection ( σ ) gives a subset of rows. Projection ( π.
Exercises Find the names of sailors who’ve reserved boat #103 { N |  S  Sailors (S.name = N.name   R  Reserves(S.sid = R.sid  R.bid = 103)) }
Relational Algebra.
Introduction to SQL Basics; Christoph F. Eick & R. Ramakrishnan and J. Gehrke 1 Introduction to SQL Basics --- SQL in 45 Minutes Chapter 5.
CSC 411/511: DBMS Design Dr. Nan WangCSC411_L6_SQL(1) 1 SQL: Queries, Constraints, Triggers Chapter 5 – Part 1.
CSCI 4333 Database Design and Implementation – Exercise (3) Xiang Lian The University of Texas – Pan American Edinburg, TX
Data Definition After this lecture, you should be able to:
ICS 321 Fall 2009 SQL: Queries, Constraints, Triggers Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 9/8/20091Lipyeow.
1 Relational Algebra & Calculus Chapter 4, Part A (Relational Algebra)
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 4 Relational Algebra.
CSCI 4333 Database Design and Implementation – Exercise (5) Xiang Lian The University of Texas – Pan American Edinburg, TX
CMPT 258 Database Systems Relational Algebra (Chapter 4)
CMPT 258 Database Systems SQL Queries (Chapter 5).
CSCI 3328 Object Oriented Programming in C# Chapter 12: Databases and LINQ – Exercises 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg,
CS 405G: Introduction to Database Systems Instructor: Jinze Liu Fall 2007.
CSCI 4333 Database Design and Implementation – Exercise (2) Xiang Lian The University of Texas Rio Grande Valley Edinburg, TX 78539
SQL: The Query Language Part 1 R &G - Chapter 5 The important thing is not to stop questioning. Albert Einstein.
CSCI 4333 Database Design and Implementation – Exercise (1) Xiang Lian The University of Texas Rio Grande Valley Edinburg, TX 78539
DataBase - Check 01 DataBase 2 nd year Computer Science & Engineer 1.
SQL Exercises. 1) Names of suppliers. Suppliers(sid, sname, address) Parts(pid, pname, color) Catalog(sid, pid, cost)
CSCI 4333 Database Design and Implementation – Exercise (5)
Relational Calculus Database Management Systems, 3rd ed., Ramakrishnan and Gehrke, Chapter 4.
Relational Algebra & Calculus
Database Systems (資料庫系統)
© פרופ' יהושע שגיב, האוניברסיטה העברית
COP Introduction to Database Structures
Relational Algebra Chapter 4, Part A
CSCI 6315 Applied Database Systems – Exercise (1)
CSCI 3328 Object Oriented Programming in C# Review: Final Exam
Database Systems 10/13/2010 Lecture #4.
Relational Algebra.
The University of Texas Rio Grande Valley
CS 405G: Introduction to Database Systems
CSCI 4333 Database Design and Implementation – Exercise (3)
Relational Calculus.
SQL: The Query Language Part 1
קורס קבצים ובסיסי נתונים
CSCI 3328 Object Oriented Programming in C# Review: Exam I
The University of Texas Rio Grande Valley
CSCI 4333 Database Design and Implementation – Exercise (5)
CSCI 6315 Applied Database Systems – Exercise (4)
CSCI 6307 Foundation of Systems – Exercise (1)
CSCI 3328 Object Oriented Programming in C# Review: Exam II
CSCI 6315 Applied Database Systems – Exercise (6)
CSCI 4333 Database Design and Implementation – Exercise (4)
CENG 351 File Structures and Data Managemnet
Relational Algebra & Calculus
CSCI 6315 Applied Database Systems – Exercise (5)
CSCI 6307 Foundation of Systems – Exercise (5)
CSCI 4333 Database Design and Implementation – Exercise (1)
Presentation transcript:

CSCI 6315 Applied Database Systems – Exercise (3) Xiang Lian The University of Texas Rio Grande Valley Edinburg, TX 78539 xiang.lian@utrgv.edu

SQL (1) Find ids of sailors who’ve reserved boat with bid 103 SQL: Sailors (sid, sname) Reserves (sid, bid, date) Boats (bid, bname, color) SQL:

SQL (2) Find the names of sailors who’ve reserved boat with bid 103 Sailors (sid, sname) Reserves (sid, bid, date) Boats (bid, bname, color) SQL:

SQL (3) Find the names of sailors who’ve reserved a red boat SQL: Sailors (sid, sname) Reserves (sid, bid, date) Boats (bid, bname, color) SQL:

SQL (4) Find the names of sailors who’ve reserved a red or a green boat Sailors (sid, sname) Reserves (sid, bid, date) Boats (bid, bname, color) SQL:

SQL (5) Find the names of sailors who’ve reserved a red and a green boat Sailors (sid, sname) Reserves (sid, bid, date) Boats (bid, bname, color) SQL:

SQL (6) Find the ids of sailors who have made at least two reservations on the same date Sailors (sid, sname) Reserves (sid, bid, date) Boats (bid, bname, color) SQL: