" DVD-" Microsoft SQL Server 2008 Express

, . . . . .

,
03.07.2011
1,1 M

. ,

, , , , .

http://www.allbest.ru/

http://www.allbest.ru/

AOA

cooc c poo o aa a pcac coooc a, a oop o oc opa, opp pa poo ap pooo cc. poo o opa a oa a a opo-oc apap. o poo o a ca c coo caca oac cc a a . oa. o oo po o a aco aa o oa.

po o a a c o a. o a pca coo oco cpp a, opa ococ opa apoa a. C oo o a o pca o po oac aoc .

O aa ocooc po cc coco o, o pao o oo apoca aa c a aa, oop oo copa / o oo oopo oo o o apoc.

ao pcoo po a papaoaa aa a C Microsoft SQL Server 2008 Express aoapoaoo a o- ao- apao, poca oa caaop oa. popaa, paoaa c , oo c oacc, ao co, DVD ..

popaa papaoaa caaop oa.

ooa ca cac caaop oa. oca ooo c ooa apo.

1. OCOA PO OAC

1.1 O oca po oac

o opoa copoo pp ooo p opao cc. aa poa aaa a p pp, a pp cpo a aoo ca. opao cc p cc o o caap pa popa. acoc o po oac opao cc o co paac o co app .

p papao a a oa o poo ocoa po oac.

Oco opa cco oac c ac opa o pacoaa o- ao- apaa oc opa.

o- ao- apao ocaoo oo oco oc oo po oa pcac coo aa, oo ocoo aoo pcooo poa c aoapoa c o pocc, o copa p opaopa a opao a.

1.2 Oca o oo coo

pa oa coc c o a:

opa o apo,

opa o apa,

opa o oc opa,

opa o aop,

opa o cpaa, poo.

1.3 Oca o oo coo

o a c o apoc, op. opa oc a pa ca opa, poa pao c ac a .

1.4 Cco opa

popo a a ooo coa a a ooa: opaop oc. oco oa oooc oo pocapa a, o .

2. POPOA POO A A

2.1 ooca o a a

oocoo popoa - oc ao cc oa cocoo copa pca o opa, oop poaac pa coao . oo ooc o ac cpo o aao c cc o. Oco ocp a ooc o c coc, c coca.

2.1.1 Oca coc

cooc c oca po o c coc:

apo - pac opa o apo;

Cpaa - pac opa o cpaa;

ap - pac opa o apa;

oc - pac opa o oc opa;

aop - pac opa o aop.

ap:

1. aa video (apo) cop:

video_id- a o apo;

video_name-aa apo;

rate -opa o p;

year. -opa o o ca;

category_id- a o ;

storage_id- a o ooo paoc poa;

country_id- a o cpa apoa;

janr_id - a o apa.

2. aa country (Cpa) cop:

country _id - a o cpa;

country _name- aa cpa;

3. aa category (aop) cop:

category _id - a o ;

category _name- aa ;

4. aa janr (ap) cop:

janr _id - a o apa;

janr _fio -a apa.

5. aa storage (oc) cop:

storage_id - a o oa poa;

storage_name- aoa ooo paoc oa.

2.1.2 Oca c

C - accopoa o coc. c aa o oo pa o, ca coo a, o cppa oa o poco. Oao oo oco poa opaa a a - o oc oooc oca o coc o aa p, o ooo cao op c.

o coc - c ocoaa a cooa 3- oco ocp a:

1. Coc.

2. Ap.

3. C.

aoc aa o poa o c oco a:

Oo o oo (1:1) oaa, o aa ac oo a cooc oo oo ac po a;

Oo o o o (1:) oa, oa oa ac aocaa co o p;

Oo o oo oaa, o o ac ca c oo (:1);

Oo o o o (M:N) oa aa ca, oa:

Oa ac po a o caa o c oo ac opo a;

Oa ac opo a o caa o c oo ac po a.

ocao ao o c o, o o o ca oopo ac coc, ac apa, ac c. ao ca, ca, o a o o ca oo ac ooo ocpoo a. Ca o coc-c pa po A.

pcoo pao cooa c c (aa 3.1):

aa 3.1 - acca c

op c

Poca aa

op aa

c

1

janr

video

1:M

2

country

video

