Retrieve the names of all employees in department 5 who work more than 10 hours per week on the ‘ProductX’ project. p10ssn ← (Π essn (σ hours > 10 (works-on.

Slides:



Advertisements
Similar presentations
Exercise 2 Relational Calculus
Advertisements

The Relational Algebra
Database System - Assignment #3 Sept. 2012Yangjun Chen ACS Assignment #3 due Wed., Nov. 14, (30) Exercise 7.17 on Page 235 Show the result.
Defined by Edgar Codd in 1970 Defined by Edgar Codd in 1970 Considered ingenious but impractical Considered ingenious but impractical Conceptually simple.
Copyright © 2004 Ramez Elmasri and Shamkant Navathe Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 15-1 Query Processing and.
COMPANY schema EMPLOYEE
OUTLINE OF THE LECTURE PART I GOAL: Understand the Data Definition Statements in Fig 4.1 Step1: Columns of the Tables and Data types. Step2: Single column.
Lecture 1 Relational Algebra and Relational Calculus.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
The Relational Algebra
Displaying Data from Multiple Tables. EMPNO DEPTNO LOC NEW YORK CHICAGO NEW YORK DALLAS
Database technology Lecture 2: Relational databases and SQL
Dept. of Computer & Information Sciences
FEN More about SELECT, Nested selects GROUP BY, HAVING, ORDER BY Other joins Aggregate functions Views More about SQL.
LAB 4 FIGURES.
Exercise 1 Relational Algebra Database System-dww.
Data Warehousing/Mining 1 Data Warehousing/Mining Comp 150 Aggregation in SQL (not in book) Instructor: Dan Hebert.
Exploring Microsoft Access 2003 Chapter 4 Proficiency: Relational Databases, External Data, Charts, Pivot, and the Switchboard.
- relation schema, relations - database schema, database state
Review Database Application Development Access Database Development ER-diagram Forms Reports Queries.
Oracle8 - The Complete Reference. Koch & Loney1 Chapter 14. Changing Data: Insert, Update, Delete Presented by Victor M. Matos.
Jyh-haw Yeh Dept. of Computer Science Boise State University
More SQL: Complex Queries, Triggers, Views, and Schema Modification 1.
Relational Data Model Sept. 2014Yangjun Chen ACS Outline: Relational Data Model Relational Data Model -relation schema, relations -database schema,
관계 연산자 & SQL. Selection SELECT * FROM r WHERE A=B AND D>5.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 8- 1 CREATE/DROP/ALTER TABLE Data types : char, varchar, decimal, date CREATE TABLE DEPARTMENT.
Logical DB Design 5. 1 CSE2132 Database Systems Week 5 Lecture Logical Database Design.
Review: Application of Database Systems
1 CS 430 Database Theory Winter 2005 Lecture 12: SQL DML - SELECT.
1 CSE 480: Database Systems Lecture 11: SQL. 2 SQL Query SELECT FROM WHERE –In MySQL, FROM and WHERE clauses are optional –Example:
Relational Algebra - Chapter (7th ed )
CS 380 Introduction to Database Systems Chapter 7: The Relational Algebra and Relational Calculus.
 Employee (fname, minit, lname, ssn, bdate, address, sex, salary, superssn, dno)  Department (dname, dnumber, mgrssn, mgrstartdate) 
Database Management Systems. NESTING OF QUERIES  Some queries require that existing values in the database be retrieved and then used in a comparison.
1 JOIN SUBQUERY Structured Query Language (SQL) - Part III.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
Logical Design database design. Dr. Mohamed Osman Hegaz2 Conceptual Database Designing –Provides concepts that are close to the way many users perceive.
莊裕澤資料庫基本概念 1 Yuh-Jzer Joung 莊 裕 澤 Dept. of Information Management National Taiwan University February, 2002 資料庫管理與資訊科技.
Entity-Relationship Model Chapter 3 II COSC 457 Sungchul Hong.
Review Database Application Development Access Database Development Theory Practice.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
1Fundamentals of Database Systems 기본키에 밑줄을 그은 COMPANY 관계 데이타베이스 스키마 FNAMEMINITLNAMESSNBDATEADDRESSSEXSALARYSUPERSSNDNO EMPLOYEE DNAMEDNUMBERMGRSSNMGRSTARTDATE.
Mapping ER Diagrams to Tables
603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 16 A First Course in Database Systems.
Lecture (8) 1. Relational Database Design by ER- and EERR- to-Relational Mapping 2.
Constraints and Views Chap. 3-5 continued (7 th ed. 5-7)
Relational Algebra National University of Computer and Emerging Sciences Lecture # 6 June 30,2012.
Chapter 7 Relational Database Design by ER- and EERR-to-Relational Mapping Copyright © 2004 Pearson Education, Inc.
The SQL Database Grammar
CS580 Advanced Database Topics
6/22/2018.
Database Design The Relational Model Text Ch5
Relational Database Design by ER- and EER-to-Relational Mapping
Relational Database Design by ER- and EERR-to-Relational Mapping
Relational Database Design by ER-to-Relational Mapping
376a. Database Design Dept. of Computer Science Vassar College
Mapping ER Diagrams to Tables
Outline: Relational Data Model
Joining Tables ضم الجداول وإستخراج مناظر views منها الهدف : 1- استخراج المعلومات من جدولين أو اكثر بالإستفادة من الرابط بينهما وبإستخدام SQL 2- شروط قواعد.
Company Requirements.
Relational Database Design by ER- and EER-to-Relational Mapping
Review: Application of Database Systems
1. Explain the following concepts: (a) superkey (b) key
1.(5) Describe the working process with a database system.
SQLPLUS: Oracle SQL Interface
1. Explain the following concepts of the ER data model:
SQL Grouping, Ordering & Arithmetics Presented by: Dr. Samir Tartir
SQL: Set Operations & Nested Queries. Presented by: Dr. Samir Tartir
Answers to Midterm - Exam. Feb. 28, 2018
Answers to Midterm - Exam. Feb. 27, 2006
Presentation transcript:

Retrieve the names of all employees in department 5 who work more than 10 hours per week on the ‘ProductX’ project. p10ssn ← (Π essn (σ hours > 10 (works-on |X| pno = pnumber(Π pnumber (σ pname = ‘ProductX’ (project)))) Π lname, minit, fname (σ dno = 5 (employee |X| ssn = essn (p10ssn))) select lname, minit, fname from employee, works-on, project where ssn = essn AND pno = pnumber AND dno = 5 AND hours > 10 AND pname = ‘Product X’;

select lname, minit, fname from employee, dependent List the names of all employees who have a dependent with the same first name as themselves. Π lname, minit, fname (employee |X| fname = dependent-name AND ssn = essn (dependent)) select lname, minit, fname from employee, dependent where fname = dependent-name AND ssn = essn;  

Find the names of all employees who are directly supervised by ‘Franklin Wong’. Π lname, minit, fname (employee |X| superssn = ssn (Π ssn (σ fname = ‘Franklin’ AND lname = ‘Wong’ (employee)))) select employee.lname, employee.minit, employee.fname from employee emp where emp.lname = ‘Wong’ AND emp.fname = ‘Franklin’ AND employee.superssn = emp.ssn;  

For each project, list the project name and the total hours per week (by all employees) spent on that project. pname F sum hours (project |X| pnumber = pno (works-on)) select pname, sum(hours) from project, works-on where pno = pnumber group by pname;  

select dname, average(salary) from department, employee For each department, retrieve the department name and the average salary of all employees working in that department. dname F average salary (department |X| dnumber = dno (Π dno, salary, ssn (employee))) select dname, average(salary) from department, employee where dnumber = dno group by dname;  

Retrieve the average salary of all female employees. F average salary (σ sex = ‘F’ (employee)) select average (salary) from employee where sex = ‘f’;