-- P:\data\Yeslam\ITC114\Chp3>
-- [Link] [Link]
-- [Link]
operators-and-their-sql-translations/
-- [Link]
-- [Link]
.headers on
.mode column
.separator ,
.output [Link]
select * from PROFESSOR;
select * from STUDENT;
select * from booth;
select * from machine;
.print "______________________________________________"
-- Union
.print "This is Union"
select * from booth union select * from machine;
.print "______________________________________________"
-- Intersect
.print "This is intersect"
select booth_price from booth intersect select machine_price from machine;
.print "______________________________________________"
select booth_price, booth_product from booth intersect select machine_price,
machine_product from machine;
.print "______________________________________________"
-- Except (Minus)
.print "This is Except (Minus)"
select * from booth except select * from machine;
.print "______________________________________________"
-- Product
.print "This is Product"
select * from booth, machine;
.print "______________________________________________"
-- ------------------------
-- a natural join
.print "This is natural join"
select * from professor natural join student;
.print "______________________________________________"
select stu_code, prof_code from professor natural join student;
.print "______________________________________________"
--inner join
.print "This is inner join"
select * from student inner join professor on
student.prof_code=professor.prof_code;
.print "______________________________________________"
select stu_code from student inner join professor on student.prof_code=
professor.prof_code;
.print "______________________________________________"
-- equijoin
.print "This is equijoin"
select * from student join professor on student.prof_code=professor.prof_code;
.print "______________________________________________"
select * from student, professor where student.prof_code=professor.prof_code;
.print "______________________________________________"
-- where condition
select * from student, professor where student.prof_code=professor.prof_code;
.print "______________________________________________"
-- outer join
.print "This is outer join"
select * from student left join professor on student.prof_code=professor.prof_code;
.print "______________________________________________"
-- Left Join
select * from student left join professor on student.prof_code=professor.prof_code;
.print "______________________________________________"