1:M

3

category

video

1:M

4

storage

video

1:M

aa 3.1 oaa acca c aa. C o opo o, aa janr - video.

O ap o pa co. opa c country - video 1:M. Oa cpaa-poo o pa co.

p c category -video

Oa aop o pa co.

pa c storage - video aa a o, o o oo co ooo a oc.

2.1.3 ER-apaa

a pc 3.1 pcaa ER-apaa a a.

http://www.allbest.ru/

http://www.allbest.ru/

Pco 3.1 - ooca o (ER-apaa)

2.2 aaoca o

a pcac p a, a oop ocac pao opo-oc opa (o, pc, paoc apoo po) ca po opa (c, po, co ).

cooa o ooo coa a ca po a a, a cc pa po aa a.

cppo ac o cpc, o co cppo a, coo po , c opaoao n-apo oo. aoo ac o pac a aa aa apoa po - poa apa poo cc. p a apc ocoo a accco op oc, a opo - a accco oco aapa cc pao poo opa.

papaoao a a oa cc c oa acoc apa:

aa 3.2 janr (ap)

aoa apo

oa

acoc

janr_id

janr_fio

aa 3.3 video (apo)

aoa apo

oa

acoc

video _id

video _name

rate

year

category_id

storage_id

country_id

aa 3.4 country (Cpaa)

aoa apo

oa

acoc

country _id

country _name

aa 3.5 category (aop)

aoa apo

oa

acoc

category _id

category _name

aa 3.6 storage (oc)

aoa apo

oa

acoc

storage_id

storage_name

o c aa ap pao ac o poo a ac coo.

cooa co oo:

- Ooao poa ac;

- a poa a o;

- o coppo a;

- cop opa oca aa;

- caaa c o aa .

- p op ococ a ocac paoc cco aa.

aa 3.7

aa

a

video

janr_id

regular

video

country_id

regular

video

storage_id

regular

video

category_id

regular

video

video_id

primary

janr

janr_id

primary

country

country_id

primary

category

category_id

primary

storage

storage_id

primary

po opaa oo. opaa - o pa a a o, oaa coca p , a a.

op opaa cc opa op a. op paa oo opa o po o o opao op. oo aa oca oa oop poa p op oop oo co.

po opaa c coc.

aa po p, o c a c apo aoap. p coa, a ap oo o pa oo-co a c cco, oco a. c a aoc po opao op, a a c ap aoap.

a opao, oo caa, o c a aoc po opao op.

aa aoc o opo , c oa oop co po , a p ap ooc oao ac o a. c a aoc o opo opao op, a a occ coca .

aa aoc p , c oa oop co opo , a p ap pao ac o a.

p coa o pc oo 3, ooo cpa oa acoc apa oo. p coa, a, pa a, o ac oo o a.

a a 4.1 aoo pcooo poa o opoo poaapoaa aa a, pao acoc o o, oo ca o, o c a aoc p opao op, a o ap aa pao ac o poo a.

p p pac aa oc ca p opaa opa c ocaoo. pocc popoa poo a a, a pao, aaac p p opao op. aa o ac a p po c opa opaa.

p coca a . aoo o a ooo aa pap o (oco coo), . p ooo c ap op a. oca o oooc apa op a opc cao po oac.

aa 3.8 Janr

aoa apo

o

Pap o

ococ

op a

janr_id

Integer

4

Not null

janr_fio

Varchar

50

aa 3.9 Video

aoa apo

o

Pap o

ococ

op a

video_id

Integer

4

Not null

video_name

Varchar

8

rate

Integer

4

year

Integer

4

category_id

Integer

4

storage_id

Integer

4

country_id

Integer

4

aa 3.10 Country

aoa apo

o

Pap o

ococ

op a

country_id

Integer

4

Not null

country_name

Varchar

50

aa 3.11 Category

aoa apo

o

Pap o

ococ

op a

category_id

Integer

4

Not null

category_name

Varchar

50

aa 3.12 Storage

aoa apo

o

Pap o

ococ

op a

storage_id

Integer

4

Not null

storage_name

Varchar

50

3. OPAA OP OPA A A

O ao pca cocoo op a a a a c cooa apoco SQL.

papaoao a a pcop c apoc:

1. poca opa

