Dbms 5

You might also like

You are on page 1of 1

////Operators

select E_name,E_spec from equipment where E_purchase_date IS NOT NULL;


select E_name from Equipment where E_purchase_date BETWEEN '11 jan 2014' AND'31
dec 2014';
select E_name from Equipment where E_purchase_date IN('11 jan 2014','31 dec 2014
');
select L_name,D_no from LAB where L_area='Floor 3' AND L_no=1;
select L_name from LAB where L_area='Floor 3' or D_no=5;
select E_name from Equipment where Upper(E_name) LIKE 'I%';
select E_name,E_spec from Equipment where E_warranty > '1 yr';
select E_name from Equipment where E_purchase_date IS NULL;
select S_name from Staff where lower(S_name) LIKE '___s%';
select contact_no from Contact where S_no IN (1,5);
/////Order By
select E_name from Equipment order by E_purchase_date DESC;
select L_name from LAB order by L_area ASC;
////SET Operators
select S_name from Staff
UNION
select S_name from contact_2;
select S_no,S_name from Staff
UNION ALL
select S_no,S_name from contact_2;
select S_name from Staff
INTERSECT
select S_name from contact_2;
select S_name from contact_2
MINUS
select S_name from Staff;
//////Aggregate,Group By , Having
select count(E_no) AS TotalEquipment from Equipment;
select E_name,count(E_no) from Equipment where E_spec='IBM' group by E_name;
select E_name,count(E_no) from Equipment where E_spec='IBM' group by E_name hav
ing count(E_no) = 1;
select E_name,count(E_no) from Equipment where E_purchase_date > '15 oct 2013' g
roup by E_name ;
///////Date , String , Number , Conversion Functions
select
select
select
select
select
t ;
select

add_months(E_purchase_date,5) AS DateAfter_5_months from Equipment;


upper(S_name)AS StaffName from Staff where length(S_name)=20;
CONCAT(L_no,S_name) AS SName_No from Staff where S_type='L_Assistant';
to_char(E_purchase_date,'yyyy') AS YearPurchase from Equipment;
NVL(E_purchase_date,'11 oct 2011') AS NULL_Replace ,E_name from Equipmen
upper(D_name) AS Name,upper(D_hod) AS HOD from Department;

You might also like