<<

International Journal of Intelligent Computing Research (IJICR), Volume 7, Issue 2, June 2016

Extended Multiset-Table-Algebra Operations

Iryna Glushko Nizhyn Gogol State University, Ukraine

Abstract 2. Multiset: Basic Definitions

The paper is focused on some theoretical Let’s introduce the formal definition of multisets questions of the Database Theory. Multiset table in terms of monograph [5]. algebra is considered. The notion of a table specified Definition 1. A multiset  with basis U is a using the notion of a multiset (or bag). A signature of  U  ,...}2,1{: , where U is an arbitrary multiset table algebra is filled up with new   operations such as inner and outer joins, semi-join (in a classical Cantor’s understanding). and aggregate operations. A formal mathematical Let's agree a multiset  with basis n1 nk semantics of these operations is defined. The special   1 ddU k },...,{ to write down as 1 dd k },...,{ , NULL is inserted in the universal domain for where ni is a number of duplicate of the element dі define of the outer join. in the multiset  , so   dn )( ,  ,...,1 ki . i i 1. Introduction Let be a multiset with basis   domU  . Here dom is the range of definition of multiset as a The relational data model is nowadays in function. widespread use as in database scientific research so Definition 2. A characteristic function of multiset and in practice. In its formal definition, originally  is a function  D  ,...}2,1,0{: , the values of proposed by E. Codd, the is based which are specified by the following piecewise on sets of , i.e. it does not allow duplicate schema: tuples in a relation [1]. There are many applications  )( if dd dom, the most peculiar feature of which is multiplicity and  d)(   repeatability data. For example, these are  else;,0 sociological polls of different population groups, for all  Dd , where D is the universe of elements calculations on DNA and others. Commercial of multiset bases. relational database systems are almost invariably Definition 3. An empty multiset m is a multiset based on multisets instead of sets. In other words, a characteristic function of which is a constant tables are in general allowed to include duplicate function, value of which is everywhere equal zero. tuples. Definition 4. A rank of finite multiset  is a sum For example, the data model of SQL is relational in nature, as well as the relevant operations. of duplicate elements of its basis   d)( ; However, unlike , the tables ddom manipulated by SQL are not relations, but, rather, wherein m  0 . multisets. The reason for this peculiarity is twofold Let’s introduce a binary relation inclusion over [2]. First, this is due to a practical reason: since SQL multisets. tables may be very large, duplicate elimination might Definition 5. Multiset  is included in multiset become a bottleneck for the computation of the  (   ), if query result. Second, SQL extends the set of query operators by means of aggregate functions, whose  (& UddUU      dd ) . operands are in general required to be multisets of Directly from definition follows that this relation values. is a partial order. So, naturally there is a need to expand The 1-multisets are the multisets whose range of possibilities of relational databases due to use of values is an or a single-element set {1}. multisets (or bags). This problem was also These multisets are the analogues of ordinary sets. considered in [2-8]. However this question requires Analogs of standard set-theoretic operations and specification and extension because in the specified operations, which are using peculiarities of multisets works the due attention isn't paid to operations of and, therefore cannot be useful for (abstract) sets, are inner and outer joins, semijoin and aggregate defined in terms of characteristic functions in operations of multiset table algebra. monograph [5]. There are operations of multiset

union  All , intersection  All , difference \ All , which

Copyright © 2016, Infonomics Society 711 International Journal of Intelligent Computing Research (IJICR), Volume 7, Issue 2, June 2016

build multisets of general view. The Cartesian formulation of theorem. Indeed, the following product of multiset  , the operation Dist )( , which R equalities hold: 1)  1, R  All  2 , R  build 1-multiset, and analog of a full for  R R  R R  ,\,\, R ; 2)  ,~ R  multisets are defined too. 1 All  1 All 2  R   R    All  ,\, RRC , where  , RC  3. Multiset Table Algebra: Basic   R ...,   , R { 1},RA   { n},RA   Definitions { }, ,...,{}{ 1121 }, AAAAA nn }{

and  1 AAR n},...,{ is a scheme of the table  , R Among the two sets that are considered, A is the (see, for example, [5, 10]). set of attributes and D is the universal domain. Definition 6. An arbitrary (finite) set of attributes 4. Extended Operations R  A is called the scheme. Definition 7. A of the scheme R is a The extended operations include inner and outer nominal set on pair R , D . The projection of this joins, semijoin, aggregate operations. Let's consider nominal set for the first component is equal to R . In these operations one at a time. other words, a tuple of the scheme is a function : Rs  D . 4.1. Inner Joins The set of all tuples on scheme R is designated as RS )( and the set of all tuples is designated as There are four kinds of inner join operations   RSS )( . Cartesian join, natural join, join using attributes RA 1,...,AA n and join on predicate p . Let’s define them. Definition 8. A table is a pair  , R , where the Definition 10. The Cartesian Join of table on scheme R and table on scheme R , moreover first component  is an arbitrary multiset basis of 1 2  RR 21  , is a binary parametric operation Cj which   )( is an arbitrary set (in particular infinite) ,RR 21 of tuples of the scheme R and other component R of the form is a scheme of the table. Cj 1 2   RRRR 21 )()()(: , Let  , R be the first component of the pair ,RR 21  1  , R11 Cj 22   ,',  RRR 21 ,  , R , i.e., is the set  . Thus, a certain scheme is ,RR 21 ascribed to every table. The set of all table on where  11  (, RR 1),  22  RR 2 )(, . scheme R is designated as  R)( and the set of all The basis of the multiset   is defined by follow: table is designated as  R)( .     ssss 121  s21  2 )()((|{)(  RA   sss )}. The number of duplicates is given by The notation sOcc  ),( denotes the number of 21 the following formula: duplicate tuple s in the multiset  . Let's agree a Occ s    Occ s 11 Occ s ,(),(),(  22 ), where multiset to write down as n1 ss nk },...,{ , where 1 k s   )'( and   sss 21 . n  Occ s  ),( ,  ,...,1 ki , and   ss },...,{)( is i i 1 k Example 1. Consider the two tables  , R11 and a basis of the multiset  .  , R22 are shown in Table 1 and Table 2, Definition 9. The multiset table algebra is the respectively. Let’s 1  CBAR },,{ and algebra , P, , where  is the set of all tables, 2  FEDR },,{ . R R R P,  All  All All  ,, RXRp  Rt , RR }~,,,,,\,,{ is Table 1. ψ R, ,RR 21 1 the signature, Pp ,  , ,,, RRRX 21  A, P ,  A B C are the sets of parameters. a a c The operations of signature  are defined in a а с P, b b a [6]. Table 2. Theorem 1. Any expression over multiset table ψ2 R, algebra can be replaced by equivalent to him D E F expression which uses only operations of selection, a a а join, projection, union, difference and renaming. a a c Proof. To prove this statement we will show that a a c operations of intersection and active can a a c be expressed through the operations noted in

Copyright © 2016, Infonomics Society 712 International Journal of Intelligent Computing Research (IJICR), Volume 7, Issue 2, June 2016

If we decided to obtain a Cartesian join of these where s   )'(' and '  sss 21 . tables the result would be as shown in Table 3. Example 2. Consider the two tables  R ',' and This result can also be present as 11  R ',' are shown in Table 4 and Table 5,  R11 Cj  ,, R22 {{ А a В a С c  ,,,,,, 22 ,RR 21 respectively. Let’s 1  CBAR },,{' and aFaEaD 2 А a В a  ,,,,{,},,,,,{ 2  DBAR },,{' . С cFaEaDc 6 А b  ,,{,},,,,,,, 1 В b С aFaEaDa  ,},,,,,,,,, Table 4. ψ 11 'R,' aEaDaCbBbA  ,,,,,,,,,,{ A B C a b c  3  RRcF },}, 1, where   DCBARR ,,,,{ 21 21 a c a FE }, . a c a b b b

Table 3. ψ R, 11 Cj ψ R, 22 R,R 21 Table 5. ψ 22 'R,' A B C D E F A B D a a c a a а a b а a a c a a c a c a a a c a a c c b а a a c a a c c b а a a c a a а

a a c a a c If we decided to obtain an Inner Natural Join of a a c a a c these tables the result can be present as a a c a a c  R11   R22 ','','  b b a a a а RR 21 ',' b b a a a c {{ А a В b С aDc  1 ,},,,,,,, b b a a a c 2 b b a a a c А a СсВ aDa  ,},,,,,,,{ RR 21 }'' ,

where  21  DCBARR },,,{'' . Definition 11. The Inner Natural Join of table on Definition 12. The Inner Join using 1,...,AA n of scheme R1 and table on scheme R2 is a binary table on scheme R1 and table on scheme R2 , parametric operation written as  , whose value is ,RR 21 moreover   121 ,...,AARR n , is a binary the table on scheme  RR 21 consisting of all the parametric operation of the form unions of compatible tuples of input tables. Hence, 1 2   RRRR 21 )()()(: , n ,,,..., RRAA 211 1 2   RRRR 21 )()()(: , ,RR 21  ,R11  22   ,',  RRR 21 , 1 n ,,,..., RRAA 21  R11 22   ,,,  RRR 21 , ,RR 21 where  11  (, RR 1),  22  RR 2 )(, . where 1  (R1),  2  R2 )( . Moreover all 1,...,AA n are pairwise different,

In other words, each tuple of 1 is paired with n 1, and   121 ,...,AARR n . If input tables have each tuple of  2 , regardless of whether it is a also other general attributes which differ from duplicate or not. The basis of the multiset   is 1,...,AA n , before join they needs to be renamed. defined by follow:    ssss 121 1)((|{)(  The basis of the multiset   is defined by follow:

s2  )(  ss 212   sss 21 )}. The relation   ssss 121  s21  2 )()((|{)'(  is a binary relation of compatibility of tuples n dif 1 i 2 i )()(   sssAsAs 21 )}.  || RsRsss and | Rs is the restrictions i1 121 2 i The number of duplicates is given by the of tuple si on the scheme R [5]. following formula:

The number of duplicates is given by the Occ s    Occ s 11 Occ s ,(),(),(  22 ), following formula: where s   )'( and   sss 21 .  ssOcc 21  ),(  11  sOccsOcc ,(),(  22 ), Example 3. Consider the two tables  R11 ',' and

are shown in Table 4 and Table 5. Let's 1 The top index specifies the count of the tuple in the table. find an Inner Join using A of these tables. Both

Copyright © 2016, Infonomics Society 713 International Journal of Intelligent Computing Research (IJICR), Volume 7, Issue 2, June 2016

input tables have another general attribute B. We where  21  DCBARR },,,{'' . must to rename it before using operation. We take Let's note the following obvious fact. The join the attribute B of the table  R22 ',' and rename it  is extension of another arbitrary inner join ,RR to E. As result we will get the table 21 operation in the following sense: ~ ~ 1  ,' 22 ' {{ aAaDbEaAR  ,,{,},,,,, Rt 11 Cj 1122  ,,,, RtRtRt 22 , ,RR ,RR 21 1 AaDcE с bE  ,,,,{,},,, aD  2 ,}, 21 ~ ~ ,Rt 11  1122  ,,, RtRtRt 22 , 1 n ,,,..., RRAA 21 ,RR 21 R }' , where R2  ЕА D},,{' . Then the result of the Inner Join using A can be      , 11  , 22    11  ,, RtRtRtRt 22  . ,, RRp ,RR present as  21 1  21 1 The values of these operations in the left parts of  R11   R22 ','','  RRA 21 ',', these two equalities and inclusion must be defined. ~ ~ Definition 14.The Semijoin of table on scheme   R11 ',' ~  ,' R22 '  ,', RRA 21 ' R1 and table on scheme R2 is a binary parametric 1 {{ aDbEcCbBaA  ,},,,,,,,,, operation written as ⋉ , whose value is the table ,RR 21 aDcEcCbBaA  1,},,,,,,,,,{ on scheme R1 containing tuples of the first table 2 aDbEaCcBaA  ,},,,,,,,,,{ which are included in the inner natural join of input  2 ,},,,,,,,,,{ RaDcEaCcBaA }, tables. Thus, ~ ⋉  RRR )()()(: , ,RR 21 1 2 1 where ' 21  CBARRR Е D},,,,{' . ~  , R ⋉  ,R =  ,' R , Let :  falsetrueSSp },{ be а partial binary 11 ,RR 21 22 1 predicate on the set of all tuples S such that where  11  (, RR 1),  22  RR 2 )(, . The

  2121 21 ),(dom,  sstruessppssss 21 . basis of the multiset   is defined by follow:

Definition 13. The Inner Join on predicate p of  ss 11  ss 221  )(()(|{)'(  ss 212 )} . table on scheme R1 and table on scheme R2 is a The number of duplicates is given by the binary partial parametric operation of the form following formula: ~ Occ s   Occ s 1),()',( , 1 2 )()(:   RRRR 21 )( , ,, RRp 21 where s   )'( .  ,R11  22   ,',  RRR 21 . ,, RRp 21 Example 5. Consider the two tables and The range of definition of this operation is are shown in Table 4 and Table 5, dom   RR 2211 1)(|,,,{  respectively. If we decided to obtain a Semijoin of ,, RRp 21 these tables the results can be present as  2  p}dom)( . The basis of the multiset   is  R ',' ⋉  R ',' ={{ А a В b  ,,,, 11 RR 21 ',' 22 defined by follow:  ssss 121 1)((|{)'(  1 2 ~ ~ С a  }, , А a сВ  ,,,,{ С a  }, , R1 }' , s2   2 )( 21 ),(   ssstruessp 21 )} and  ⋉ = is a generalized equality (strong Kleene’s equality) ',RR 12 ' [9]. 1 2 aD  }, , А a сВ  ,,,,{ aD  }, , R2 }' . The number of duplicates is given by the So semijoin is not commutative. following formula:

 ssOcc  ),(     sOccsOcc ,(),(  ), 21 11 22 4.2. Outer Join where s   )'(' and '  sss 21 . We can lose information when using the inner Example 4. Consider the two tables  R11 ',' and join operations because the tuples which are not  R ',' are shown in Table 4 and Table 5, 22 compatible will not be represented in the output respectively. Let's find an Inner Join on predicate table. The outer join operations use when it is def necessary to consider the tuples of input tables which ~ of these tables and 21 ),( 1 )( aAstruessp  didn't get to result of the inner join operations. Let NULL be a special element of the universal 2 1 )()( cBsaAs  2 )(  cBs , where domain D . NULL used to denote absent values in s1   1 )'( , s2   2 )'( . The result can be present as the output table. Let s ,NULLR be a constant tuple on

 R11   R22 ','','  scheme R , i.e. ,NULLR  NULLRs }{: . , ',RRp 21 ' 2 {{ А a В c С aDa  },,,,,,, , RR 21 }'' ,

Copyright © 2016, Infonomics Society 714 International Journal of Intelligent Computing Research (IJICR), Volume 7, Issue 2, June 2016

There is one logical scheme for definition of the outer left join, outer right join, outer full join and outer join operations [5]. union join. Let’s define them. ~ Let  1 2 )()(:   RRRR 21 )( be some Consider the following inner natural joins partial on the set of all tables and   {, sR 1 },   ,'\  RRRR , 121 12 ,\ NULLRR 12 21  \, RRR 121  ,,, RR   , R   , R  for all   2211 1  11 22  1  ,RR 21  where   {)'(  ,\1 NULLRR sss 1 (|   21 )}, 1 12  tables  RR dom,,,  . 2211   sOccsOcc  211 ),()','( , s   )'(' ,  Let's notice that the operations Cj ,  , 1 ,RR 21 '  sss and ,RR 21 12 ,\1 NULLRR

 ,  are such. 1 ,,,..., RRAA ,, RRp   {, sR },   ,''\  RRRR , 1 n 21 21 212 21 ,\ NULLRR 21 21  \, RRR 212 We fix two tables  ,,, RR 2211 from range 1 where   {)''( s ,\ NULLRR  ss 22 (|   12 )}, of definition of the operation  . 21 

