Вы находитесь на странице: 1из 118

1.1.

1.1.1.
,
, PHP
Web.

1.1.2.
1.1.2.1.-

, -,
.

.

, .
,
- .
,
, , .
. ,
?
, , ,

, ..
.
, , .
.
- .
.115

1.1.2.2.
,
.

. , : , , ...
. ,
, , ...
,
,
, ,
.
,
.
, ,
, , , email, , .

.
.
9 , :
1. ;
2. ;

3. ;
4. ;
5. ;
6. ;
7. ;
8. ;
9. .

, ,
. ,
.

1.1.2.3. ,
- :
1.
, ;
2. ;
3. , , ,
, ,
, , ;
4. ;
5. , ;
6.
;
7. , ;
8. ;
9. ;
10. .

1.1.3.

..
, :

, .

.
(), ..

. , ( )
.

(, .) .
,
, .
-
. ,
,

, .

1.1.4.

-
:

- Cosmetic -www.mocmarket.com.
- Clothes - www.ummshop.com.
- Electronic - www.tcelectronic.com.

.
:

Veg Fruit

Cosmetic

Clothes

Electronic

0,2

0,35

0,25

0,1

0,1

4.75

4.45

3.75

3.35

1.

-
.
:
n

= Kiaij ,
i=1

:
Ki ;
aij ;
n .
,


-.
, -
, .

1.1.5. ,

-
. :
1. , ;
2. ;
3. ;
4. ;
5. ;
6. ;
7. ;
8. ;
9. .

1.2.

1.2.1.

,
.


-.
.
:

;
;
, ,

;

.

-,
,
;

. ,
, .
.

, , ,
( ). ,
, .

- :

.
.

, ,
. ,
,
.

1 2.
,
(

),

,
,
.
-
, :

. 1

- ,
:

. 2

1 2

, .

, .
.
.
,

,, .
,

.
,

.
.

.
.
.

.
.

, .

, .
.

.
,

.
/

.
/

.
/

,, .

1.2.2

, ,
, (),
..
- : MySQL, MS SQL Server, Oracle.

MS SQL Server
2008

( 40000
)

MySQL 5.5.8

Oracle 11

( 40000 )

()

1000$

10000$

( 40000
)

Unix,Windows

Windows

Unix, Windows

12.

.
, :
: ( , ,
(, ,
));
;
, ;
.
,
- .
,
,
, ..

, (,
), ,
(MS SQL Server, Oracle).
1.2.2.1 MySQL
() MySQL
Oracle Corporation, Sun Microsystems,
. GNU
General Public License .
,

[12]
MySQL .
WAMP, AppServ, LAMP , XAMPP.
MySQL ,

, ,
MySQL .
MySQL :

MyISAM,

, InnoDB,
. , MySQL
EXAMPLE, .
GPL-, MySQL
.

MySQL : AIX, BSDi, FreeBSD, HPUX, Linux, Mac OS X, NetBSD, OpenBSD, OS/2 Warp, SGI IRIX, Solaris, SunOS, SCO
OpenServer, SCO UnixWare, Tru64, Windows 95, Windows 98, Windows NT, Windows
2000, Windows XP, Windows Server 2003, WinCE, Windows Vista Windows 7.
MySQL OpenVMS. ,
,

MySQL.

MySQL
API
Delphi, C, C+
+, , Java, , Perl, PHP, PureBasic, Python, Ruby, Smalltalk,
Tcl .NET,
ODBC ODBC- MyODBC.
1.2.2.2 Microsoft SQL Server
Micrisoft SQL Server (),
Microsoft. TransactSQL,

Microsoft

Sybase.

Transact-SQL

ANSI/ISO (SQL) .

; [7].

Microsoft SQL Server


SQL, Transact-SQL ( T-SQL). T-SQL
SQL-92 ( ISO SQL)
. T-SQL
(
).
Microsoft SQL Server Sybase ASE
Tabular Data Stream (TDS,
). TDS FreeTDS

Microsoft SQL Server Sybase.
Microsoft SQL Server Open Database
Connectivity (ODBC) . SQL
Server 2005 -,

SOAP.

Windows, SQL Server.


Microsoft

JDBC,

Java ( BEA IBM WebSphere)


Microsoft SQL Server 2000 2005.
SQL Server .
SQL ;
.
, IP-
.
.
SQL Server :

: ,
.

:
.

.
, .

.
SQL Server 2008 .NET Framework.
.NET,
, .NET Framework, Common Type System (
Microsoft .NET Framework). ,
, .NET Framework, SQL Server 2005,
SQL Server ,
Windows.
Windows,
SQL Server.

