Download presentation
Presentation is loading. Please wait.
Published byFarida Budiman Modified over 5 years ago
1
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
2
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;
3
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’ );
4
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’ );
5
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
6
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
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.