SELECT *FROM country

SELECT *FROM video

SELECT *FROM storage

SELECT *FROM janr

SELECT *FROM category

2. opa c a

SELECT COUNT(*) as count_, country_name FROM video_view

3. opa c co

SELECT * FROM video_view WHERE video_id = ident

4. opa c opo

SELECT * FROM video_view order by country_fio

5. opa c cooa opaopa BETWEEN

SELECT * FROM video_view WHERE

date_video between thisform.Text1.Value AND thisform.Text2.Value

6. opa c cooa aoo

SELECT *FROM video_view WHERE janr_fio like %+str+%

SELECT *FROM video_view WHERE country_fio like %+str+%

7. opa ca a

Select video.*, country.date_video

FROM country , video

Where Country.country_id = Video.country_id

8. cooa ppo a p opaa apoco

SELECT COUNT(*) as count_, category_name FROM video_view

GROUP BY category_name

9. opa c cooa ccoo co

Select video.*, country.country_name

FROM country

INNER JOIN video

ON Country.country_id = Video.country_id

10. opa c cooa o co

Select video.*, category.category_name

FROM category

left JOIN video

ON category.category_id = Video.category_id

apoc a poo ap

Ooa: - po; - c.

1. coa opa a

(1,2,3) (country)

(1,2,3,4,5,6,7,8) (video)

(1,2) (storage)

(1,2) (janr)

(1,2) (category)

2. opa c a

count(*),janr_fio (group by janr_fio) (video_view)

3. opa c co

video_view.* (video_id = ident)(video_view)

4. opa c opo

video_view.*(Order By country_fio)( video_view)

5. opa c cooa opaopa BETWEEN

(1,2,3,4,5,6,7,8) (rate Between Value And value )( video_view)

6. opa c cooa aoo

(1,2,3,4,5,6,7,8) (janr_name like % +str+%) (video_view)

7. opa ca a

video.*, country.country_name (video.country_id=country.country_id) (country, video)

8. cooa ppo a p opaa apoco