Microsoft ,
- Microsoft
SQL Server. Microsoft SQL Server 2005 Common Language
Runtime (CLR) Microsoft .NET,
, .NET
(, VB.NET C#). Microsoft
API Microsoft SQL Server.
1.2.2.2 ORACLE
Oracle Database Oracle RDBMS -
Oracle [8].

Oracle , -
SID , , ,

.,
(
:
SYS.V_ $ DATABASE.ACTIVATION #)

. PMON (Process Monitor) SMON(


).
Oracle , SGA
(System Global Area).SGA , ,
SQL . ,
( ),
.
, (


),

(
) .
Oracle Oracle
RAC (Real Application Clusters,), , ,
, .
, ,
. , ,
RAC. 10g, ,
, ()
()
.
Oracle
. PL / SQL (
Oracle SQL)
-
Java

/ .
X
Oracle

("
").

, ,
.. , .
.

.
, ,

.
,

.
Oracle ,
, .
( ),

. ,

. 8i, Oracle "


" , ,
,
( " "
). 10g, SYSAUX,
.

Oracle

(
,
"
"),
.

Oracle

SCOTT. ,
,
. SCOTT ,
Oracle ( Software Development Laboratories), .

Oracle SCOTT,

Oracle.

Oracle
HR OE.

:
SYS
(


)
( ,
) OUTLN (
.BI, IX, HR, OE,
PM, SH ( ,
, SCOTT).

Microsoft SQL Server,


C+
+ [14][7]

1.2.3. -

- ,
, .

, (DBA) .
, ,
.

.
,
, .
, ,
,
. ,
.

,
, .

1.2.3.1.MySQL
(). MySQL
Oracle Corporation, Sun
Microsystems, .[9]
GNU General Public License .
,

.
MySQL .
WAMP, AppServ, LAMP , XAMPP.
MySQL ,
, ,
MySQL .

MySQL
: MyISAM,
, InnoDB,
. , MySQL
EXAMPLE, .
GPL-, MySQL
.
MySQL ,
Drizzle , OurDelta, PerconaServer , MariaDB.
Sun MySQLAB Oracle.

1.2.3.1.1. MySQL
MySQL

mSQL

: , ISAM
. SQL-,
API- mSQL. MySQL
. : ,
My, My,
, .
MySQL Sakila.
. Sakila
OpenSource- AmbroseTwebaze.

1.2.3.1.2.
MySQL : AIX, BSDi, FreeBSD, HPUX,

Linux,

MacOSX,

NetBSD,

OpenBSD,

OS/2Warp,

SGIIRIX,

Solaris,

SunOS,

SCOOpenServer, SCOUnixWare, Tru64, Windows 95, Windows 98, WindowsNT, Windows


2000, WindowsXP, WindowsServer 2003, WinCE, WindowsVista Windows 7.
MySQL OpenVMS. ,
,


MySQL.

1.2.3.1.3.
MySQL API Delphi, C, C++, , Java, , Perl, PHP,
PureBasic, Python, Ruby, Smalltalk, Tcl
.NET, ODBC ODBC MyODBC.

1.2.3.2.MySQL 5.0
MySQL 5.0 24 2005 ,
, MySQL .
MySQL SQL,
,
SQL. MySQL 5.0 :

( ,
)

1.2.3.3. Oracle
Oracle - -
() Oracle.[10]

Software Development Laboratories (SDL).SDL

Oracle. Oracle

,
Ampex .

1.2.3.3.1.
Oracle , -
SID http://en.wikipedia.org/wiki/Oracle_Database
- cite_note-3 , , ,

.,
( : SYS.V_ $ DATABASE.ACTIVATION #) , , .
PMON (ProcessMonitor) SMON (SystemMonitr).
Oracle , SGA
(SystemGlobal). SGA

, SQL- , . ,

),

. ,
( ),
( )
.

Oracle

OracleRAC (RealApplicationClusters,), ,
, , .
, ,
. ,
, RAC. 10 ,

() () .

Oracle
. PL / SQL ( Oracle SQL )
- Java /
.

1.2.3.3.1.1.
Oracle ,
(" ").
, , .. ,
.
.
. , ,
,
. ,
.
Oracle ,

. (
) .

,
. 8 , Oracle "
" ,

( " "
). 10 , SYSAUX ,
.

1.2.3.3.1.2.
Oracle
( , " "), .
Oracle
SCOTT . ,
. SCOTT
, Oracle ( Software Development Laboratories),
.
Oracle - SCOTT ,

Oracle.

Oracle HROE .
:

SYS ( )

(
, )

OUTLN (
.

. . , IX , HR , OE , PM , SH ( ,
, SCOTT ).

1.2.3.3.1.3.
1.2.3.3.1.3.1.Oracle
Oracle ,

.
( ):

Advanced Queuing (Qnnn)


(ARCn)

- ()
--- (CJQn):


(DBWn)
(Dnnn): -

(Jnnn)
- (LGWR)
- - (LNSn):

DataGuard -
- (MRP):

, (MMAN): ,

(LSP0):

Automatic Shared Memory Management

(MMON):
,

, (MMNL): Automatic Workload


Repository (AWR)

mmon (Mnnnn-M0000, M0001 .): MMON

- (PMON)

-- (PSP0): Oracle

(QMNC):
spwans

- (QMNn)

()

- ()

(Snnn): -

(SMON)

1.2.3.3.1.3.2. ,
Oracle
:


Oracle

Oracle.
"SID" (
SID).

1.2.3.3.1.4.
Oracle
(

"

" ). "" -.
.

1.2.3.4.PostgreSQL
- ().
: Linux, Solaris/OpenSolaris, Win32,
Winx86-64, MacOSX, FreeBSD, QNX 4.25, QNX 6.[11]

1.2.3.4.1. , ,

PostgreSQL SQL
SQL:2003 (ISO/IEC 9075).
( 8.4.0), PostgreSQL :



32

1,6

1



2501600,


PostgreSQL :

:
PL/pgSQL, PL/Perl, PL/Python PL/Tcl;
PL/Java, PL/PHP, PL/Py, PL/R, PL/Ruby, PL/Scheme PL/sh,
C- ;

1.2.3.4.2.
1.2.3.4.2.1.
, , .
SQL, , ,
, SQL
.
:

PL/pgSQL, PL/SQL,
Oracle;

PL/Lua, PL/LOLCODE, PL/Perl, plPHP, PL/Python, PL/Ruby,


PL/sh, PL/Tcl PL/Scheme;

C, C++, Java ( PL/Java);

R ( PL/R).

PostgreSQL , ,
, .
,
. ,
.

1.2.3.4.2.2.

DML.

, INSERT ,
.
(. ).
.
.

1.2.3.4.2.3.

DML-, .
,
, .
SQL-
. :
, ,

/ ,
. , ,
,
.

1.2.3.4.2.4.
PostgreSQL : B-, , R, GiST, GIN. ,
. PostgreSQL
:

,
ORDERBY ... DESC
;

,
;

,
/,
;

, (
);

(,
) ;

1.2.3.4.2.5. (MVCC)
PostgreSQL

Multiversion Concurrency Control (MVCC).


ACID,
.

1.2.3.4.2.6.
PostgreSQL :

( ,
)

( BLOB)

/ ( , ,
, )

IP IPv6

CIDR

MAC

UUID

XML

OID

,
GiST.

1.2.3.4.2.7.
PostgreSQL
. :

( )

( )

( )

1.2.3.4.2.8.

(). , ,
( ) .
.
.

1.2.3.4.3.

ACID.

ANSISQL-92 SQL-99.

OUTER JOIN, UNION, UNION ALL, EXCEPT, INTERSECT


.

(UTF-8).

Perl.

SSL Kerberos.

, SHA1, MD5, XML


(API ).

SQL-
.

1.2.3.4.4.

, PostgreSQL 20 775
000 ( , 39 000 ). :
MySQL 97 , 4 000 ; FreeBSD () 306
, 4 000 ; Linux ( ) 950 ,
10 000 .

1.2.3.4.5.

PostgreSQL Enterprise DB
, PostgresPlus (
;
) Postgres Plus
Advanced Server ( PostgreSQL
OracleDatabase).
DBA:

Postgres Studio pgAdmin;

PostgresPlusDebugger PL/pgSQL,
;

MigrationStudio
MySQL/Oracle PostgreSQL

1.2.3.4.6.
9.0.* :

SQL/MED (Management of External


Data)

JSON XML

MySQL .

MySQL.

1.2.4. -
-
1.2.4.1. - -
Web- - , Internet, ,
( ,
). Web- ,
, ( )
. , ,
, Web-,
. -: Apache, IIS
Microsoft,Nginx iPlanetserver Netscape Lighttpd. ,
-, , ,

-, Apache ApacheSoftwareFoundation,
, 63% -.
, .

. - .
Apache
,
.

1.2.4.2.Web- Apache 2.2


Web-
Unix. [5] .
, FAQ.

,
Apache ,
GNU/Linux, BSD, MacOS, MicrosoftWindows,
NovellNetWare, BeOS. Apache
.
, ,
.

1.2.4.2.1.
Apache ,
, HTTP .
( ) ApacheSoftwareFoundation,
.

, apache

, . ,
. Apache C.

1.2.4.2.2.
Apache
. :
(httpd.conf).
(httpd.confc 2.2 extra/httpd-vhosts.conf).
(.htaccess).
, .
,
MPM. .

( /etc/passwd /etc/hosts).

1.2.4.2.3. (MPM)
- Apache
. :

OS

Apache
Linux,
worker Software
FreeBSD
Foundation

-
.

,
.

-.

Apache
Linux,
pre-fork Software
FreeBSD
Foundation


MPM,

, .

,
threads.

threads.

perchild Apache
Linux
Software
Foundation

,
,
.

Apache
,
Novell
netware Software Novell NetWare
NetWare
Foundation

NetWare.

WindowsServer.
MicrosoftWindows.

winnt

Apache
Microsoft
Software
Windows
Foundation

Apache- Steinar H. Linux,


ITK
Gunderson FreeBSD

MPM,
prefork.


uid
gid.

Sean
peruser Gabriel
Heacock

MPMperchild.
4


2007
,

,

10

uid
2009
threads.
gid.
.
.

Linux,
FreeBSD

, ,

.

1.2.4.2.4.
Apache HTTP Server . 500 ,
. Apache

Software Foundation, opensource-.


, ,
, .
, :

-, ISPmanager VDSmanager
Apache.

1.2.4.2.5.
Apache .
IP- ( ),
.
,
. MPM, Apache-ITK httpd
uid guid.,
, (CPU,
RAM, ) .

1.2.4.2.6.
1.2.4.2.6.1.

, Apache
.

PHP (mod_php).

Python (mod python, mod wsgi).

Ruby (apache-ruby).

Perl (mod perl).

ASP (apache-asp).[7]

Tcl (rivet)

, Apache CGI FastCGI,


, C, C++.

1.2.4.3.WEB Nginx
HTTP- -, -.
- -, Unix-
( FreeBSD, OpenBSD, Linux, Solaris, MacOSX).
0.7.52 MicrosoftWindows.[8]
, , (,
JavaScript), . , ,
, .
, -. ,
nginx.Nginx ,
-, -.
nginx:
Rambler
Yandex
Begun
Wordpress.com

Wrike
SourceForge.net
vkontakte.ru
megashara.com

Taba.ru
.

1.2.4.3.1.
HTTP-

, ,
,

FastCGI

FastCGI

memcached

, , (gzip), byte-ranges (), chunked


, HTTP-, SSI-

, SSI-
FastCGI,

SSL

Perl

IMAP/POP3-

IMAP/POP3-
HTTP-

(LOGIN, USER/PASS)

SSL StartTLS

1.2.4.3.2.
nginx ,
select, epoll (Linux) kqueue
(FreeBSD). (.
- ).
.

, ,
. , ,
.
-, writev sendfile, nginx
.
HTTP- nginx
( server). location (location).
,
, , *
,
.location URI, URI,
. location
, fastcgi/memcached .
nginx .
.
1 16 . .
.
.

,
.
NGX_MAX_ALLOC_FROM_POOL, , .
,
. nginx
IP-. IP-
, Radixtree . nginx
, ,
1 . , IP-
TLB.

1.2.4.4.Web Lighttpd
Lighttpd

-,

, . [7]
, BSD. lighttpd Linux Unix , Microsoft Windows.

1.2.4.4.1.
Lighttpd :

HTTP-

URL

SSL

(

lighttpd).

- CGI, SCGI, FastCGI AJP ,


, .

1.2.4.4.2.
Lighttpd -,
10 . lighttpd
.
( Apache)
.
Lighttpd
.
,
, CPU .

1.2.4.4.3., Lighttpd
Lighttpd ( nginx)
, .

The Pirate Bay

freebsd.org lighttpd .

lighttpd : , ,
, , ....

Google s.ytimg.com
youtube.com, ( ) -
lighttpd-yt ( Google)

- lighttpd - (
)

,
: http (), , , ftp ..
, -.
.-
/
. ,
-, - .
- Apache. pache
,
. - Apache -
.

1.2.5.
1.2.5.1.
-


, ..

.
: , ,

3
:

3.

,
.
, .

() , .
:

, ;

,
.

, ,
.
,
.
,
. ,
, .
.
.
,

,
.
, .

1.2.5.2.
,
, ,

.

,
.

-,
. -
,
.

- , .
.
"", .
-

, ,
- . --
. , ERD
.



- ,
, .

.
.
. , ,
- .
.
, :


.
,
. ,
.

, ,
.

. .
(PrimaryKey) - ,

- .
:
1. .
.
2. . (
) ,
.
( ) (ForeignKey) -

. ,


, ,
.
. .
.
1.

.
: , , ,
, , , , , , .
2.
2.

10

2. . ,
. : , , ,
. 3.
3.

3
4

3. . ,
.
: , , , , .
4.
4.

4
5

4. .
, .

, :

, , , , , , ,
, , .
5.
5.

10

5. . ,
. , : ,
, , , .
6.
6.

6. .
, . , :

, , , -, , .
7.
7.

7. . .
, : , , , .
8.
8.

1
2
3
4

8.

. .
, : , , , , , , , , .
9.

9.

5
6
7
8
9

9. . .
, : , , , , , ,
, , .
10.
10.

10. .
. , : , , , , ,
, , , .
11.
11.

7
8
9


- .
,
, .
,

.
( ),
( ) , , N- . , ,
.

. - .
.

(RelationshipVerbPhrases). .
- 4 :

1:1 ( - );

1 : ( - );

: 1 ( - );

: ( - - );

IDEF1X , 4:

.
.
- ,

, ,

. .
- ,
, ,
.
.

.4. IDEF1X

,
, ,
(,
).
IDEF1X
, .
- ,
, .
, ,
(,

).

( - ) (
- ) .
,
5.

.
.
(FK), 5.

.5.

- ,
, .
-
.

( )
, 4 5.

,
, 5.
?
,

, . ,
: -> ->

.
.
,
NULL.
, ,
.
,
.
-
,
. IDEF1X .
(Cardinal)
.

0, 1 -
;

- ( 0);

0 1
- Z ( );

- (
);
6 .

. 6.

IDEF1X

1:M

1:1

M:M

M:M

M:M

M:1

M:M

M:M

M:M

10

1: 1

17

M:M

18

M:M

22

M:M

:
14

1.2.5.3.

MySQL 5.1.39

,
,

.
, .
, .

.
,
, MySQL 5.1.39
.
15.Customer

Customerid

Null/Notnul
l
Notnull

Int

PK

Null

Auto_in
crement

First_name
Middle_nam

Varchar
Varchar

40
30

Null
Null

e
Last-name
Login
Password
Address
E_mail

Varchar
Varchar
Varchar
Varchar
Varchar

20
10
20
50
10

Null
Null
Null
Null
Null

Phone
Status

Int
Int

Not null

Null
Null

16.Order

Orderid

Customerid
Deliveryid
Date
Price
Status
Manager

order

Null/Not

Int

null
Not null

PK

Null

Auto_in

Int
Int
Datetime
Float
Int
Int

Not null
Not null
Not null
Not null
Not null
Not null

crement
FK
FK

Null
Null
Null
Null
Null
Null

PK

Null

Auto_in

17.Order_history

Null/Not

Historyid

Int

null
Not null

Customerid

Int

Not null

FK

Null

Producerid

Int

Not null

FK

Null

crement

Orderid

Int

Not null

FK

Null

Packageid

Int

Not null

FK

Null

Itemid
Date
Price
Quality
Quantity
Address

Int
Datetime
Float
Char
Float
Varchar

Not null
Not null
Not null
40
Not null
50

Null
Null
Null
Null
Null
Null

18.Manufacture

Manufactureid

Int

Null/Not

null
Not null

PK

Null

Auto_in
crement

Name
Address
Web-site
Information
Phone

Varchar
Varchar
Varchar
Varchar
Int

40
50
40

Null
Null
Null
Null
Null

60

Not null

19.Payment

Paymentid

Int

Amount
Payment

Varchar
Varchar

40
40

methods
Date
Bank

datetime
Varchar

40

Null/Not
null
Not null

PK

Null

Auto_in
crement

Null
Null
Not null

Null
Null

20.Delivery

Delivery

Int

Address
Comment
Transport

Varchar
Varchar
Varchar

Null/Not
null
Not null

PK

Null

Auto_in
crement

50
30
40

Null
Null
Null

21.coat_for_winter

Coatid

Int

Null/Not

null
Not null

PK

Null

Auto_i
ncreme
nt

Colour
Size
Photo
Price
Quantity
Quality
Designer
Country

Varchar
Varchar
Varchar
Varchar
Float
Varchar
Varchar
Varchar

40
40
40
40

Null
Null
Null
Null
Null
Null
Null
Null

Not null
40
40
40

22.coat_for_summer

Coatid

Int

Null/Not

null
Not null

PK

Null

Auto_i
ncreme
nt

Colour
Size
Photo
Price
Quantity
Quality
Designer
Country

Varchar
Varchar
Varchar
Varchar
Float
Varchar
Varchar
Varchar

40
40
40
40

Null
Null
Null
Null
Null
Null
Null
Null

Not null
40
40
40

23.coat_for_rainy season

Coatid

Int

Null/Not

null
Not null

PK

Null

Auto_i
ncreme
nt

Colour
Size
Photo

Varchar
Varchar
Varchar

40
40
40

Not null
Not null

Null
Null
Null

Price
Quantity
Quality
Designer
Country

Varchar
Float
Varchar
Varchar
Varchar

40
Not null
40
40
40

Null
Null
Null
Null
Null

MySQL 5.1.39 ,
.

()


TINYINT

-127 128 0 .255

INTEGER

0 4294967295

-2147483648
8388607

INT

- 2 31231 - 1
0..2

3 2

- 1


Date

1000-01-01 9999-1231

,
YYYY- -(--)

CHAR(N)
VARCHAR(N)

1 .255

Length =N

1 2 5 5


, 1 255
, 1
255

TEXT
T IN XT
TEXT/LONGV
ARCHAR

2s -1 (. 255)

1 ,ength+ 1

TEXT

2,6-1(. 65535)

Length+2

TEXT,
64

27.

1.2.6.
- -.
(, -,
- ) - ).

-.

: ( ) . ,
, .
7.

7. -

- -
, .


.
, .
,
,

. ,
.
.


.
,
,

, ,
.

-.

- j
.
,
. . - ,
,

, ,
. -
100
( , ),

.
,
,

,
.
, .
-


,
.
"-"

1) .

.


,
-

.
.
, .

.


.
2)

.
-

, . ,
, .
, "" ,
, ,
.
,
.
3)


. ,
,
, .
4) .
,
,
.
(, )
.
5)
.

, .



.
6) .
7) .
8) .

