SQL-lab Download sql script file sailors.txt

Slides:



Advertisements
Similar presentations
Classwork notes. 2 Find the names of all employees whose salary greater than all managers salary.
Advertisements

Fundamentals of Database Systems Fourth Edition El Masri & Navathe
Step By Step Lei Yang Computer Science Department.
Review Session Monday, Oct 8 Shipra Agrawal. Announcements New Gradiance assignment deadline Wednesday, Oct 10 Please read FAQs for assignments.
MySQL. To start go to Login details: login: labuser password:macimd15 – There.
COP-5725 Practice Exercises
6.830/6.814 Lecture 5 Database Internals Continued September 17, 2014.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 6 (Continued) The Relational Algebra and Calculus.
SQL Lecture 10 Inst: Haya Sammaneh. Example Instance of Students Relation  Cardinality = 3, degree = 5, all rows distinct.
DatabaseDatabase cs453 Lab8 1 Ins.Ebtesam AL-Etowi.
Overview Begin 6:00 Quiz15 mins6:15 Review Table Terms25 mins6:40 Short Break10 mins6:50 SQL: Creating Tables60 mins7:50 Break10 mins8:00 Lab – Creating.
AGGREGATE FUNCTIONS Prof. Sin-Min Lee Surya Bhagvat CS 157A – Fall 2005.
Set operators (UNION, UNION ALL, MINUS, INTERSECT) [SQL]
Copyright  Oracle Corporation, All rights reserved. 6 Writing Correlated Subqueries.
Employee database: Conceptual Schema in ERD Chapter 3, page 62.
Constraints We have discussed three types of integrity constraints: primary keys, not null constraints, and unique constraints. CREATE TABLE Movies ( title.
Writing Basic SQL Statements
Work-in dept DID emp salarynames manage names EID Can be Pkey Solution for the Quiz –Problem 1.
Chapter 3 An Introduction to Relational Databases.
CS 104 Introduction to Computer Science and Graphics Problems Introduction to Database (2) Basic SQL 12/05/2008 Yang Song.
Murali Mani SQL DDL and Oracle utilities. Murali Mani Datatypes in SQL INT (or) INTEGER FLOAT (or) REAL DECIMAL (n, m) CHAR (n) VARCHAR (n) DATE, TIME.
Jyh-haw Yeh Dept. of Computer Science Boise State University
©Silberschatz, Korth and Sudarshan3.1Database System Concepts - 6 th Edition SQL Schema Changes and table updates instructor teaches.
Seminar #3 CM036: Advanced Databases1 Seminar 4: Relational Algebra and its Simulation using SQL Purpose To understand how the relational operations are.
5.3. Querying a Database SQL -> DDL, DML. SQL Structured Query Language – industry standard supported by all significant relational databases. First SQL.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
Creating a Table Create a table, “emp”, containing: –empno – a 4 digit employee number –ename – up to 10 character string –job – up to 9 character string.
On the Semantics of R2RML and its Relationship with the Direct Mapping Juan F. Sequeda Research in Bioinformatics and Semantic Web (RiBS) Lab Department.
ACTION QUERIES (SQL COMMANDS ) STRUCTURED QUERY LANGUAGE.
SQL FUNDAMENTALS SQL ( Structured Query Language )
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Basic SQL These slides are licensed under.
SQL Basics. What is SQL? SQL stands for Structured Query Language. SQL lets you access and manipulate databases.
Advanced Database CS-426 Week 1 - Introduction. Database Management System DBMS contains information about a particular enterprise Collection of interrelated.
SQL SeQueL -Structured Query Language SQL SQL better support for Algebraic operations SQL Post-Relational row and column types,
Prince Sultan University Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
SQL 연습 2 pp SQL 연습 데이터베이스시스템 2 Data (EMPL & DEPT) p.194 EmpNoEmpNameTitleManagerSalaryDNO 조민희과장 김상원사원
COMP3030 Database Management System Final Review
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Relational State Assertions These slides.
SQL Exercises – Part I April
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Collection Operators These slides are.
COP-5725 Practice Exercises
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Grouping These slides are licensed under.
ORDER BY clause in SELECT command: Normally, the result of the query will not be in ordered format. If we want to get the result of the query in specific.
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Collection Operators These slides are.
Seminar #6 CG096 Advanced Database Technologies1 Advanced Databases Seminar 6: Implementing Relational Algebra Data Model using SQL.
Lecture 2 Joins and sub-queries. 2 Topics zJoins ySimple; Outer zSub-queries yaliases zIN Operator zNULL values zSaving and running files.
Fan Qi Database Lab 1, com1 #01-08 CS3223 Tutorial 8.
Advanced SQL. SQL - Nulls Nulls are not equal to anything - Null is not even equal to Null where columna != ‘ABC’ --this will not return records where.
The SQL Database Grammar
Chapter 3 Introduction to SQL
Chapter 3 Introduction to SQL(2)
CS 480: Database Systems Lecture 13 February 13,2013.
Database Management Systems (CS 564)
DATABASE SQL= Structure Query Language مبادئ قواعد بيانات
Interacting with the Oracle Server
Generalization.
Writing Correlated Subqueries
IS 220 Databases Fundamentals
SQL Views CS542.
جملة الاستعلام الأساسية
CS 140 Lecture Notes: Protection
CS 140 Lecture Notes: Protection
EXAMPLE Emp table: SS# Name Age Salary dno 1 Joe Mary 20
CS 140 Lecture Notes: Protection
Dynamic SQL Example declare l_depnam varchar2(20) := 'testing'; l_loc varchar2(10) := 'Dubai'; begin execute immediate 'insert into dept values (:1,:2,:3)'
ISC321 Database Systems I Chapter 4: SQL: Data definition, Constraints, and Basic Queries and Updates Fall 2015 Dr. Abdullah Almutairi.
Programming with data Lab 8
Session - 6 Sequence - 1 SQL: The Structured Query Language:
Introduction to Relational databases
Practice Project Practice to know SQL
Presentation transcript:

SQL-lab Download sql script file sailors.txt Create and populate those tables Try the following queries: Q1, Q12, Q21, Q26, Q31, Q32

Lab Exercise 1 Map ER to relation tables Populate table Employee int, varchar2(20), decimal(10,2) 22,'Dustin',10000.0 23,'Bob',15000.0 24, 'Dustin',20000.0 Department 101,'cs','keenedy‘ 102,'ee','smith‘ Workin int, int, date 22,101,'10-OCT-98‘ 22,102, '10-JAN-99‘ 23,102,'15-OCT-98’ 24,101, '10-OCT-01‘ stime salary ename eid dname did daddress workin Employee Department Map ER to relation tables Populate table Q1 “find the name of employees who work at cs dept” Q2 “find the name of emplyees who have not worked at dept 101” 6

Lab 2 Please insert more tuples Q3 “find the average salary of employees” Q4 “find the average salary of employees for each dept.” Q5 ”Find the average salary of employes for each department that has at least 3 SUCH employees” Q6 “find the average salary of employees whose salary is above 9000” for each department that has at least three SUCH employees. Employee 3,‘Alice',8000.0 4,‘Mike',7000.0 5, ‘Alex',10000.0 6,’David’,20000.0 Department 103,‘sis',‘carc‘ Workin 3,103,'10-OCT-00‘ 4,103, '10-JAN-00‘ 5,103,'15-OCT-00’ 6,102, '10-OCT-01‘