8 DATABASE Simply: structured collection of data Storage: a collection of tables connecting to each other
9 DATABASEIn computer science, a database is a structured collection of records or data that is stored in a computer system so that a computer program or person using a query language can consult it to answer queries.The records retrieved in answer to queries are information that can be used to make decisions.
10 DATAData is visualised form of some kind of knowledge. Representative property of somebody or something.From IT perspective: data is coded information, stored in a computer as a signal sequence.Has to be stored in a structured and processable form
11 DATA - examples PATIENT DATA: - name - birth date - address - „TAJ” – patient codePhone book: - name - address - phone number
12 INFORMATIONThe Sesame Street character Cookie Monster describes information as "news or facts about something."Measure unit of information:bit: value can be 1 or 0 (true / false).Information is the result of processing, gathering, manipulating and organizing data in a way that adds to the knowledge of the receiver..
13 INFORMATION Why do we create databases? Storing and searching of data Retrieval of new informations from stored data collections
14 DATA TYPES Basic property of data fields Defines: a set of valuesstructure of dataallowable operations on those valuesMakes it possible, that in one column of a table only same type of data can be stored.
15 BASIC DATA TYPESCan not be divided to further separete parts
16 COUNTABLE DATA TYPE CLASSESS NUMERICByte0-2558 bitShortint(-128)-127Integer(-32768)-3276716 bitLOGICAL1 or 01 bitCHARACTERAny characters1 byte (8 bit)
17 REAL DATA TYPE CLASSESS Numeric real data types (-2,9*10-39)-(1,7*1038)48 bitSingle(-1,5*10-45)-(3,4*1038)32 bitDouble(-5*10-324)-(1,7*10308)64 bitExtended(-3,4* )-(1,1*104932)80 bitComp
18 DATA TYPE Choosing the correct data type: Helps making your database more structuredEg.: a field containing birth dates should be DATE type.Helps validating your data:Eg.: DATE field can not contain a date like 31. february 2008.You can not enter a text into an INTEGER field
20 Data Types Binary Boolean Character Numeric Temporal Database specific binary objectsPictures, digital signatures, etc.BooleanTrue/False valuesCharacterFixed width or variable sizeNumericInteger, Real (floating decimal point), MoneyTemporalTime, Date, Timestamp
22 SPREADSHEET <-> DATABASE „Excel database”: table with special layout:Rows of the table are connected with eachoter, containing the properties of one selected object. Columns: containing the same kind of property for each object. The table has a header in the first row.
23 SPREADSHEET <-> DATABASE TAJNameAddressBirth date.:Phone number:Iv BélaBp Palota utca 1Könyves KálmánIV. kerület Mély utca 31308.Jan.1Harmadik AndrásSzékesfehérvár 8000 Fő út 4.(30)Dobzse LászlóBp Kis utca 31492.Március 2Kalapos JózsefBp Nagy utca 130/04/1835
24 SPREADSHEET <-> DATABASE Disadvantages of SpreadsheetThe same data set can only be modified by one user at the same timeStorage of data is not safe enoughStructure of data and connections are not defined
25 SPREADSHEET <-> DATABASE Disadvantages of SpreadsheetLogical limit: can not use multiple tables easiliy, as connections between tables can not be defined
26 SPREADSHEET <-> DATABASE NamePostal codeCityAddressDoctorOff_PCOffice_cityOff_addressOffice_phoneBalla Béla2080ÉrdFő u. 3.Dr. House1191BudapestKék u. 3.Kis Péter1022Kis u. 2.Dr. Green1221Fa u. 5.Nagy Irén1134Új u. 4.Pók Géza2560DiósdTár u. 9.Dr. Kovac2205Zár u. 10.INDIRECT PROPERTY => REDUNDANCY, MISTAKES IN DATA INPUT
32 DATABASE Data collection organized on the basis of a data model. Contains:dataStructure of dataConnection rule descriptions
33 DATA MODEL A logical structure, defining the layou of the stored data. Contains no data values.Only properties of data, structure and possible connections
34 DATA MODEL CONCEPTUAL DATA MODEL: Analysis of the informations and connections between them.Independent from software toolsPHYSICAL DATA MODEL:Structured used in the database:definition of tables, data types, connectionSoftware dependent
35 CONCEPTUAL DATA MODEL MOZIK FILMEK PK MOZI_ID PK FILM_ID M N MOZINEV FILMCIMMOZICIMHOSSZMOZITELNYELVMOZIWEBRENDEZO
36 PHYSICAL DATA MODEL MOZI__FILM FILMEK MOZIK PK MOZIFILM_ID N PK MOZI_FKPKMOZI_IDN1FILMCIM1MOZINEVFILM_FKHOSSZMOZICIMVETITESNYELVMOZITELRENDEZOMOZIWEB
37 Parts of a database Attributes (fields) Records Table Database An attribute or field is a component of a record that describes something about an item.RecordsA record is the representation of an individual item.TableA collection of recordsDatabaseA collection of tables and rules for accessing the tables
38 Parts of a database Record Tables Attribute/Field Records become “rows”Attributes/fields become “columns”Rules determine the relationship between the tables and tie the data together to form a database
39 Referential Integrity Rules to preserve relationshipsPrevents orphan recordsCannot add records on many sidesCannot delete from one sideCascade updateCascade delete
40 NORMAL FORMSThe normal forms (abbrev. NF) of relational database theory provide criteria for determining a table's degree of vulnerability to logical inconsistencies and anomalies. The higher the normal form applicable to a table, the less vulnerable it is to such inconsistencies and anomalies. Each table has a "highest normal form" (HNF): by definition, a table always meets the requirements of its HNF and of all normal forms lower than its HNF; also by definition, a table fails to meet the requirements of any normal form higher than its HNF.The normal forms are applicable to individual tables; to say that an entire database is in normal form n is to say that all of its tables are in normal form n.
41 Normalizing Dependencies between data are identified Redundant data is minimizedReduces chances of data errorsReduces disk spaceThe data model is flexible and easier to maintain
42 First Normal Form Contacts Eliminate repeating columns in each table Create a separate table for each set of related dataIdentify each set of related data with a primary keyContactsIdNameCompanyAddressPhoneZipCode1JoeABC123553212345223432112JaneXYZ4563421144543ChrisPDQ7892341144236655Benefits: Now we can have infinite phone numbers or company addresses for each contact.Drawback: Now we have to type in everything over and over again. This leads to inconsistency, redundancy and wasting space. Thus, the second normal form…
43 Second Normal FormPeopleIdNameCompanyAddressZip1JoeABC123123452JaneXYZ456144543ChrisPDQ78914423Create separate tables for sets of values that apply to multiple recordsRelate these tables with a “foreign key”.PhoneNumbersPhoneIDIdPhone155322223433211434215234166655
44 Third Normal FormEliminate fields that do not depend on the primary key.PeopleIdNameAddressID1Joe2Jane3ChrisPhoneNumbersPhoneIDIdPhone155322223433211434215234166655AddressAddressIDCompanyZip1ABC123123452XYZ456144543PDQ78914423Is this enough? Codd thought so…What about “many to many”?
45 Kinds of Relationships “One to One”One row of a table matches exactly to anotherOne person, one id number, one address“One to Many”One row of a table matches many of anotherOne person, many phone numbers“Many to Many”One row may match many of another or many rows match one row of another
46 TAJNévIrszVárosCímHáziorvosRend_irszRend_városRend_címRendMh_telBalla Béla2080ÉrdFő u. 3.Dr. Ház1191BudapestKék u. 3.Kis Péter1022Kis u. 2.Dr. Zöld1221Fa u. 5.Nagy Irén1134Új u. 4.Pók Géza2560DiósdTár u. 9.Dr. Kovács2205Zár u. 10.HáziorvosRend_irszRend_városRend_címRendMh_telDr. Ház1191BudapestKék u. 3.Dr. Zöld1221Fa u. 5.TAJNévIrszVárosCímHáziorvosBalla Béla2080ÉrdFő u. 3.Dr. HázKis Péter1022BudapestKis u. 2.Dr. ZöldNagy Irén1134Új u. 4.Pók Géza2560DiósdTár u. 9.Dr. Kovács
48 DATA MANAGEMENT LANGUAGE SQL = Structured Query LanguageDDL – Data Definition (CREATE)DML – Data Manipulation (INSERT, UPDATE, DELETE)QL – Query Language (SELECT)
49 TABLE TYPES Main (core) tables Subtables Linking tables (association table)Dictionary tables (look-up table, value list)
50 DATABASE SERVERA database server is a computer program that provides database services to other computer programs or computers, as defined by the client-server model. The term may also refer to a computer dedicated to running such a program. Database management systems frequently provide database server functionality, and some DBMS's (e.g., MySQL) rely exclusively on the client-server model for database access.Database Master servers are central and main locations of data while Database Slave servers are synchronized backups of the master acting as proxies.
51 DATABASE SERVER Special DBMS software user interface is not an important aimAllows multi-user change accessControll of user rightsBackup of stored dataTransaction management
Your consent to our cookies if you continue to use this website.