count(*),category_name (group by category_name (video_view)

9. opa c cooa ccoo co

video.*, country.country_name (video.country_id=country.country_id) (country inner join video)

10. opa c cooa o co

video.*, category.category_name (video.category_id=category.category_id) (category left join video)

4. PAPAOA PCA OOPA PAO OP

opa aoc a a aoc cpppoaoo . ooo pca a ooa C Microsoft SQL cpp c oooc coaa pca. coa oo ocooac acpo coa pca (pc 5.1).

Pco 5.1 Coa pca MS SQL Server 2008

ao pcoo po o coao pca op pacca Caoo VIDEO_VIEW.

a coa pca oo cooa Transact SQL - cpo popapoa Microsoft SQL Server. a pc 5.2 pca o coa pca a T-SQL.

Pco 5.2 - pca VIDEO_VIEW

5. POPOA PA POP

pa pop - o popa o, o a copo cppa a a. cooa pa pop oo ooo cooa aapa pcpca cppa pap c ac popaoo oca.

pco cooa pa pop apoco a a c o ococo, o SQL - apoc, o pao popo, oopoa o coca a o. ao apoc oc aoo cp, po apoc po

ao pcoo po paoaa paa popa, opaaa cco po o aao ap. pa pop C Microsoft SQL Server coac a Transact SQL. a pc 6.1 pca o paoao pop.

Pco 6.1 - co o pao pop

6. Papaoa ao pa a a p oo ppo

pp - o oco pa pco pop. pp a coac a popapoa C, oao ac occ ca cpp a a a pa a oo c co: oa, a oo a.

ao pcoo po pp coc opa ococ a

6.1 pp oa a

pp oa a coa ao a. ca ca ac c c aopo pp a o. paa oaac. o ooo ppo p a pc 7.1.

Pco 7.1 - pp a ca

6.2 pp a a

pp a a a papaoa c a. a pp oo opa ococ a. pp pop cc a ca a. c a a ac c cca po a, oc oa. paa oaac. o ooo ppo p a pc 7.2.

Pco 7.2 - pp a a

6.3 pp oo a

Paoa ppa oo a aaoa pao ppa a ca (pco 7.3).

Pco 7.1 - pp a oo

7. Papaoa oo oca a a

7.1 op ooa a a

C SQL Server oaa cpca ooa a a, opo oa acppoa oca a.

aa a a po C oc cpca a ooa c oo o apo.

coa ooo ooa acpaop Microsoft SQL Server ooo coa oa pa oacoc (pco 8.4).

7.2 Papa ooo ooa

papa ooo a a coa po: acpaop oc (pco 8.2). po cao cooc opa pap.

papa ooo ooa ocaoo cooc o c oo po (pco 8.3).

8. popoa coo po

po papaoao a aop .Net Framework, popapoa C#.

ooac pc popa o ooooo po (Single Document Interface). p ac popaa oc a (pco 9.1) a ao oo (pco 9.2).

a o ao op c aa, oopo copc pacca Caoo.

Pco 9.1 - a ooa

pa a po opaoa ao popa a cpo. a cpo oca aa pa a ao a aoo .

Pco 9.2 - ao oo popa

aoo cpaoa ao po paoaa oa opa, oao oao cpao paoa oaoo.

po paoa cpao: ap, Cpa, oc, aop.

a op oo cpaoa pacoo : aa, oopo oc ac cpaoa a pa cpaoo.

p ap op aoc aa, caa c coo a. ooa o papoa a a. occ a a o p ap op.

oa papoa a coc oo BindingNavigator.

ac occ o oo DataGridView, oop oc. a ao op op a ca a occc c oo o a DataGridViewComboBoxColumn.

a ao op oo pacaa. a paoaa c cooa po Microsoft Excel. Paa oa p oo oo oo ca, o oo ac o pc Microsoft Excel.

oc a o p oo BindingSource, oop ca c ao a. a a a oo p po Microsoft Excel.

9. Opaa oa a cppo ac c po

po papaoao c cooa oo ADO.NET, oo o a a oo c oo oa acca OleDBConnection.

o a a oop p papaoa cac acc DB. o opa c ao a oo o oa DB.DoConnection(). o o poo o a a opaa true, c o oo, false poo ca.

oa DB.DoConnection() ooa cpoa o. oca acppoa popa coa a connect.udl - caap a Ratedows oca a. ac o, acpaop popa o pa a a (pco 10.1 - 10.2).

Oca o o oc c coc pac o c acca po

o opa c ao a po coc oo TableAdapter. oo c apap Connection. pcaac a DataBase.MainConnect.

pao c oa a a papaoa acc Data_Set. a acc ooc coa c oo acpa. O a TableAdapter coa aoac p paca coa a (pco 10.3).

10. ooco oocoa pao p popaoo poa

oocoo oocoa ooo poa c pacca poaapoa apa, oo coa aoapoao opaoo cc; cooca apa a coa opoa aoapoao opaoo cc c paa oa ; op co cpo oaoc apa; o p pp, a oopo op aa aoapoaa opaoa cca. a pa, oaa coopaoc coa pa aoapoao opaoo cc.

ooca oc poa caac coca:

- ocoo a, oop, apapc p, p oo ca o, oc caooo opaoo oca op opa a, poo cp oc a o apoca ..

- poo a, oop apapc c po, cooc oaa.

op apa ooo pacca c ca pacoa:

) ocoa apaoa aa pcoaa;

) ooa apaoa aa;

) oc a coa ;

) apa a op pop;

) paco a apa aac ac;

) apa a co oca po co .

acoa apa caa popaca

p. (11.1)

acoa apa caa opaopa

p. (11.2)

o paoo p p coa opaoo occ

t = 1,15(16 + 135,6 + 101) = 1,15252,6 = 290,49 . (11.3)

Ocoa apaoa aa c o oa opppo pa aco cao popaco

O = (16 + 135,6 + 101)*0,8*44,79 + (30,0 + 48,47 + 98,65)*0,8*31,29 = 9029,67+4433,66 = 13463,34 (11.4)

ooa apaoa aa

= 0,1513463,34= 2019,5 p. (11.5)

Oc a coa (35,6%)

p. (11.6)

a opao, coa ao coca 6481,1 p.

apa a op pop

=0,31,74722,44 = 377,49 p. (11.7)

a paca apa a apa aac ac ac a 11.1.

aa 11.1 - apa a apa o

apa, oo