sOcc   sOcc  122 ),()'',''( , s   )''('' , Then the table  , R11 takes the following form  ''  ss 1  s . R1 21 ,\ NULLRR 2 , R11   , R121  All  , R121 .   Definition 15. The Outer Left Join operation is a partial binary operation of the form Consider the table  121   ,', RR 1 . The ~  l 1 2 )()(:   RRRR 21 )( , where basis of the multiset   is defined by follow: dom l  dom and l   ,,, RR 2211 

 ss 11  ss 221  2 )(()(|{)'(  RR 21    ,,, RR 2211  All  , R121   ss   RR },,, . The number  \, RRR 121 21   2211 1   {s1 }, \ RR . of duplicates is given by the following formula: 12 ,\ NULLRR 12 \, RRR 121 Occ s1   Occ s 11 ),()',( , where s1   )'( . Definition 16. The Outer Right Join operation is a partial binary operation of the form Consider the table 121   ,'', RR 1 . The ~  r 1 2 )()(:   RRRR 21 )( , where   basis of the multiset is defined by follow: dom r  dom and r   ,,, RR 2211   ss  ss  )(()(|{)''(  11 221 2 RR 21   ,,, RR 2211  All  , R212   ss   RR },,, . The number  \, RRR 212 21   2211 1  1 of duplicates is given by the following formula:  {s ,\ NULLRR }, \ RR 21 . \, RRR 21 sOcc   sOcc  ),()'',( , where s   )''( . 212 1 11 1 Definition 17. The Outer Full Join operation is a In other words, the tuples of the table partial binary operation of the form  )()(: ~   RRRR )( , where  , R121 are used in formation of result of the f 1 2 21  dom f  dom and f   ,,, RR 2211  join operation, and tuples of the table  , R121  RR 21   ,,, RR 2211  All  , R121  are not used.  \, RRR 121  {s1 }, \ RR  RR 21 We obtain a representation of the table  ,R22 12 ,\ NULLRR 12 All \, RRR 121 replacing the roles of the tables  , R and 11  RR 21  , R  {s1 }, \ RR . All 212 21 ,\ NULLRR 21  \, RRR 212  ,R22 in the presentation of the table  , R11 . Let's notice that if the operation  coincides with Definition 18. The Outer Union Join operation is a partial binary operation of the form  )()(: ~   RRRR )( , where the operation  then the table  , R121 is the  1 2 21 ,RR 21  dom   dom and    ,,, RR 2211  semi-join of the tables  , R11 and  ,R22 , i.e.   , R  {s1 }, \ RR  RR 21 121 12 ,\ NULLRR 12 All  \, RRR 121  , R121 =  , R11 ⋉ ,RR  ,R22 .  21  RR 21  , R  {s1 }, \ RR . There are four kinds of the outer joins operations All 212 21 ,\ NULLRR 21  \, RRR 212 which are induced of the inner join operation  :

Copyright © 2016, Infonomics Society 715 International Journal of Intelligent Computing Research (IJICR), Volume 7, Issue 2, June 2016

multiset and then these functions are transferred to Example 6. Consider the two tables  R11 ',' and the tables.  R22 ',' shown in Table 4 and Table 5. The results Definition 19. The aggregate operation Sum ,RA by of Outer Join operations would be as follows: the attribute A of the finite table on scheme R , l   2211 ',',','  {{ cCbBaARR  ,,,,,, RA , is a unary parametric operation of the form 1 2 aDaCcBaAaD  ,},,,,,,,{,}, Sum ,RA )(:  ({AR }) ,   1 RRNULLDbCbBbA '',},,,,,,,{ }; 1 2 21 Sum ,RA    AR Sum  A   A}{,)(,, , where

r   2211 ',',','  {{ cCbBaARR  ,,,,,,   RR )(, . The Sum  A )( function is applied to 1 aDaCcBaAaD  2 ,},,,,,,,{,}, a column with attribute in the table  , R , the A с NULLCbB D а  2 RR '',},,,,,,,{ }; 21 result obtained is the sum of every value occurrence  ',',',' {{ cCbBaARR  ,,,,,, f  2211  in  A . In addition, NULL values don’t undertake in 1 aDaCcBaAaD  2 ,},,,,,,,{,}, attention and it is assumed that the column contains only data of numeric type.  NULLDbCbBbA 1 A с  ,,{,},,,,,,,{ Num 2 Thus, Sum 2: m  Num ,  NULLCbB D а  RR 21 '',},,,,, };    ',',','  {{ bCbBbARR  ,,,,,, NULL if  A  ;)(  2211  1 Sum  A )(  NULL if  A  {)( NULL};  NULLD A с  NULLCbB ,,,,,,{,},   dd if   NULL  .}{\)()( 2   A A d   \)( {NULL} D а  RR 21 '',}, }.  A So, we have ({NULLSum n})  NULL , 4.3. Aggregate Operations k n1 nk Sum1 ,, k    nddd ii if all elements di , The five types of aggregate operations discussed i1 in this article are SUM, AVERAGE, MAXIMUM,  ,1 ki , differ from NULL . MINIMUM, COUNT. The aggregate operations transform a finite table into a table with single tuple In the case of the empty table   , R we have and single attribute. 1 Sum ,RA    NULLAR   A}{,,, , here Consider the table   RR )(, , where  is a    m . finite multiset and RA . Let  A be a multiset of Example 7. Let  , R be the Table 6. Then column with attribute A of table  , R which 1 contains all elements including duplicates. Sum ,RA      AAR }{,8,, ,

Then  A ssd  ,)((|{)( sdA )} 1 SumВ,R  R     ВВ }{,6,, ,  dAd },{|{   R }, is an analogue of  { },RA  1  1 active domain of the attribute A [5]. The number of SumС,R  R     СС }{,6,, . duplicates of element d   А )( is given by the following formula:  А d)(  Table 6. ψ, R  ({ ,dAOcc },  R  sOcc  ),(), . А В С  { },RA  1  s  ( ), s А)( d NULL 0 3 2 1 1 Let D'   2)(|{2 D' be a family of all m А 2 1 1 multisets, bases of which are the finite subsets of the 2 1 1 set D' . Here ' DD is a subset of the universal 2 3 NULL domain. Let Num is a numerical subset of the universal Let ≤ be a linear order on the universal domain domain D that is closed under addition. Extend the D . set Num by the special element NULL. We will not extend the operation of addition to the case where at least one of the arguments is NULL. Let’s define the aggregate operations. At first the 2 The top index 1 specifies that the table include the five aggregate functions – count, sum, average, tuple SumA  })(,{ only once, i.e. maximum, minimum – are defined on a finite A 1 {{ A Sum  A }})(, is {1}-multiset.

Copyright © 2016, Infonomics Society 716 International Journal of Intelligent Computing Research (IJICR), Volume 7, Issue 2, June 2016

Definition 20. The aggregate operation Min ,RA by In the case of the empty table   , R we have the attribute A of the finite table on scheme R , 1 Max   NULLAR A}{,,, , here RA , is a unary parametric operation of the form ,RA     

Min ,RA )(:  ({AR }) ,    m . 1 Example 9. Let be the Тable 6. Then Min ,RA    MinAR  A   A}{,)(,, , where 1 Max ,RA     AAR }{,2,, ,   RR )(, . The Min  A )( function is applied to a column with attribute in the table  , R , the 1 MaxВ,R  R     ВВ }{,3,, , result obtained is the minimum value among values 1 Max  R  СС }{,3,, of  A . In addition, NULL values don’t undertake in С,R      . attention. Definition 22. The aggregate operation Count ,RA D Thus, Min 2: m  D , by the attribute of the finite table on scheme , NULL if  A  ;)( , is a unary parametric operation of the form  Min  A )(  NULL if  A  {)( NULL}; Count ,RA )(:  ({AR }) ,  dd   {\)(|min{ NULL}}if   NULL  .}{\)(  A A 1 Count ,RA    CountAR  A   A}{,)(,, , where We have Min m )(  NULL , n ({NULLMin })  NULL , . The Count  A )( function is applied

n1 nk to a column with attribute A in the table , the 1 ,, ddMin k   1  dd k },,min{ if all elements result obtained is the count of all values of  di ,  ,1 ki , differ from NULL . A which differ from . In the case of the empty table   , R we have D 1 Thus, Count m  },2,1,0{2: , Min   NULLAR  A}{,,, , here ,RA    Count  )(   d .)( Put by definition that A  A d   \)( {NULL}    m . A Example 8. Let  , R be the Тable 6. Then the sum of an empty set of elements is equal to zero. So, we have Count m  0)( , 1 Min   AAR }{,2,, , n ,RA      Count({NULL })  0 ,

1 n1 nk MinВ,R  R     ВВ }{,0,, , 1 ,, k   1  nnddCount k if all elements ,

1 , differ from . MinС,R  R     СС }{,1,, . In the case of the empty table   , R we have Definition 21. The aggregate operation Max ,RA 1 Count   AAR }{,0,, , here   . by the attribute of the finite table on scheme , ,RA       m , is a unary parametric operation of the form Example 10. Let be the Тable 6. Then , ,RA )(:  ({ARMax }) 1 1 Count ,RA      AAR }{,4,, , Max ,RA    MaxAR  A   A}{,)(,, , where 1 Count В,R  R     ВВ }{,5,, , . The Max  A )( function is applied to 1 a column with attribute in the table , the CountС,R  R     СС }{,4,, . result obtained is the maximum value among values We assume that a numerical subset Num of the of  A . In addition, values don’t undertake in universal domain D is closed under the (partial attention. operation) division operation ~ D :/ NumNum  Num. We will determine the Thus, Max 2: m  D , division operation so that when the first argument is NULL if  A  ;)(  equal to NULL the function accepts value NULL . Max  A )(  NULL if  A  {)( NULL};  Definition 23. The aggregate operation Avg ,RA by  dd   A {\)(|max{ NULL}}if   A NULL  .}{\)( We have Max )(  NULL , the attribute of the finite table on scheme , m , is a unary parametric operation of the form ({NULLMax n})  NULL , ,RA )(:  ({ARAvg }) , n1 nk 1 ,, ddMax k   1  dd k },,max{ if all elements 1 Avg ,RA    ,, AvgAR  A    A}{, , where di , , differ from .

Copyright © 2016, Infonomics Society 717 International Journal of Intelligent Computing Research (IJICR), Volume 7, Issue 2, June 2016

1   RR )(, . The Avg A  function is applied to Count В,R  R     ВВ }{,5,,)( , a column with attribute A in the table  , R , the 1 Count  R  СС }{,5,,)( . result obtained is the mean of values in С,R     

 A which differ from NULL . Thus, Sum  )( 5. Conclusions Avg 2: Num  Num and Avg  )(  A . We m A Count  )( A In this paper the multiset table algebra is Sum m )( NULL considered. The concept of the table is specified, have Avg m )(   NULL , Count m 0)( using concept of a multiset. The signature of the n multiset table algebra is filled up with new n Sum({NULL }) ({NULLAvg })  n  NULL, operations such as inner and outer join, semijoin and Count({NULL }) aggregate operations. For each operations are defined n1 nk a basis of the resulting table and number of n1 nk Sum({ 1 ,, dd k }) ({ 1 ,, ddAvg k })   ({ n1 ,, ddCount nk }) duplicates of every tuple. The special element NULL 1 k is inserted in the universal domain for a define of k nd outer operations.  ii It should also be noted that a parameter of  i1 if all elements d ,  ,1 ki , differ (  nn ) i aggregate operations is not necessarily only a single 1 k attribute; it also can be some function of the tuples. from NULL . In the case of the empty table  , R we have  6. References

Avg ,RA       ANULLAR }{,,, , here [1] E.F. Codd, “A Relational Model for Large Shad Data    m . Banks”, Communications of the ACM, vo1.13, No.6, 1970, Example 11. Let  , R be the Тable 6. Then pp. 65-93.

1 [2] G. Lamperti, M. Melchiori, and M. Zanella, “On Avg ,RA      AAR }{,2,, , Multisets in Database Systems”, Multiset Processing:  1  Mathematical, Computer Science, and Molecular  6   Computing Points of View, number 2235 in Lecture Notes AvgВ,R  , R   ,   ВВ }{, ,  5   in Computing Since, Berlin: Springer-Verlag, 2001,   pp. 147-215.  1   6   [3] Paul W.P.J. Grefen, Rolf A. de By, “A Multi-Set AvgС,R  , R    ,   СС }{, .  4   Extended Relational Algebra. A Formal Approach to a   Practical Issue”, in Proceedings of the 10th International Definition 24. The aggregate operation Conference on Data Engineering, ICDE, February 14-18, 1994, Houston, TX, USA, 1994, pp. 80-88. Count ,RA )( by the attribute of the finite table on scheme R , RA , is a unary parametric operation [4] H. Garcia-Molina, J.D. Ullman, J. Widom, Database of the form Count ,RA )(:(*)  ({AR }) , Systems:The Complete Book. Prentice Hall, Upper Saddle River, New Jersey, 2009.  1 Count ,RA  ,)(  AR   A}{,, , where   [5] V. Redko, J. Brona, D. Buy, S. Poliakov, Relation   RR )(, , and  is the rank of the multiset Database: Relation Algebras and SQL-similar Languages. Kyiv, 2001. (in Ukrainian).  . The operation Count )( finds the number of [6] D.B. Buy, I.M. Glushko, “Extended of Table Algebr: ,RA Multiset Table Algebra”, Modern scientific research and tuples in the table  , R . their practical application, vol.J11309, Article CID Number 261, May, 2013. In the case of an empty table   , R we have 1 [7] A. Silberschatz, H. Korth, S. Sudarshan, Database Count ,RA     AR  m   A}{,,,)(  System Concepts. McGraw-Hill, 2011.

1     AA }{,0, , here    m . [8] I. Glushko “A Formal Mathematical Semantics of Advanced Operations of Multiset Table Algebra” in Example 12. Let be the Table 6. Then Proceedings of the 7th International Conference on 1 Information Technology, Amman: Al-Zaytoonah Count ,RA      AAR }{,5,,)( , University of Jordan, 2015, Р. 369-375.

Copyright © 2016, Infonomics Society 718 International Journal of Intelligent Computing Research (IJICR), Volume 7, Issue 2, June 2016

[9] N. Cutland, Computability. An introduction to recursive function theory. Cambridge University Press, London. 1980.

[10] A.B. Petrovsky, Space of sets and multisets. Moscow, 2003. (in Russian)

Copyright © 2016, Infonomics Society 719