1) .
2)

.
3) .
4) .
5) .
3)

,
- Web-.
Web , , ,

, .
Common Gateway Interface (CGI).
CGI

HTML,

, .
Web. httpd NCSA httpd CERN,
CGI. GI
(
C++ Perl). ,

Web,

Web .
(searchengines) CGl-
- ,
HTML-,
CGI-, , ,
SQL-. , CGI-
HTML-, .

Internet/Intranet " ",
. .

CGI- (, Perl C++).
- ,
. (
)
, Web-
. ,
:
. , -
HTML, .
Web-, ,
. , Web-

, Web-
,


, .
8

.8 - .

Web-

Internet Explorer

Java- (JVM). Web-


, CGI- (Common Gateway Interface- )

Java- , HTML- VRML-

, SQL-, MySQL.

(middleware)

Web-
. Web-
Web- )

Java-,

, ,
HTML-.

Web- ML- Web-,

2.

2.1.
:

( ) ( )

,
..
- QLAP, ,
,
, ,
,
.

,
. .

- 4
:

SQL-. HTTP- .
PHP,
SQL-

SQL-

SQL- PHP-

, Web-

PHP- HTML,
.
SQL (Structured Query Language) -

. SQL-

SQL-


. .
, ,

.
, SQL-
.

2.1.1.