oco,

a a , p.

Ca, p.

Cpaoo-ca papa

3

165

,00

495,00

CD-R, 700 Mb

2

15,00

30,00

app ppa

1

255,00

255,00

aoa a, 500 co

1

125,00

125,00

oo

905,00

Coao, apa a apa aac ac coca

= 905,00 p.

apa a co oca po (cooc co p.)

p. (11.8)

c pac o ca a apa a coa popaoo poa c a 11.2.

aa 11.2 - apa a coa popaoo poa

Ca pacoa

Ca, p.

Ocoa apaoa aa

13463,34

ooa apaoa aa

2019,5

Oc a coa

6481,10

apa a op pop

377,49

apa apa

905,00

apa a co oca po

356,19

oo

23602,62

a opao, o apa a coa opaoo occ coca

= 23602,62 p.

aaoo p p popaoo poa pa-c o ccooc p paco o ac, oo

= = 23602,62 p.

pooc papao popaoo oc ./. opc o op

= O + + A + + O + , (11.9)

: O - apa pa a oca aa;

- apa a ccoa po oac;

A - apa a papao aopa p aa;

- apa a coa a, op, oo, apoco ..;

O - apa a oa;

- apa a ooo oa.

c coca op p coo co opaopo D:

D = c (1 + p), (11.10)

: = 85 - co opaopo;

c = 1,5 - o cooc. o cooc aa c apap ooc cooc popa o oo a aao oo aa, pa caap o p, cooc oopo pa pao (a oa c pa o 1,25 o 2). paccapao opaoo occ, a c aop a, ooc, oca - cooc aa o 1,5.

p = 0,9 - o opp popa o papao. o opp popa - oa pao a c c aop popa o paa o ocaoo. C o oo, o ao ca aa, opoo pca c, o o o o pa papao popaoo poa o p p pa 0,9.

pa o coo co opaopo.

D = 85 1,5 (1 + 0,9) = 242,25 .

apa pa a oca aa pa: O = 30 ./. Pao o o po c oao 5200 p. c oo aa k = 1,35 (o pao o caoc 6 ).

apa pa a aa c o o oca aa popaca o op o op:

= (D b) / ((75 85) k), (11.11)

: D - coo co opaopo,

b - o apa pa, cc ocaooo oca aa. o apa pa, cc ocaooo oca aa, acoc o cooc aa pac o 1,2 o 1,5 c c , o aa aaa, opoaa o o opaoo, p o b= 1,5

= (242,25 1,5) / (75 1,35) = 3,59 ./. ().

apa pa a papao aopa p aa A paccac o op:

A = D / ((20 25) k), (11.12)

A = 242,25 /(20 1,35) = 8,97 ./. ().

apa pa a coca popa o ooo o-c opc o op:

= D / ((20 25) k), (11.13)

= 242,25 / (20 1,45) = 8,35 ./.

(p-popac, c oao 6000 p. c oo aa k = 1,45).

apa pa a oa popa a pcoao op O paccac o c op:

O = D / ((4 5) k), (11.14)

O = 242,25 / (4 1,45) = 41,77 ./.

(p-popac)

apa pa a ooo oa o aa opc o op:

= P + O, (11.15)

P - apa pa a ooo apao poc;

P = D / ((15 20) k), (11.16)

P = 242,25 / (15 1,45) = 11,14 ./.

O - apa pa a papoa, a oop oa:

O = 0,75 P; (11.17)

O = 0,75 11,14 = 8,35 ./.

= 11,14 + 8,35 = 19,49 ./. (p-popac)

oca c o a op (3.1), o o pooc papao:

= 30+3,59+8,97+8,35+41,77+19,49=112,17 ./.

a popa po cooac opaopa caap oa. Oa opaopa -- 5100 p., pa o -- 25% o oaa. acoa caa opaopa coca:

p. (11.18)

oa oo apa opaopa p po opao opa- (apa p a p opao opa coca- 89,11 c) coca

P = 89,111239,11 = 41821,56 p. (11.19)

p aoapoao opao opa (apa p 2,00 c)

A = 2,0012 39,11 = 938,64 p. (11.20)

ooo o p popaoo poa

= P - A = 41821,56-938,64 = 40882,92 p. (11.21)

