You are on page 1of 1

select p_desc, cost from product where cost between 200 and 400;

select m_name from manufact where PATINDEX('%O%', m_name)=1; select m_name from
manufact where m_name like 'O%';
select m_name from manufact where m_name like '[A-M]%';
select p.p_desc, s.qty from product p, sale s where p.p_desc='desc lamp' and s.d
ata between '02/01/2011' and '02/15/2011' and p.p_id=s.p_id;
select p.p_desc, s.qty from product p, sale s where p.p_desc='desc lamp' and dat
epart(ww, s.data)=8 and datepart(yy, s.data)=2011 and p.p_id=s.p_id;
select p.p_desc from product p, manufact m, country cn where cn.country like 'Ni
geria' and cn.cn_id=m.cn_id and m.m_id=p.m_id;
select c_name from customer where c_id in (select c_id from sale where p_id in (
select p_id from product where m_id in (select m_id from manufact where cn_id in
(select cn_id from country where country like 'Peru'))));
select c_name from customer where c_id in (select c_id from sale where sp_id in
(select sp_id from sperson where sp_name like 'Rodny Djons'));
select sp1.sp_name from sperson sp1, sperson sp2, customer c, country cn, sale s
where sp1.sp_id=sp2.man_id and sp2.sp_id=s.sp_id and s.c_id=c.c_id and c.cn_id=
cn.cn_id and cn.country like 'Japan';
select p_desc, cost old_value, cost*1.2 new_value from product;
select p.p_desc denumire_produs, m.m_name producator, m.m_address adresa from pr
oduct p, manufact m where p.m_id=m.m_id;
select m.m_name Producator, m.m_address Adresa, cn.country Tara_origine, p.p_des
c Denumire_marfa, p.cost Cost_achizitie from product p, manufact m, country cn w
here cn.country like 'Peru' and p.p_desc like 'Desc lamp' and
m.m_id=p.m_id and m.cn_id=cn.cn_id;
select s.c_id client_id, count(s.c_id) numar_comenzi, sum(s.qty*p.price) suma_co
menzilor from sale s, product p, customer c where s.c_id=c.c_id and s.p_id=p.p_i
d group by s.c_id;
select sp_name, sp_id from sperson where sp_id in (select sp_id from sperson exc
ept select sp_id from sale);
select p.p_desc, s.qty, s.data old_date, eomonth(s.data) new_date from sale s,
product p where s.p_id=p.p_id and qty>15;

You might also like