MySQL ,
.

, ,
, .

.
,

, .

, .
e

,
, ,
, ,
, .

, 1
. ,
- , -

, 5.
- 8.

. .
.
.

.

2.1.2.

, ,


, , ,

,
.


,
, .

,
.

,
,

, ,
1 .
2 .

. - .

2.1.3.

(

HTML-),

. .160

3.
3.1.

. ,
.
. , ,
, ,

), , ,

, ( ,
) .
-
,
.
CASE-, , ERwin,

, .

.
""
:
1. .
2. , .
3.

, .
4. ,

3.1.1.

.

,
.

( )

( ,

).

, . - , ,
, , .
:

.
,

- , ,
.
,
, . ,

, .
.
.
- ,

,
.
.
, ,
, , .
, .
,
,
.

, . :

,
. .
, .
, ,
.

,
,


.
, ,
.
(

.
1, 2, 3,
- (4), 5.
- 1, 2, 3.
(1).
() .
-
.
(2). I ,

, .
,
.

(3). 2 ,

, .
, .

, .

, ' .
,
.
(4).
,
-- (M:M).
(5).

,
.

3 . 1 . 2 . e
, :
1

= (R1,R2,....,Rn) ,

= A= R1UR2U URn, A )

r R1 (r ) >< R 2 (r ) ><... >< Rn (r ),

Ri (r )
2

- r Rj.

=(R1,R2,,Rn) F- ,

Ri ( F )

( R1 ( F ) U R 2 ( F ) U .. U Rn ( F )) F ,

- 3 .

3. 3 .
:
- ;
- ;
- ;
- .
:

=(customer,manufacture, delivey, order, orderhistory, coat_for_winter,coat_for summer,


Coat_for_rainy season,discount,payment
,

:
. :
28.

Customer

Order history

Order

KCs-CustomerID

KH-HistoryID

KO-OrderID

A1.1-First_name

KC-CustomerID

A3.1-Date

A1.2-Middle_name

KP-ProducerID

A3.2-Price

A1.3-Last_name

KO-OrderID

A3.3-Status

A1.4-Login

KPac-PackageID

A1.5-Password

A2.1-ItemID

A1.6-Address

A2.2-Date

A1.7-E_mail

A2.3-Price

A1.8-Phone

A2.4-Quality

A1.9-Status

A2.5-Quantity
A2.6-Address

Manufacture

Delivery

Payment

KP-ManufactureID

KD-DeliveryID

KPay-PackageID

A4.1-Name

A5.1-Address

A6.1-Amount

A4.2-Address

A5.2-Comment

A6.2-Payment Methods

A4.3-Web-site

A5.3-Transport

A6.3-Date

A4.4-Information
A4.5-Phone

A6.4-Bank

Discount

Coat_for_winter

Coat_for_summer

KDi-DiscountID

KC1-CoatID

KC2-CoatID

A7.1-Number

A8.1-Colour

A8.1-Colour

A7.2-Discount percent

A8.2-Size

A8.2-Size

A7.3-Comment

A8.3-Photo

A8.3-Photo

A8.4-Price

A8.4-Price

A8.5-Quantity

A8.5-Quantity

A8.6-Quality

A8.6-Quality

A8.9-Designer

A8.9-Designer

A8.10-Country

A8.10-Country

Coat_for_rainy
season

KC3-CoatID
A8.1-Colour
A8.2-Size
A8.3-Photo
A8.4-Price
A8.5-Quantity
A8.6-Quality
A8.9-Designer
A8.10-Country

,
() .
.

29. :
Customer

Order history

Order

KC-CustomerID

KH-HistoryID

KO-OrderID

A1- Information customer

A2- Information history

A3- Information

(First_name,Middle_name,

(KCs,KM,KO,KPay,ItemID,Date,Price, order

Last_name,Login,Password,

Quality,Quantity,Address)

(Date,Price,Status)

Address,E_mail,Phone,Status
)

Manufacture

Delivery

Payment

KM-ManufactureID

KD-DeliveryID

KPay-PaymentID

A4-Information producer

A5-Information delivery

A6- Information payment

(Name,Address,Web-

(Address,Comment,

(Amount,Payment

site,Information,Phone)

Transport)

methods,Date,Bank)

Discount

Coat_for_winter

Coat_for_summer

KDi-DiscountID

KC1-CoatID

KC2-CoatID

A7- Information

A8- Information coat_for_winter

A9- Information coat_for_summer

discount

(Colour,Size,Photo,Price,Quantity,

(Colour,Size,Photo,Price,Quantity,

(Number,Discount

Quality,Designer,Country)

Quality,Designer,Country)

percent,Comment)

Coat_for_rainy season
KC3-CoatID
A10- Information coat_for_rainy
season
(Colour,Size,Photo,Price,Quantity,
Quality,Designer,Country)

Ordercoat_for_winter

Ordercoat_for_summer

Ordercoat_for_rainy
season

KO-OrderID

KO-OrderID

KO-OrderID

KC1-CoatID

KC2-CoatID

KC3-CoatID

KDi-DiscountID

KDi-DiscountID

KDi-DiscountID

KM-ManufactureID

KM-ManufactureID

KM-ManufactureID

A13-Quantity

A14-Quantity

A13-Quantity

R={ KCs,KH,KO,KM,KD,KPay,KDi,KC1,KC2,KC3,KOC1,KOC2,KOC3}

.

.
R = {KCs,A1,KH,A2,KO,A3,KM,A4,KD,A5,KPay,A6,KDi,A7,KC1,A8,KC2,A9,KC3,
A10,KOC1,A11,KOC2,A12,KOC3,A13}

Z={Z0,Z1,Z2,,Zn} [M:M] [3].


F={KCs(A1)
KH(A2)(KCs)(KM)(KO)(KPay)
KO(A3)(KCs)(KD)
KD(A5)
KM(A4)
KPay(A6)
KDi(A7)
KC1(A8)
KC2(A9)
KC3(A10)
(KC1)(KM)Z1
(KC2)(KM)Z2
(KC3)(KM)Z3
(KC1)(KDi)) Z4
(KC2)(KDi) Z5
(KC3)(KDi) Z6
(KO)(KC1)(KDi)(KM)(A7)
(KO)(KC2)(KDi)(KM)(A8)
(KO)(KC3)(KDi)(KM)(A9)
}

No. 1 [3]. [2]


, [M:M].

No 2. , , : =.
No 3 .
F, G.
2.1.
1. F ,
.
,(P)(A)(P1)(P2) (P)(A)(P1) (P)(A)(A2)

G, :
G ={ KCsA1, KHA2,KHKCs,KHKM,KHKO,KHKPay,KOA3,KOKCs,
KOKD,KMA4,KDA5,KPayA6,KDiA7,KC1A8,KC2A9,KC3A10,(KC1)
(KM)Z1,(KC2)(KM)Z2,(KC3)(KM)Z3,(KC1)(KDi)Z4,(KC2)(KDi)Z5,(KC3)
(KDi)Z6,(KO)(KC1)(KDi)(KM)(A11),(KO)(KC2)(KDi)(KM)(A12),(KO)(KC3)(KDi)
(KM)(A13)}
2.2. A . ,
XA(-XA). ,
G . XA(-XA)+.

(-XA)+. , A X+ ,
G.
AO,

AO.
.
G ={ KHKCs,KHKM,KHKO,KHKPay,KOKCs,KOKD }
1

KHKCs:

G1-KHKCs={ KHKM,KHKO,KHKPay,KOKCs, KOKD }

1
2

(KH)+=KH
(KH)+ =(KH)(KM)(KO)(KPay)

(KH)+ =(KH)(KM)(KO)(KPay)
(KCs)(KD)

KHKM,KHKO,KHKPay
KOKCs,KOKD

,(KH)+=KHKMKOKPayKCsKD, (KCs)+ =KH ,

KHKCs

(G1-

KHKCs) , ,KHKCs . G1 .
2

KHKM:
G1-KHKM={ KHKCs,KHKO,KHKPay,KOKCs, KOKD }
(KH)+=KH
(KH)+ =(KH)(KCs)(KO)(KPay)
(KH)+=(KH)(KCs)(KO)(KPay)(KD)

1
2
3

KHKCs,KHKO,KHKPay
KOKCs,KOKD

, (KH)+= KHKCsKOKPayKD, (KM)+ =KH ,


KHKM

(G1-KHKM), , KHKM .

G1 .
3) KHKO:
G1-KHKO={ KHKCs,KHKM,KHKPay, KOKCs, KOKD }
1
2

(KH)+=KH
(KH)+ =(KH)(KCs)(KM)(KPay)

KHKCs,KHKM,KHKPay

, (KH)+= KHKCsKMKPay, (KO)+ = KH , KHKO

(G1-KHKO),

, KHKO . G1 .
4)

KHKPay:

G1-KHKpay={ KHKCs,KHKM,KHKO, KOKCs, KOKD }


1
2

(KH)+=KH
(KH)+=(KH)(KCs)(KM)(KO)

(KH)+=(KH)(KCs)(KM)(KO)

KHKCs,KHKM,KHKO
KOKCs,KOKD

(KD)

, (KH)+= )+= KHKCsKMKOKD , (KPay)+ = KH , KHKPay

(G1-

KHKPay), , KHKPay . G1
.

5) KOKCs:
G1-KOKCs={ KHKCs,KHKM,KHKO, KHKpay, KOKD }
1
2

(KO)+=KO
(KO)+=(KO)(KD)

, (KO)+= KOKD,

KOKD

(KCs)+= KO ,

KOKCs

(G1-

KOKCs), , KOKsC . G1
.
6) KOKD:
G1-KOKD={ KHKCs,KHKM,KHKO, KHKPay, KOKCs }
1
2

(K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) KO A13

G ={ KCsA1, KHA2,KHKCs,KHKM,KHKO,KHKPay,KOA3,KOKCs,
KOKD,KDA5, KMA4 , KPayA6,KDiA7,KC1A8,KC2A9,KC3A10, (KC1)
(KM)Z1,(KC2)(KM)Z2,(KC3)(KM)Z3,(KC1)(KDi)Z4,(KC2)(KDi)Z5,(KC3)
(KDi)Z6,(KO)(KC1)(KDi)(KM)(A11),(KO)(KC2)(KDi)(KM)(A12),(KO)(KC3)(KDi)
(KM)(A13)}
1
2

(KO)+=KO
KO A3

KOA3

, (KO)+= KOA3, (A13)+= KO , KOA13

(G1-KOA13),

, KOA13 . G1 .
10) KC3A13

G ={ KCsA1, KHA2,KHKCs,KHKM,KHKO,KHKPay,KOA3,KOKCs,
KOKD,KDA5, KMA4 , KPayA6,KDiA7,KC1A8,KC2A9,KC3A10, (KC1)
(KM)Z1,(KC2)(KM)Z2,(KC3)(KM)Z3,(KC1)(KDi)Z4,(KC2)(KDi)Z5,(KC3)
(KDi)Z6,(KO)(KC1)(KDi)(KM)(A11),(KO)(KC2)(KDi)(KM)(A12),(KO)(KC3)(KDi)
(KM)(A13)}
1
2

(KC3)+=KC3
KC1 A10

KC3A10

, (KC3)+= KC3A10 , (A13)+= KC3 , KC3A13