caao apa p cooa opaoo occ coco apa a pop co oca po co .

pcoaoo opa a 12 c apa a pop p o-po ooc opa P =0,3 coca (cooc pop =1,74 p./-.)

= 0,32121,74 = 14,09 p. (11.22)

apa a co oca po

p. (11.23)

oa, caao apa p cooa opaoo occ coca

= + = 14,09 + 19,28 = 33,37 p. (11.24)

p pacca o op

= - = 40882,92 - 33,37 = 40849,55 p. (11.25)

a opao, c oo:

aaoo - 24800,00 p.;

1 o 40849,55 p.;

2 o 40849,55 p.;

3 o 40849,55 p.

c copoa oo a 3 oa cooa opaoo occ (cpo o opaoo cap ao papao) p op coa E=20% coca

(11.26)

po o, o -- oo, .. po .

Pacca cpo oaoc.

p (copoa) oo -o o oa pacoo poa pa:

p.;

p.;

p.

a ooa a p o coca

p.,

o o aaoo (24800 p.).

oa cpo oaoc coca

oa. (11.27)

aa 11.3 - Co aa oaa ooco oc

aoa oaa

a

ooa pooc papao opaoo occ, (./. )

112,17

o apa a coa opaoo occ, (p.)

24800,00

aaoo p p opaoo occ, (p.)

24800,00

ooo o p opaoo occ, (p)

40849,55

c copoa oo a 4 oa cooa opaoo occ, (p.)

61248,82

Cpo oaoc poa, o (o)

1,27

Papaoaa aoapoaa opaoa occa OA caaop oa a ooc , a . oc oooc oa opa aoo cp, o ac, p po o opa.

11. poa co oc

pao po oo pcoa op co c apapca: poccop Intel Pentium c aoo acoo 800 , opaa a - 64 a, cooo coo pocpaco - 500 a, oop a Super VGA (co o - 256) c aoa 15?. popao oc: opaoa cca RATEDOWS 2000/XP , Microsoft Office 2003 (c ooo Excel) , Microsoft Framework 3.5 .

pao cppo ac aa poa oac: aoa acoa poccopa 1 , opaa a 500 a.

12. CP O CAA A A OOACOO PO

12.1 cp ooa

aca popa ac a Casset.exe. popaa po c apo a a, o.

popaa o o pc.

Caaa ooo c c o aopacop, oa oca appa. oc o c cpaoa o occc a p ao popa, a p a cpo.

a ao op pacooa aa aa, copaa c pacca aopacopa. a paccooa a cpo, p oop occc pa a.

o papoa a oo po a.

opa apa, aop, cpa a cc op cca c oco o p a. c oo a cca, o oa.

Paoa co c aa a.

a ao a o aa o a a.

12.2 cp acpaopa

acppoa aoo popaoo poa occc cao popa, cao ca apo a a, copo apo opoa a a.

p caoo popa ooo c cooc poa popao aapao oc.

caoa a a occc c oo acpa occao a a C.

p cao popa ooo pca a c c a c popao op a connect.udl. a opo a ooo aa a a.

caoa apo a a ppo opoa occc c oo pca cooc pc Microsoft SQL Server (aa a paoa o o pc C).

Cco coo pap

1. ooo A.., ao .., a .. a a: c a / o p. po. A.. ooo. - a opo, ooo ppaoao. - C.: OPOA p, 2002.- 672 c.

2. ao C.., ooo .. a a: pc. - apo: oo; Poco /: c; : Apc, 2000. - 504 c.

3. A.. op ooc opao cc -.: ac caca, 1999. - 168 c.

4. Cpoa .., Copo A.A., o .. popoa ooc opao cc: c a / o p. . . oa - .: ac caca, 2001. - 512c.

PO 1

popa o oo a a

USE [Video_CD]

GO

/****** Object: Role [db_guest] Script Date: 06/07/2011 23:57:37 ******/

CREATE ROLE [db_guest] AUTHORIZATION [dbo]

GO

/****** Object: Role [db_route] Script Date: 06/07/2011 23:57:37 ******/

CREATE ROLE [db_route] AUTHORIZATION [dbo]

GO

