par kortežu (tuple) - web viewteradata, caltech, 1979 (paralēlas darbības relāciju modelis)...
TRANSCRIPT
Datu bāzes sistēmu tehnoloģiju attīstības shēma
1)2)3)
4)5)6)
7)8)9)
10)11)12)13)
1960 1970 1980 1990 2000 2010 2016Tīkla modelis Relāciju modelis Paralēlisms Izkliedētība Relāciju-objektu modelis Klasteri (mērogojamība) Speciālās klasteru sistēmasHierarhiskais modelis OLTP Kolonveida glabāšana Datu noliktava (OLAP) Speciālie modeļi (ne relāciju)
Integrated Data Store (IDS), C.W.Bachman, 1963 (ierobežots datu tīkls)
Integrated Database Management System (IDMS), B.F.Goodrich, 1969 (tīkla modelis)
Information Management System (IMS), V.Watts, 1968 (hierarhiskais modelis)
Micro DBMS, Mičigānas universitāte, 1969 (relāciju modelis)
System R, IBM San Jose laboratorija, 1969 (relāciju modelis)
Ingres, Kalifornijas universitāte, 1974 (relāciju modelis)
dBaseII, Ashton-Tate Corporation, 1980 (relāciju modelis)
Oracle v.1, L.Ellison, 1978 (relāciju modelis)
DB2, IBM, 1983 (relāciju modelis)
MS SQL Server, 1989 (relāciju modelis)
PostgreSQL, Kalifornijas universitāte, M. Stonrbraker, 1986 - 1994 (relāciju – objektu modelis)
Teradata, Caltech, 1979 (paralēlas darbības relāciju modelis)
Sybase IQ, Expressway Technologies, 1990 (relāciju modelis ar kolonveida datu glabāšanu)
DB2 Parallel Edition, IBM, 1995 (izkliedēta homogēna relāciju datu bāze)
Netezza, F. Hinshaw, 2003 (datu noliktava ar paralēliem mezgliem)
Map Reduse, J. Dean, S. Ghemawat, 2004 (lielu datu klasteru apstrādes tehnoloģija)
Pivotal Greenplum Database, Pivotal, 2010 (masveida paralēlo procesu izmantošana ar galvenajiem un segmentu mezgliem)
Bigtable, Google, 2006 (triju dimensiju attēlošana: rindas atslēga, kolonas atslēga, laika iezīme)
Dynamo,Amazon, 2007, (atslēga – vērtība izkliedēta sistēma)
Aster Data Systems, 2005, (masveida paralēlo procesu izmantošana ar SQL, MapReduce un Graph tehnoloģijām)
Vertica Systems, M. Stonebraker, A. Palmer, 2005, (klasteru un kolinveida glabāšanas izmantošana datu noliktavās)
Apache Hadoop, 2006, (izkliedētu datu glabāšana un apstrāde lietojot standarttehnikas klasteru tehnoloģiju)
Oracle Exadata Database Machine, 2008, (masveida paralēlo procesu izmantošana ar SQL, MapReduce un Graph tehnoloģijām)
NoSQL sistēmas, 2009 (horizontāla mērogošana (klasteri), nav shēmas)
NoSQL+NewSQL, 2015
NewSQL sistēmas, 2011 (izkliedēta sistēma, klasteri bez koplietošanas, optimizēta (intelektuāla) glabāšana, datu nodalīšana)
Relāciju datu bāzes ēra (1970 - )
Relāciju datu bāzes teorētiskos pamatus izstrādāja Edgars (Teds) F. Kodds (1923 – 2003) firmas IBM San Hosē pētniecības laboratorijā (tagad IBM Almadenas pētniecības centrs) 70 – ajos gados.
Kodds izveidoja relāciju datu modeli, relāciju algebru (relational algebra) un relāciju rēķinus (relational calculus).
E.F. Koda relāciju DB definējošie darbi:1. A relational model for data for large shared data banks, CACM, 1970.2. Relational completeness of data base sublanguages”, in: Database Systems, ed. by R. Rustin, 1972.
70 – ajos gados tika izstrādāti divi lieli projekti realizējot relāciju datu bāzes sistēmas:1) 1974. tika uzsākta IBM firmas sistēmas System R izstrāde. Tās pirmais komerciālais variants bija produkts SQL/DS.2) Berklija universitātē Kalifornijā tika izveidota komerciāla relāciju datu bāzes sistēma INGRES. Pirmā pilnvērtīgā komerciāla relāciju datu bāzes sistēma bija Relational Softwere firmas (tagad Oracle korporācija) izstrādne Oracle 1979. gadā.
E. F. Kodda 12 noteikumi relāciju datu bāzēm
0. A relational DBMS must be able to manage databases entirely through its relational capabilities.1. Information rule. All information in a relational database (including table and column names) is represented explicitly as values in tables.2. Guaranteed access. Every value in a relational database is guaranteed to be accessible by using a combination of the table name, primary key value, and column name.3. Systematic null value support. The DBMS provides systematic support for the treatment of null values (unknown or inapplicable data), distinct from default values, and independent of any domain.4. Active, online relational catalog. The description of the database and its contents is represented at the logical level as tables and can therefore be queried using the database language.5. Comprehensive data sublanguage. At least one supported language must have a well-defined syntax and be comprehensive. It must support data definition, manipulation, integrity rules, authorization, and transactions.6. View updating rule. All views that are theoretically updatable can be updated through the system.7. Set-level insertion, update, and deletion. The DBMS supports not only set-level retrievals but also set-level inserts, updates, and deletes.8. Physical data independence. Application programs and ad hoc programs are logically unaffected when physical access methods or storage structures are altered.9. Logical data independence. Application programs and ad hoc programs are logically unaffected, to the extent possible, when changes are made to the table structures.10. Integrity independence. The database language must be capable of defining integrity rules. They must be stored in the online catalog, and they cannot be bypassed.11. Distribution independence. Application programs and ad hoc requests are logically unaffected when data is first distributed or when it is redistributed.12. Nonsubversion rule. It must not be possible to bypass the integrity rules defined through the database language by using lower-level languages.
3
Relāciju datu bāzes pamatelements- relācija
Relācija ir datu struktūra, kas sastāv no virsraksta un no nesakārtotas vienāda tipa kortežu kopas.
Par kortežu (tuple) matemātikā sauc sakārtotu, galīgu elementu virkni. Kortežu vienkāršoti sauc arī par rindu (row) jeb rakstu.
4
Relāciju algebras pamatdarbības
Relāciju algebru izstrādāja E.F. Kodds (19. g. s. 70 – ie gadi).
1. Apvienošana R = R1 U R2 R1 R2 Ra b vd e ai k lg d ei k la b vd e ai k lg d e
2. Starpība R = R1 – R2 R1 R2 Ra b vd e aa b vd e ai k lg d ei k l
a b v g d ed e a g d ei k l g d ea b v i k ld e a i k li k l i k l3. Dekarta reizinājums R = R1 x R2
5
a bd ei k4. Projekcija R = proj i1, i2(R1) R = proj 1, 2 (R1)
5. Selekcija (atlase) R = selF(R1) R = sel (R1) I1 = a vai I2 = k
R a b vi k l
6
Relāciju algebras pamatdarbības (turpinājums)
6. Pārklāšanās R = R1 ∩ R2
R1 R2 R i k la b vd e ai k lg d ei k l
7. Dalīšana R = R1/R2 R1 R2 Ri o c ao p c ac k p ki o p kc ap ki o
8. Teta savienojums R1 R2 RA B Ca b ca i pd e zD Ea ie kA B C D Ed e z e k R = R1 ►◄ R2 B=D
7
9. Dabiskais savienojums R1 R2 RA Bk mC Bt mA B Ck m t R = R1 ►◄ R2
Relāciju algebras papilddarbības
1. Kortežu – dublikātu dzēšana (duplicate-elimination operator).
2. Agregēšanas operatori (aggregation operators): SUM, AVG, MIN, MAX, COUNT. SUM(α ) , α - agregējamais atribūts.
3. Grupēšanas operators (grouping operator): γ L (R) , L - grupējošais atribūts vai atribūti.
4. Šķirošanas operators:
8
τ L (R) , L – šķirošanas kārtības atribūts vai atribūti.
5. Paplašinātais projekcijas operators (extended projection operator):
π A, B + C D (R)
6. Ārējo savienojumu operatori (outerjoin operators):- kreisais ārējais savienojums;- labais ārējais savienojums.
9
Relāciju datu bāze
Relāciju datu bāzes izmanto fiksēta formāta savstarpēji saistītas rakstu kopas - tabulas. Datu bāze, kurā viena tipa rakstos ir norādes uz cita tipa rakstiem, tiek saukta par relāciju datu bāzi. Relāciju datu bāze dod iespēju lietotājam saistīt informāciju, kas tiek glabāta dažādās tabulās, kā arī veidot noteiktas attiecības starp dažāda tipa rakstiem. Relāciju datu bāzes veido savstarpēji saistītas tabulas. Relāciju datu bāzes pamatvienība ir tabula.
Datu tabula raksturo, kādu noteiktu realitāšu (entity) jeb būtību kopu:1) katra rinda atbilst noteiktai realitātei;2) katra aile (kolona) atspoguļo attiecīgās realitātes atribūta īpašības. Tabulas ailes mēdz dēvēt par laukiem.Tabulas rindu (rakstu) skaits ir praktiski neierobežots, bet aiļu (lauku) skaits ir ierobežots. Iepriekš jādefinē, kāda veida dati katrā laukā tiks ievadīti.
Relāciju teorijas termini Termini, kurus lieto izmantojot SQL valodu
relācija (relation, relvar) tabulaatvasinātā tabula (derived relvar) skats (view), vaicājuma rezultātskortežs (tuple) rinda (row), rakstsatribūts (attribute) kolona (column)relācijas shēma (relation scheme, set of attributes) kolonu nosaukumu kopa
atribūta vērtība kolonas locekļa vērtība
Relāciju datu bāzes sistēmu pirmsākumi
10
11
Pirmā "desktop" relāciju datu bāze - dBASE
The first successful DBMS for personal computers, originally named Vulcan, dBASE was created by Wayne Ratliff to manage a company football pool at Jet Propulsion Labs in Los Angeles. Renamed dBASE II when Hal Lashlee and George Tate formed Ashton-Tate to market it in 1981, dBASE became a huge success within a couple of years. In 1991, Borland acquired the company.In 1999, dBASE, Inc. acquired dBASE from Borland.dBASE spawned the "Xbase" industry, which included FoxPro (now Visual FoxPro), Arago, Force, dbFast, dbXL, Quicksilver, Clipper, Xbase++, FlagShip, Recital's Terminal Developer, Harbour/XHarbour and other products that provided a dBASE-like programming language and support for dBASE file formats.
Version Bits Year OSdBASE II 16 1981 CP/MdBASE II 16 1982 DOSdBASE III 16 1984 DOSdBASE III+ 16 1986 DOSdBASE IV 16 1988 DOSdBASE 5 16 1994 WindowsVisual dBASE 5.5 16 1995 WindowsVisual dBASE 5.7 16 1999 WindowsVisual dBASE 7.0 32 1997 WindowsVisual dBASE 7.5 32 1999 WindowsdB2K 32 2000 WindowsdBASE Plus 32 2002 Windows
12
Mūsdienu "desktop" datu bāzes
1. Access is the "Old Faithful" of desktop databases. You'll find the familiar Microsoft interface and a thorough online help system. The greatest strength of Access is its tight integration with the remainder of the Office suite. It also serves as a great front-end for any ODBC-compliant server database. Access 2007 is available as a stand-alone product or in the Office Professional suite. You can typically purchase the stand-alone version for around $199.
2. FileMaker Pro is extremely popular among Macintosh users, but it's rapidly gaining market share among the PC crowd as well. It offers an intuitive interface and hides many of the complexities inherent in database management. It's also ODBC compliant and offers some integration capability with Microsoft Office. The most recent version is FileMaker Pro 8.5 which retails for around $299.
3. Alpha Five offers an alternative to the mainstream Access and FileMaker solutions. It's targeted at the database beginner and makes use of intuitive wizards to facilitate getting up and running quickly. Pricing starts at $199 for the Desktop Edition (which lacks support for web applications) and the product is only available directly from the manufacturer's website.
4. Paradox comes bundled with Corel's Word Perfect Office X3 Professional suite. It's a fully functional database system and offers JDBC/ODBC integration with other databases. However, it's not as user-friendly as some of the more mainstream DBMSs. In the mid-1980s, Paradox was the first DBMS on a PC that made linking tables easier. The ability to associate relationships by typing sample words was a breakthrough for that time.
5. Lotus offers the Approach DBMS as part of their SmartSuite office productivity package. Designed to compete with Microsoft Office, SmartSuite contains a word processor, spreadsheet (the old standby Lotus 1-2-3), presentation package and more.
13
Datu bāzes vadības sistēmas ar relācuju DB iespējām
14
Relāciju datu bāzes elementi
Primārā atslēga unikāli definē rakstu datu bāzes tabulā. Primārās atslēga vērtības nedrīkst atkārtoties. Primāro atslēgu veido viena vai vairākas kolonas.
Ārējā atslēga (foreign key) ir kolona vai kolonas tabulā, kura atbilst primārajai atslēgai citā tabulā. Ārējām atslēgām nav jābūt unikālām.
Domēns apraksta iespējamo vērtību kopumu konkrētai kolonai vai kolonām un to var uzskatīt par kolonas (kolonu) vērtību ierobežojumu.
Tabula FIRMASF_NUM NOS TELEF1 Stars 671122332 Medus 672233443 Priedes 67334455
Tabula DARBINIEKID_NU
MUZV ALGA NUM_F
10 Koks 400 111 Zars 350 112 Celms 550 213 Sakne 500 2
Tabula UZDEVUMIU_NUM U_NOS NUM_D101 1_uzd 10102 2_uzd 10103 3_uzd 11104 4_uzd 12105 5_uzd 12106 6_uzd 13
1 N
1N
15
Relāciju datu bāzes tabulu savienojums
Tabula FIRMASF_NUM NOS TELEF1 Stars 671122331 Stars 67112233
Tabula DARBINIEKID_NU
MUZV ALGA NUM_F
10 Koks 400 111 Zars 350 1
16
Relāciju datu bāzes datu struktūra
Tabula FIRMAS
1. raksts 2. raksts 3. raksts
1 Stars 67112233
2 Medus 67223344 3 Priedes 67334455
Tabula DARBINIEKI
1. raksts 2. raksts 3. raksts
10 Koks 400 1 11 Zars 350 1
17
Tabulu sasaiste ar nevienādības tipa noteikumu
KRAVA > MAX_KRAVA
Tabula AUTOMAŠĪNASA_NU
MFIRMA MAX_KRAVA
(max t)1 FORD 102 FORD 203 BMW 154 BMW 30
Tabula KRAVASK_NUM K_NOS KRAVA
(t)10 1. krava 1511 2. krava 2012 3. krava 25
Tabula AUTOMAŠĪNASK_NUM K_NOS A_NUM FIRMA10 1. krava 1 FORD10 2. krava 1 FORD11 2. krava 3 BMW12 3. krava 1 FORD12 3. krava 2 FORD12 3. krava 3 BMW
18
Tabulu saite daudzi ar daudziem (N : M)
Tabula STUDENTIS_NUM UZV VAR1 Koks Rasma2 Zars Juris3 Celms Inese4 Lapa Zane
Tabula PASNIEDZĒJIP_NUM UZV VAR101 Egle Varis102 Bite Agris103 Liepa Nauris
Tabula SAITESS_NUM P_NUM
1 1011 1032 1012 1033 1013 1024 102
19
Tabulas saite ar sevi (viens priekšnieks vairāki padotie)
Tabula DARBINIEKID_NUM UZV P_NUM1 Koks2 Zars 13 Celms 14 Lapa 3
1
2 3
4
20
Relāciju datu bāzes pamatiezīmesPamatkoncepcijas Datu bāzes shēma Datu bāzes vadības
sistēmas funkcijasDatu bāzes valodas Priekšrocības un trūkumi
The internal structure of an operating database is basically fixed in the "row" direction.The user will interact with a logical view of the data, and need not know anything about the actual internal structure.
Conceptual schema: logically describes all data in the databaseInternal schema (physical schema): describes how data are actually stored.External schema (user view): describes the data which are interested by user.
Data dictionary managementData storage managementData transformation and presentationSecurity managementMulti-user access controlBackup and recovery managementData integrity managementDatabase language and application programming interfacesDatabase communication interfaces
Data definition language (DDL): define database schemasData manipulation language (DML): to retrieve, insert, delete and update data in the database. Query language are part of DMLData control language (DCL): control the access of data.
Advantages: Control of data redundancy, consistency, abstraction, sharingImproved data integrity, security, enforcement of standards and economy of scale.Balanced conflicting requirementsImproved data accessibility, responsiveness, maintenanceIncrease productivity, concurrency, backup and recovery services.Disadvantages: Complexity, size, cost of DBMSsHigher impact of a failure
Sākotnējā praktiskā darbība kursā DB1
Datu bāzes sistēmaMS Access 2007
Datu bāzes sistēmaOracle11g
Datu bāzes sistēmamySQL
Datu bāzes sistēmaPostgreSQL
SQL redaktors
Sasaistes vide
DBT
Lai Jums veicas!
Neesat izmantojamās tehnikas vergi!Esiet saimnieki!
23