SQL – Select query Waq to display the employees with no commission.

Slides:



Advertisements
Similar presentations
Using the Set Operators
Advertisements

WHERE Clause Chapter 2. Objectives Limit rows by using a WHERE clause Use the LIKE operator Effect of NULL values Use compound conditions Use the BETWEEN.
2 Copyright © 2007, Oracle. All rights reserved. Restricting and Sorting Data.
Multiple-Column Subqueries. Objectives After completing this lesson, you should be able to do the following: Write a Multiple-column subquery Describe.
Writing Basic SQL SELECT Statements. Capabilities of SQL SELECT Statements A SELECT statement retrieves information from the database. Using a SELECT.
1 Copyright © Oracle Corporation, All rights reserved. Writing Basic SQL SELECT Statements.
WRITING BASIC SQL SELECT STATEMENTS Lecture 7 1. Outlines  SQL SELECT statement  Capabilities of SELECT statements  Basic SELECT statement  Selecting.
Ceng 356-Lab1. Objectives After completing this lesson, you should be able to do the following: Get Familiar with the development environment List the.
Objectives After completing this lesson, you should be able to do the following: Define subqueries Describe the types of problems that the subqueries.
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.
Samples of Projects which I participated in…
7 Multiple-Column Subqueries. 7-2 Objectives At the end of this lesson, you should be able to: Write a multiple-column subquery Describe and explain the.
SQL-5 (Group By.. Having). Group By  Need: To apply the aggregate functions to subgroups of tuples in a relation, where the subgroups are based on some.
Introduction to SQL PART Ⅰ 第一讲 Writing Basic SQL SELECT Statements.
Copyright © 2004, Oracle. All rights reserved. Lecture 4: 1-Retrieving Data Using the SQL SELECT Statement 2-Restricting and Sorting Data Lecture 4: 1-Retrieving.
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.
An Introduction To SQL Part 2 (Special thanks to Geoff Leese)
1 Information Retrieval and Use (IRU) An Introduction To SQL Part 2.
1 Copyright © Oracle Corporation, All rights reserved. Writing Basic SQL SELECT Statements.
Subqueries.
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.
In this session, you will learn to: Query data by using joins Query data by using subqueries Objectives.
Rules of Precedence The rules of precedence determine the order in which expressions are evaluated and calculated. The next table lists the default order.
Simple Queries DBS301 – Week 1. Objectives Basic SELECT statement Computed columns Aliases Concatenation operator Use of DISTINCT to eliminate duplicates.
Writing Basic SQL SELECT Statements Lecture
1 Copyright © 2007, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement.
Oracle 10g Retrieving Data Using the SQL SELECT Statement.
1 Copyright © 2009, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement.
Using Subqueries to Solve Queries
Retrieving Data Using the SQL SELECT Statement
Multiple-Column Subqueries
DML – INSERT COMMAND TABLE - EMPLOYEE ID NAME PLACE DOB SALARY 1 ARUN
Chapter 1 Introduction.
Basic select statement
Comparison Operators Relational Operators.
Subqueries.
Displaying data from 2 tables
Group Functions Lab 6.
Using the Set Operators
Using Subqueries to Solve Queries
Assignment 2 Due Thursday Feb 9, 2006
Generalization.
Writing Basic SQL SELECT Statements
Using the Set Operators
الفصل الثاني الصيغة العامة لجمله select*
Aggregating Data Using Group Functions
Chapter 1 Introduction.
Restricting and Sorting Data
Displaying Queries 2 Display a query’s results in a specified order.
DATABASE SQL= Structure Query Language مبادئ قواعد بيانات
Using Subqueries to Solve Queries
SQL Subquery.
Writing Basic SQL SELECT Statements
Dead Patients Visiting
Writing Basic SQL SELECT Statements
Lecture 3 Finishing SQL
Chapter 1 Introduction.
Using Subqueries to Solve Queries
Using Subqueries to Solve Queries
Using the Set Operators
Subqueries Schedule: Timing Topic 25 minutes Lecture
Aggregate functions Objective- understand and able to use aggregate functions in select statement Aggregate functions are used to implement calculation.
Topic – select statement with ‘between’, ‘not between’ , ‘like’ operators Objective: 1) Able to use between’, ‘not between’ , ‘like’ operators in ‘select’
Topic - DML - Select statement
‘ORDER BY’ Order by clause allows sorting of query results by one or more columns. Sorting can be done in ascending or descending. Default order is ascending.
Uniform Companies in Dubai
Database Programming Using Oracle 11g
Restricting and Sorting Data
MySQL SQL for MySQL (I) Salim Mail :
Presentation transcript:

SQL – Select query Waq to display the employees with no commission. ‘IS NULL ‘ Operator ID NAME SALARY comm 1 ARUN 6000 500 2 VARUN 8000 3 ALI 9000 300 4 GEORGE 12000 5 MOHD 250 Waq to display the employees with no commission. output Select * from employee where comm is null; ID NAME SALARY comm 2 VARUN 8000 4 GEORGE 12000

SQL – Select query Waq to display the employees with commission. ‘IS NOT NULL ‘ Operator ID NAME SALARY comm 1 ARUN 6000 500 2 VARUN 8000 3 ALI 9000 300 4 GEORGE 12000 5 MOHD 250 Waq to display the employees with commission. output ID NAME SALARY comm 1 ARUN 6000 500 3 ALI 9000 300 5 MOHD 8000 250 Select * from employee where comm is not null;

SQL – Select query employee ‘IN’ Operator ID NAME place 1 ARUN Dubai 2 VARUN Sharjah 3 ALI 4 GEORGE Ajman 5 MOHD Al ain WAQ to display the details of employees from Dubai, Sharjah and Ajman. output ID NAME place 1 ARUN Dubai 2 VARUN Sharjah 3 ALI 4 GEORGE Ajman Select * from employee where place IN (‘ dubai’, ’sharjah’,’ ajman’ );

SQL – Select query employee ‘ NOT IN’ Operator ID NAME place 1 ARUN Dubai 2 VARUN Sharjah 3 ALI 4 GEORGE Ajman 5 MOHD Al ain WAQ to display the details of employees not from Dubai, Sharjah and Ajman. output ID NAME place 5 MOHD Al ain Select * from employee where place NOT IN (‘ dubai’, ’sharjah’,’ ajman’ );

Putting text in a query output Select name, ’gets commission’ , comm from employee where comm is not null; employee output ID NAME SALARY COMM 1 ARUN 6000 500 2 VARUN 8000 3 ALI 9000 300 4 GEORGE 12000 5 MOHD 250 NAME GETSCOMMISSION COMM ARUN gets commission 500 ALI 300 MOHD 250

Comparison between ‘having’ and ‘where’ clauses Having clause Where clause ‘Having’ clause sets conditions on groups ‘having’ conditions include aggregate functions ‘Where’ clause sets conditions on individual rows. ‘where’ conditions can not include aggregate functions