(G1-KC3A13),

, KC3A13 . G1 .

11) KDi A13



G ={ KCsA1, KHA2,KHKCs,KHKM,KHKO,KHKPay,KOA3,KOKCs,
KOKD,KDA5, KMA4 , KPayA6,KDiA7,KC1A8,KC2A9,KC3A10, (KC1)
(KM)Z1,(KC2)(KM)Z2,(KC3)(KM)Z3,(KC1)(KDi)Z4,(KC2)(KDi)Z5,(KC3)
(KDi)Z6,(KO)(KC1)(KDi)(KM)(A11),(KO)(KC2)(KDi)(KM)(A12),(KO)(KC3)(KDi)
(KM)(A13)}
1
2

(KDi)+=KDi
KDi A7

KDi A7

, (KDi)+= KDiA7, (A13)+= KDi , KDiA13

(G1-KDiA13),

, KDiA13 . G1 .
12) KM A13

G ={ KCsA1, KHA2,KHK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M)
(KC1,KDi)
(KC2,KDi)
(KC3,KDi)
(KO,KC1,KDi,KM,A11)
(KO,KC2,KDi,KM,A12)
(KO,KC3,KDi,KM,A13)
}

.

.6

R. ,
R .
, . ,
. ,
.


, 3


: , ,
1
SELECT :
SELECT
FROM
WHERE

CustomerID
Customer
First_Name=Nyi AND OrderID IN
( SELECT OrderID
FROM
Order
WHERE
CoatID IN
( SELECT CoatID

FROM
WHERE

Coat_for_winter
Quantity= 1or 2 or 3 or 4 ));

:
CustomerID CsI
Customer Cs
First_Name FN
OrderID OI
Order O
CoatID CI
Coat_for_winter - CW
Quantity Q

:
Cs.CsI (C.FN=Nyi
(Cs*O*CW)
AND
Cs.OI O.OI AND
O.CI=CW.CI AND
CW.Q
1or 2 or 3 or 4
, .
Cs.CsI (C.FN=Nyi
AND
Cs.OI=O.OIANDO.CI=CW.CI
ANDCW.Q=1or2 or 3 or 4 (CsOCW)=
= Cs.CsI (Cs.OI=O.CIANDO.CI=CW.CI(C.FN=Nyi (Cs)O CW.Q=1or2or3or4(O)))=
= Cs.CsI (Cs.OI=O.CIANDO.CI=CW.CI(Cs.CsI (C.FN=Nyi (Cs)OCW.Q=1or2or3or4 (O)))=

= Cs.CsI (Cs.OI=O.CI (O.CI=CW.CI(Cs.CsI (C.FN=Nyi (Cs))O.CI (Cs)CW.CI (CW.Q=1or2or3or4(O)))))=


= Cs.CsI (Cs.OI=O.CIANDO.CI=CW.CI(Cs.CsI (C.FN=Nyi (Cs))O.OI(Cs)CW.CI(CW.Q=1or2or3or4(O)))).

SELECT :

:
T(Customer)=50000, T(Order)=50000, T(Coat_For_winter)=100

LCs=300, LO=300, LCW=300, Ljoin=90000

(L):
- 1) CustomerID (CsI), L=200
2) Frist_Name (FN), L=200

O - 1) OrderID (OI), L=200


2) CoatID (CI), L=200
2) Quantity (Q), L=200

:

.
.

I(Cs, First_Name (FN))=2000

I(Cs, CustomerID (CsI))=200,

I(O, OrderID (OI))= 200,

I(O, CoatID (CI))=20000,

I(CW, CoatID (CI))=400,

I(CW, Quantity (Q))= 2000,

b=10, Ccomp=0.003 , Cmove=Cfilter=0.003 , CB = 0.03

Customer.CustomerID

Customer.OrderID=Order.OrderID AND
Order.CoatID=Coat_for_winter.CoatID

Coat_for_winter.CoatID
Customer.CustomerID

Order.OrderID
Q3

Q1

Q2

Customer.First_Name=Nyi
Coat_for_winter

Order

Customer

Coat_for_winter

9.

.
1) Cs
j = 1 :
C1 = CCPU1 + CI/O1 = T(Cs) * Cfilter + CW(Cs)*CB .
, CW(Cs) = T(Cs) /LCs , :
C1 = CCPU1 + CI/O1 = 50000 * 0.003 +

50000 * 0.03 = 155=155 ().


300

j = 2 First_Name .
T ( Cs )k *Cfilter +
I (CsFN )

C2 = CCPU2 + CI/O2 =

T (Cs )K
I (CsFN )

CW ( Index ( FN ))K *CB +


I (CsFN )

* CB =

500001
*0,003+
2000

500001
*0.03+
200
2000

500001
* 0.03 = 0.0375+
2000

0,125+ 0.75= 0.95=0.95 ().


= 1 First_Name ,B(index(Frist_Name))-
Frist_Name.
Cs First_Name ,
T(Cs).
= min { C1, C2 } = {155,0.95}C2 = 0.9 ; k = 2.
CI/O = CI/O2 = 0.9 .

1
2000

T(Q1) = T (Cs) * PFN=Nyi = 50000 *


CW(Q1) =

= 25.

25
= 0.0083
30010

I(Q1,CsI ) = min { T(Q1), I (Cs, CsI) } = min { 25, 200 } = 25.


str[1] :
str[1]= {Q1}, , ,

// W, X, Y

0.9, 0.95

// Z, ZIO

{ 25, 0.0083, {25}, 2 }}.

// V: T(Q1), CW(Q1), { I(Q1,CI) }, k }}

2) O.
j = 1 :
C1 = CCPU1 + CI/O1 = T(O) * Cfilter + CW(O)*CB = 50000 *0,003 +

50000
300

* 0.03=

155=155
C1 = 155
j = 2 CoatID .
C2 = CCPU2 + CI/O2 =

T ( O )K *Cfilter +
I (O , CI )

T (O). K
I (O .CI )

*CB +

5000050000
200
*0.03 +
20000

5000050000
*0,003+
20000

*CB =

5000050000
*0.03 =
20000

375 +37.5 +3750=4162 ().


= 20000 Coat(index(CI))-
CoatID.
O CI ,
T(O)
= min { C1, C2 } = {155,4162}C1= 60.6 ; k = 2.
CI/O = CI/O1 = 155 .
T(Q2) = T (O)* PCI_IN = 50000 *

CW(Q2) =

20000 = 50000.
20000
50000
30010

I(Q2,OI) = min { T(Q2), I (O, OI) } = min { 50000, 200 } = 200.

= 16.6

I(Q2,CI) = min { T(Q2), I (O, CI) } = min { 50000, 20000 } = 20000.


str[2] :
str[2]= {Q2}, , ,
155, 155,

// W, X, Y
// Z, ZIO

{ 50000, 16.6, {200, 20000}, 2 }}.

// V: T(Q2), CW(Q2), { I(Q2,OI), I(Q2,CI) }, k }}

3) CW.
.j = 1 :
C1 = CCPU1 + CI/O1 = T(CW)*Cfilter + CW(CW)*CB = 50000 *0,003 +

50000 * 0.03 =
1000

155
C1 = 155
j = 2 Quantity .
C2 = CCPU2 + CI/O2 ==

T ( CW )K *Cfilter +
I (CW , Q)

500001
*0,003+
2000

500001
200
*0.03 +
2000

* CB +

T ( CW ) . K
I (CW , Q )

*CB =

