Wednesday, March 28, 2012

is this quick?

Hello to all first...As the subject says I am interested ist my DB quick
enough, or better is there a good buisness logic.the next query is executed
on C600,192 MB Ram, Seagate HDD, with 7IE's opened, OExpress and EMS MS
Manager in 14.90 sec.The query is for reporting a warehouse components of
some computer shop.There are 3200+ pieces of equipment and 21 categories on
which are basedcalculating of the price..The qry is based on two
tablesTblRabat 21 entries, used for calculating (I don't know the exact
english wordof the phrase) a final price for computer equipments1.22 Is for
a Total price + taxPkey here is autoinc int fieldTblKomponenteVPC is table
with computer equipment (3200+ entries).Pkey here is autoinc int fieldHere
is the
qry----
--SELECT TblRabat.Rabat,
TblKomponenteVPC.SifKomp, TblKomponenteVPC.SifKat, TblKomponenteVPC.naziv,
TblKomponenteVPC.Dobavljac, TblKomponenteVPC.Cijena AS VPC,
Round(TblKomponenteVPC.Cijena * tblRabat.rabat,2) as MPC,
Round(TblKomponenteVPC.Cijena * tblrabat.Rabat * 1.22,2) AS MPCsPDV,
TblKomponenteVPC.Opis, TblKomponenteVPC.Promjena,
TblKomponenteVPC.JamstvoFROM TblRabat INNER JOIN TblKomponenteVPC ON
(TblRabat.SifKat =TblKomponenteVPC.SifKat) AND (TblRabat.Dobavljac =
TblKomponenteVPC.Dobavljac)ORDER BY /*uvjetom i opisom*/CASE
TblKomponenteVPC.SifKat WHEN 'MON' THEN 1 WHEN 'CPU' THEN 2 WHEN 'MBO' THEN
3 WHEN 'MEM' THEN 4 WHEN 'VGA' THEN 5 WHEN 'VGA/MBO/Memorija' THEN 5 WHEN
'CAS' THEN 6 WHEN 'FDD' THEN 7 WHEN 'HDD' THEN 8 WHEN 'OP' THEN 9 WHEN
'FDD/ZIP/DAT' THEN 10 WHEN 'ZVUK' THEN 11 WHEN 'MULT' THEN 12 WHEN 'MOD'
THEN 13 WHEN 'KEYB' THEN 14 WHEN 'MOU' THEN 15 WHEN 'CABL' THEN 16 ELSE
99END /*case*/,TblKomponenteVPC.Opis /*kraj
ordera*/----
Sorry for a non formated qry..
here is final post
Hello to all first...As the subject says I am interested ist my DB quick
enough, or better is there a good buisness logic.the next query is executed
on C600,192 MB Ram, Seagate HDD, with 7IE's opened, OExpress and EMS MS
Manager in 14.90 sec.
The query is for reporting a warehouse components of
some computer shop.There are 3200+ pieces of equipment and 21 categories on
which are basedcalculating of the price..
The qry is based on two
tablesTblRabat 21 entries, used for calculating (I don't know the exact
english wordof the phrase) a final price for computer equipments
1.22 Is for a Total price + tax
Pkey here is autoinc int field
TblKomponenteVPC is table
with computer equipment (3200+ entries).
Pkey here is autoinc int field, FKEY is field TblRabat.SifKat
(Cathegory of equipment on which is base a rabate) which is
linked to TblRabat table.
Here is the qry:
SELECT
TblRabat.Rabat,
TblKomponenteVPC.SifKomp,
TblKomponenteVPC.SifKat,
TblKomponenteVPC.naziv,
TblKomponenteVPC.Dobavljac,
TblKomponenteVPC.Cijena AS VPC,
Round(TblKomponenteVPC.Cijena * tblRabat.rabat,2) as MPC,
Round(TblKomponenteVPC.Cijena * tblrabat.Rabat * 1.22,2) AS MPCsPDV,
TblKomponenteVPC.Opis,
TblKomponenteVPC.Promjena,
TblKomponenteVPC.Jamstvo
FROM
TblRabat
INNER JOIN TblKomponenteVPC ON (TblRabat.SifKat =
TblKomponenteVPC.SifKat)
AND (TblRabat.Dobavljac = TblKomponenteVPC.Dobavljac)
ORDER BY /*uvjetom i opisom*/
CASE TblKomponenteVPC.SifKat
WHEN 'MON' THEN 1
WHEN 'CPU' THEN 2
WHEN 'MBO' THEN 3
WHEN 'MEM' THEN 4
WHEN 'VGA' THEN 5
WHEN 'VGA/MBO/Memorija' THEN 5
WHEN 'CAS' THEN 6
WHEN 'FDD' THEN 7
WHEN 'HDD' THEN 8
WHEN 'OP' THEN 9
WHEN 'FDD/ZIP/DAT' THEN 10
WHEN 'ZVUK' THEN 11
WHEN 'MULT' THEN 12
WHEN 'MOD' THEN 13
WHEN 'KEYB' THEN 14
WHEN 'MOU' THEN 15
WHEN 'CABL' THEN 16
ELSE 99
END /*case*/,
TblKomponenteVPC.Opis /*kraj ordera*/
Any comments...

No comments:

Post a Comment