You are on page 1of 2

--cau1

select idloai

from may

where idmay ='p8';

--cau2

select tenpm

from phanmem

where idloai ='UNIX';

--cau3

select phong.tenphong, phong.ip, phong.MP

from phong, may

where phong.MP = may.MP and (idloai = 'UNIX' or idloai = 'PCWS');

--cau4

select phong.tenphong, phong.ip, phong.MP

from phong, may

where phong.MP = may.MP and (idloai = 'UNIX' or idloai = 'PCWS') and may.ip='130.120.80'

order by MP;

--cau5

select count(*)

from Caidat

where idmay='p6';

--cau6

select count(*)

from Caidat

where idPM='log1';

--cau7
select IP || '.' || ad AS new_value

from may

where idloai = 'TX';

-- cau8

select avg(gia)

from phanmem

where idloai='UNIX';

--cau9

select tenphong

from phong, phanmem, may, caidat

where may.idmay = caidat.idmay and phanmem.idpm = caidat.idpm and Phong.MP = may.MP and phanmem.tenPM
like 'Oracle%';

--cau10

select tenPM

from Phong, may, Caidat, Phanmem

where Phong.MP = may.MP and may.idMay = Caidat.idMay and Phanmem.idPM = Caidat.idPM and tenphong = 'Salle
1';

--cau11

select tenPM, ngaymua

from Phanmem

where ngaymua between to_date('1997-01-01', 'YYYY-MM-DD') and to_date('1997-12-31', 'YYYY-MM_DD');

-- cau 12

select distinct tenPM, a.idLoai, a.gia

from Phanmem a, Caidat b, Loai c, May d

where a.idPM = b.idPM and a.idLoai=c.idLoai and b.idMay=d.idMay

and gia >=2000;

You might also like