500001
*0.03 = 0,075 +
2000

0,00375+ 0.75= 0.82875=0.83 ().

= 1 Q ,CW(index(Q))-
Quantity.
Cs Q ,
T(CW).
C = min { C1, C2 } = {155,0.83}=C2 = 0.8 ; k = 2.
CI/O = CI/O2 = 0.8 .
T(Q3) = T(CW)* PQ =1kg = 100 *

1
= 0.05.
2000

CW(Q3)

T (Q 3)
]
CW10

0.05
30010

= 0.0000167.

I(Q3,CI) = min { T(Q3), I (CW, CI) } = min {0.05,400 } = 0.05.


str[3] :
str[3]= {Q2}, , ,
0.8 , 0.83

// W, X, Y
// Z, ZIO

{ 0.05, 0.0000167, {0.05}, 2 }}.

// V: T(Q3), CW(Q3), { I(Q3,CI) }, k }}

.
1) i = 2. P { Q1, Q2, Q3 } ,
2. {Q1, Q3} , Q1 Q2
.
2) P= {Q1, Q2}.
3) Qj = Q1 .
R= P Qj = Q2, S=Q1 .
m1=2, m2=1 str,

) NLJ, i=1.
C1=CCPU1+ CI/IO1=T(Q2)* T(Q1)*Ccomp +[

CW (Q 2)

*CI/O (Q1) = 50000 *25

*0,003 + {16.6/10} * 0.9= 3751 ().


) SMJ, i=2.
Q2 Q1 CustomerID (
) I(Q2,OI) >I(Q1,CI) ( 20 10
), :
2 = CPU2 + CI/O2 = C
T(Q2)

JOIN
CPU

(Q2, Q1) + C

JOIN
I /O

(Q2,Q1) =((

T ( Q2)
I (Q 2,OI )

+ 2 )*T (Q1) +

( 1-

I (Q 1,CsI )
I (Q2, OI )

)) * Ccomp + 0 = ((

50000
200

+ 2 ) * 25+ 50000 * (1-

25
200

)) *0.003 =

150.15 ().
JOIN

(Q2, Q1) 0 , CW (Q1) <I(Q1, CI) (1<10).

CI/O

C= min {C1, C2} = C2 = 150.15 ; k=2.


CI/O = CI/O2 = 0.
C CI/O .
, :
C= str[2].Z + str[1].Z + C = 155 + 0.9 + 150.15 =306 ();
CI/O = str[2].ZIO + str[1].ZIO + CI/O = 155+ 0.95 + 0 = 155.95 ().
, .
:
T(Q2 Q1) =

T ( Q 2 )T (Q1)
max {I ( Q 2,OI ) , I ( Q 1,CI ) }

5000025
max {200,25 } = 25 .

:
CW(Q2

Q1) =

25
= 0.00001
90000

:
I(Q2 Q1, CI ) = min {I(Q2,OI), I(Q1, CI)} = min {200, 25} = 25
OrderID,
Q2 :
I(Q2 Q1, OI) = min { T(Q2 Q1), I(Q2,OI)} = min {25,200} = 25.
str[4]:
str[4] = { {Q2, Q1}, {Q2}, {Q1},
306 , 155.95

//W, X, Y
//Z, ZIO

{ 25, 0.00001, { 25, 25}, 2}}.

//V: T(Q2 Q1), CW(Q2 Q1),

// { I(Q2 Q1, CI), I(Q2 Q1, OI)}, k


4) Qj = Q2.

R = P Qj = Q1, S=Q2.
m1=1, m2=2 .
) NLJ, i=1.
C1=CCPU1 + CI/IO1=T(Q1)*T(Q2)*Ccomp +

*0,003 +

16.6
10

CW (Q 2)

*CI/O (Q1) =25* 50000

* 0.9= 3751()

) SMJ, i=2.
Q1 Q2 OrderID; ,
I(Q1,CI ) < I(Q2,OI),
2 =CPU2+ CI/O2 = C

JOIN
CPU

(Q2, Q1) +C

JOIN
I /O

(Q2,Q1) = ((

T ( Q2)
I (Q 2,OI )

+ 2 )*T (Q1) + T

(Q2)
( 1-

I (Q 1,CsI )
I (Q2, OI )

))* Ccomp + 0 = ((

50000
200

+ 2 ) *25 + 50000 *(1-

25
200

)) * 0,003 =

150.15 ().
CI/O

JOIN

(Q1, Q2) 0 , CW (Q2) <I(Q2, OI) (1<20).

C= min {C1, C2} = C2 = 150.15 ; k=2.


CI/O = CI/O2 = 0.
C= str[1].Z + str[2].Z + C = 0.9 + 155+ 150.15 = 306.4 ();
str[4].Z,
str[4] .
5) P= {Q2, Q3}.
6) Qj=Q2
R = P Qj = Q3, S=Q2.
m1=3, m2=2.
) NLJ, i=1.

C1 = CCPU1 + C

I/O1

=T(Q3) * T(Q2)*Ccomp +

CW (Q 3)

*CI/O (Q2) =

0.05*50000*0.003+(0.00001/10)*155= 7.5 ().


) SMJ, i=2.

Q3 Q2

OrderID (

) I(Q3,CI) <I(Q2,OI) ( 10 20
), :
2 =CPU2 + CI/O2 =C

JOIN
CPU

(Q3, Q2) + C

JOIN
I /O

(Q3,Q2) = ((

T ( Q2)
I (Q 2,OI )

+ 2 )* T(Q3) + T

(Q2)
( 1-

I (Q 3,CsI )
I (Q2, OI )

)) * Ccomp = ((

50000
200

+ 2 ) *0.05 + 50000 *(1-

0.05
200

)) *0,003 =

150 ().
JOIN

(Q3, Q2) 0 , CW (Q2) <I(Q2, OI) (1<20).

CI/O

C= min {C1, C2} = C2 = 150 ; k=2.


CI/O = CI/O2 = 0.
C= str[3].Z + str[2].Z + C = 0.8 + 155 + 150 = 305.8 ();
CI/O = str[3].ZIO + str[2].ZIO + CI/O = 0.83 + 155 + 0 = 155.83 ().
, .
:
T(Q3

Q2) =

T ( Q3 )T (Q2)
max {I ( Q 3,CI ) , I ( Q 2, OI ) }

0.0550000
max {0.05, 200}

= 0.05.

:
CW(Q3

Q2) =

0.05
90000

:
I(Q3 Q2, OI) = min {I(Q3, CI), I(Q2, OI)} = min {0.05, 200} = 0.05.

= 0.0000006.

CoatID,
Q3 :
I(Q3 Q2, CI) = min { T(Q3 Q2), I(Q2,OI)} = min {0.05,200} = 0.05
str[5]:
str[5] = { {Q2, Q3}, {Q3}, {Q2},

//W, X, Y

305.8 , 155.83

//Z, ZIO
//V: T(Q3 Q2), CW(Q3 Q2),

{ 0.05, 0.0000006, { 0.05, 0.05}, 2}}.

// { I(Q3 Q2, OI), I(Q3 Q2, CI )}, k


7) Qj = Q3.
R = P Qj = Q2, S=Q3.
m1=2, m2=3.
) NLJ, i=1.
C1 = CCPU1 + CI/O1 =T(Q2)* T(Q3)* Ccomp +

CW (Q 2)

*CI/O (Q3) =