/****** Object: Table [dbo].[storage] Script Date: 06/07/2011 23:57:35 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

SET ANSI_PADDING ON

GO

CREATE TABLE [dbo].[storage](

[storage_id] [int] IDENTITY(1,1) NOT NULL,

[storage_name] [varchar](50) NULL,

CONSTRAINT [PK_storage] PRIMARY KEY CLUSTERED

(

[storage_id] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

) ON [PRIMARY]

GO

SET ANSI_PADDING OFF

GO

/****** Object: Table [dbo].[janr] Script Date: 06/07/2011 23:57:35 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

SET ANSI_PADDING ON

GO

CREATE TABLE [dbo].[janr](

[janr_id] [int] IDENTITY(1,1) NOT NULL,

[janr_name] [varchar](50) NULL,

CONSTRAINT [PK_janr] PRIMARY KEY CLUSTERED

(

[janr_id] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

) ON [PRIMARY]

GO

SET ANSI_PADDING OFF

GO

/****** Object: Table [dbo].[country] Script Date: 06/07/2011 23:57:35 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

SET ANSI_PADDING ON

GO

CREATE TABLE [dbo].[country](

[country_id] [int] IDENTITY(1,1) NOT NULL,

[country_name] [varchar](50) NULL,

CONSTRAINT [PK_country] PRIMARY KEY CLUSTERED

(

[country_id] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

) ON [PRIMARY]

GO

SET ANSI_PADDING OFF

GO

/****** Object: Table [dbo].[category] Script Date: 06/07/2011 23:57:35 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

SET ANSI_PADDING ON

GO

CREATE TABLE [dbo].[category](

[category_id] [int] IDENTITY(1,1) NOT NULL,

[category_name] [varchar](50) NULL,

CONSTRAINT [PK_category] PRIMARY KEY CLUSTERED

(

[category_id] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

) ON [PRIMARY]

GO

SET ANSI_PADDING OFF

GO

/****** Object: Trigger [janr_INS] Script Date: 06/07/2011 23:57:37 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

-- =============================================

-- Author: <Author,,Name>

-- Create date: <Create Date,,>

-- Description: <Description,,>

-- =============================================

CREATE TRIGGER [dbo].[janr_INS]

on [dbo].[janr]

FOR INSERT

AS

BEGIN

declare @id int

select @id = inserted.janr_id from inserted

if (@id = null)

BEGIN

RAISERROR ('oc aop', 16, 1)

ROLLBACK TRANSACTION

END

-- Insert statements for trigger here

END

GO

/****** Object: Trigger [janr_DEL] Script Date: 06/07/2011 23:57:37 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

-- =============================================

-- Author: <Author,,Name>

-- Create date: <Create Date,,>

-- Description: <Description,,>

-- =============================================

CREATE TRIGGER [dbo].[janr_DEL]

on [dbo].[janr]

FOR DELETE

AS

BEGIN

declare @id int

declare @count int

select @id = deleted.janr_id from deleted

select @count = count(*) from route where

janr_id = @id

if (@id != 0 )

BEGIN

RAISERROR ('pcc cc a a ac', 16, 1)

ROLLBACK TRANSACTION

END

-- Insert statements for trigger here

END

GO

/****** Object: Trigger [category_UPD] Script Date: 06/07/2011 23:57:37 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

-- =============================================

-- Author: <Author,,Name>

-- Create date: <Create Date,,>

-- Description: <Description,,>

-- =============================================

CREATE TRIGGER [dbo].[category_UPD]

on [dbo].[category]

FOR UPDATE

AS

BEGIN

declare @id int

select @id = inserted.category_id from inserted

if (@id = null)

BEGIN

RAISERROR ('oc aop', 16, 1)

ROLLBACK TRANSACTION

END

-- Insert statements for trigger here

END

GO

/****** Object: Trigger [category_INS] Script Date: 06/07/2011 23:57:37 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

-- =============================================

-- Author: <Author,,Name>

-- Create date: <Create Date,,>

-- Description: <Description,,>

-- =============================================

CREATE TRIGGER [dbo].[category_INS]

on [dbo].[category]

FOR INSERT

AS

BEGIN

declare @id int

select @id = inserted.category_id from inserted

if (@id = null)

BEGIN

RAISERROR ('oc aop', 16, 1)

ROLLBACK TRANSACTION

END

-- Insert statements for trigger here

END

GO

/****** Object: Trigger [category_DEL] Script Date: 06/07/2011 23:57:37 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

-- =============================================

-- Author: <Author,,Name>

-- Create date: <Create Date,,>

-- Description: <Description,,>

-- =============================================

CREATE TRIGGER [dbo].[category_DEL]

on [dbo].[category]

FOR DELETE

AS

BEGIN

declare @id int

declare @count int

select @id = deleted.category_id from deleted

select @count = count(*) from route where

category_id = @id

if (@id != 0 )

BEGIN

RAISERROR ('pcc cc a a ac', 16, 1)

ROLLBACK TRANSACTION

END

-- Insert statements for trigger here

END

GO

/****** Object: Table [dbo].[video] Script Date: 06/07/2011 23:57:35 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

SET ANSI_PADDING ON

GO

CREATE TABLE [dbo].[video](

[video_id] [int] IDENTITY(1,1) NOT NULL,

[video_name] [varchar](50) NULL,

[rate] [int] NULL,

[year] [int] NULL,

[janr_id] [int] NULL,

[storage_id] [int] NULL,

[country_id] [int] NULL,

[category_id] [int] NULL,

CONSTRAINT [PK_video] PRIMARY KEY CLUSTERED

(

[video_id] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

) ON [PRIMARY]

GO

SET ANSI_PADDING OFF

GO

/****** Object: Trigger [storage_UPD] Script Date: 06/07/2011 23:57:37 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

-- =============================================

-- Author: <Author,,Name>

-- Create date: <Create Date,,>

-- Description: <Description,,>

-- =============================================

CREATE TRIGGER [dbo].[storage_UPD]

on [dbo].[storage]

FOR UPDATE

AS

BEGIN

declare @id int

select @id = inserted.storage_id from inserted

if (@id = null)

BEGIN

RAISERROR ('oc aop', 16, 1)

ROLLBACK TRANSACTION

END

-- Insert statements for trigger here

END

GO

/****** Object: Trigger [storage_INS] Script Date: 06/07/2011 23:57:37 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

-- =============================================

-- Author: <Author,,Name>

-- Create date: <Create Date,,>

-- Description: <Description,,>

-- =============================================

CREATE TRIGGER [dbo].[storage_INS]

on [dbo].[storage]

FOR INSERT

AS

BEGIN

declare @id int

select @id = inserted.storage_id from inserted

if (@id = null)

BEGIN

RAISERROR ('oc aop', 16, 1)

ROLLBACK TRANSACTION

END

-- Insert statements for trigger here

END

GO

/****** Object: Trigger [storage_DEL] Script Date: 06/07/2011 23:57:37 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

-- =============================================

-- Author: <Author,,Name>

-- Create date: <Create Date,,>

-- Description: <Description,,>

-- =============================================

CREATE TRIGGER [dbo].[storage_DEL]

on [dbo].[storage]

FOR DELETE

AS

BEGIN

declare @id int

declare @count int

select @id = deleted.storage_id from deleted

select @count = count(*) from route where

storage_id = @id

if (@id != 0 )

BEGIN

RAISERROR ('pcc cc a a ac', 16, 1)

ROLLBACK TRANSACTION

END

-- Insert statements for trigger here

END

GO

/****** Object: Trigger [country_UPD] Script Date: 06/07/2011 23:57:37 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

-- =============================================

-- Author: <Author,,Name>


  • . . . . .

    [1,6 M], 22.06.2011

  • "". , . , . .

    [1,7 M], 03.07.2011

  • Microsoft SQL Server 2008 Express . .

    [3,4 M], 22.06.2011

  • . : , , , . .

    [539,0 K], 12.12.2011

  • , . "" Microsoft SQL Server. , , , , , , .

    [897,6 K], 21.11.2011

  • . . . . .

    [1,6 M], 22.06.2011

  • . . , . . .

    [717,7 K], 23.06.2011

  • "" , , . . .

    [2,0 M], 21.06.2011

  • : a , ER-aaa. aaa a a a a a a a , aa .

    [3,3 M], 01.07.2011

  • . . . . .

    [93,2 K], 21.06.2011

, , ..
PPT, PPTX PDF- .
.