0.05*50000*0.03+(16.6/10)*0.8 =76.3 ().


) SMJ, i=2.
Q2 Q3 CoatID ; ,
I(Q3,CI) < I(Q2,OI) :
2 = CPU2 + CI/O2 = C

JOIN
CPU

(Q3, Q2) + C

JOIN
I/O

(Q3,Q2) = ((

T ( Q2)
I (Q 2,OI )

+ 2 )*T

(Q3)+T(Q2) *
( 1-

I (Q 3,CsI )
I (Q2, OI )

)) * Ccomp = ((

50000
200

+ 2 ) *0.05 + 50000 * (1-

0.05
200

150 ().
CI/O

JOIN

(Q2, Q3) 0 , CW(Q3) <I(Q3, CI ) (1<10).

C= min {C1, C2} = C2 = 150 ; k=2.


CI/O = C I/O2 = 0.
C= str[2].Z + str[3].Z + C = 155 + 0.8 + 150 = 305();

)) *0.003 =

CI/O = str[2].ZIO + str[3].ZIO + CI/O = 155 + 0.83 + 0 = 155.83 ().


str[5].Z,
str[5] .
1) i=3. P {Q1, Q2, Q3},
3. {Q1, Q2, Q3}.
2) P={Q1, Q2, Q3}.
3) Qj = Q1.
R = P Qj = {Q1, Q2}, S=Q1 .

m1=5, m2=1 .
) NLJ, i=1.
C1 = CCPU1 + CI/O1 =T(Q3 Q2) * T(Q2)* Ccomp +[

0.0000006
10

CI/O (Q1) = 0.05 * 50000* 0.003 +

CW (Q 3 Q2)

*100 = 7.5 ().

) SMJ, i=2.
Q1 CustomerID; Q2
Q3 .
I(Q3 Q2, OI) = I(Q1,CsI) ( 10 10 ).
2 = CCPU2 + C

I/O2

= C

SORT
CPU

(Q3 Q2) + C

JOIN
CPU

(Q3

Q2,Q1) + C

SORT
I/ O

(Q3

Q2)
+C

JOIN
I/O

=T(Q3

(Q3 Q2,Q1) =

Q2) * log2

T(Q3

Q2

+Cmove)+(logb CW(Q3 Q2) 1)*T(Q3 Q2) *

CW (Q 3 Q2) *(Ccomp

T (Q 1)
(b *Ccomp + Cmove) + (( I (Q 1,CsI )

+ 2 ) * T(Q3 Q2) + T(Q1) *(1

I (Q 3 Q 2,OI )
I (Q 1,CI )

)) * Ccomp +
+ 2 * CW(Q3 Q2) * logb CW(Q3 Q2) * CB
JOIN
C I /O (Q3 Q2,Q1) 0, CW(Q1) <I(Q1,CsI) ( 1 < 10 ).

, :
C2 = 0.05* log2

(0.05/(0.0000006/10)) * 0,006 + (log10 0.0000006-1)*0.05*0.06+3

*0.05 +25*0.9*0.003+2*0.0000006 + 2 * log10 0.0000006 * 0.03 = 0.2 ().


, (logbB(Q3 Q2) 1), ,
CW(Q3 Q2)=1.
= min { C1, C2 } = C2 = 0.2 ; k=2.
CI/O = CI/O2 = 0.
C = str[5].Z + str[1].Z + C = 305 + 0.9 - 0.2= 306 ();
CI/O = str[5].ZIO + str[1].ZIO + CI/O = 305.8 + 0.95+ 0 = 307().
, .

T(Q3 Q2

max (Q 3 Q 2, OI ) , I (Q 1,CI )}
Q1) =
=
T ( Q3 Q2 )T ( Q1)

CW(Q3 Q2 Q1)

0.05
90000

0.0525
max {0.05,25 } = 0.05

= 0.0000006

:
I(Q3 Q2 Q1,CI) = min { I(Q3 Q2, OI), I(Q1, CI)} = min {0.05, 25} = 0.05

str[6]:
str[6]= {{ Q1, Q2, Q3 }, { Q2, Q3 }, {Q1},
306 , 307

//W, X, Y
//Z, ZIO

{ 0.05, 0.0000006, {0.05}, 2}}.

//V:

T(Q3 Q2 Q1),

CW(Q3 Q2

Q1),

//{ I(Q3 Q2 Q1,CI)},k

3) Qj = Q3.
R = P Qj = { Q1, Q2 }, S=Q3.
m1=4, m2=3.
) NLJ, i=1.
C1 = CCPU1 + C

I/O1

= T(Q2 Q1)* T(Q3)*Ccomp +

*CI/O (Q3) = 25 *0.05 * 0.003 +

CW (Q 3 Q2)

(0.0000006/10) * 0.8 = 0.00375 ().

) SMJ, i=2.
Q2 OrderID; Q1
Q3 .
I(Q2 Q1, CsI) = I(Q3,CI) ( 10 10 ).
2 = CCPU2 + C

I/O2

= C

SORT
CPU

(Q2 Q1) + C

JOIN
CPU

(Q2 Q1,Q3) + C

SORT
I/ O

(Q2

Q1)

+C
=

JOIN
I/O

(Q2 Q1,Q3) =

T(Q2

Q1)

log2

T(Q2

(Ccomp+Cmove)+(logb CW(Q2 Q1) 1)*T(Q2 Q1)*

Q1)/(CW(Q2

Q1)/b)

T (Q 3)
(b * Ccomp + Cmove) + (( I (Q 3,CI )
I (Q 2 Q1, CI )
I (Q 3, CI )

+ 2 ) * T(Q2

Q1) + T(Q3) x (1

)) *Ccomp

+ 2 * CW(Q2 Q1) x logb CW(Q2 Q1) *CB + 0 =


= 0.05 * log2

(0.05/0.000001) *0.006 +(log10 0.00001-1)*0.05*(10*0.006)+ (( 25

25
+ 2)*0.05 +0.05*(1-(25/0.05)))*0.03+2*0.00001* log10 0.00001 * 0.03= -0.56 ().
, (logbB(Q2 Q1) 1), ,
B(Q2 Q1)=1.
C

JOIN

(Q2 Q1,Q3) 0, CW(Q3) <I(Q3,CI) ( 1 < 10 ).

= min { C1, C2 } = C2 = -0.56 ; k=2.


CI/O = C I/O2 = 0.
C = str[4].Z + str[3].Z + C = 306+ 0.8 - 0.56 = 306.2();
str[6].Z,
str[6] .
.
:
.
(Q1, Q2, Q3) = (Q3, Q2)
(Q3, Q2) = Q3

Q1, SMJ

Q2, SMJ

Q3 = IndexScan (CW,Quantity=1kg) + Filter( CW.CI)


Q2 = TableScan (O) + Filter (O.BI, O,OI)
Q1 = IndexScan (Cs, First_Name= nyi) + Filter(Cs.CsI, Cs.FN)

Customer.CustomerID

SMJ
Order.CoatID =
Coat_for_winter.CoatID

SMJ

Filter(Coat_for_winter.CoatID)

Filter(Order.OrderID,Order.CoatID)

IndexScan(Coat_for_winter,
Quantity= 1or2)

Coat_for_winter

TableScan(Order)

ORDER

f ilter(Customer.CustomerID
Customer.First_Name)

IndexScan(Customer.
First_Name=nyi)

CUSTOMER

.10

306.2.
. , ,
. , ,
(1- ), , = (lambda* T
, lamda -.
, ,
0.1, (1-) 1 0.9.
336.82c

Оценить