Presentation is loading. Please wait.

Presentation is loading. Please wait.

DATA TYPES, DATABASES Gergely ZAJZON Dr. Med.. 2 DATABASE Simply:structured collection of data.

Similar presentations


Presentation on theme: "DATA TYPES, DATABASES Gergely ZAJZON Dr. Med.. 2 DATABASE Simply:structured collection of data."— Presentation transcript:

1 DATA TYPES, DATABASES Gergely ZAJZON Dr. Med.

2 2 DATABASE Simply:structured collection of data

3 3

4 4

5 5

6 6

7 7 DATABASE Simply:structured collection of data

8 8 DATABASE Simply:structured collection of data Storage: a collection of tables connecting to each other

9 9 DATABASE In 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. structured The records retrieved in answer to queries are information that can be used to make decisions.information

10 10 DATA Data 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 11 DATA - examples PATIENT DATA: - name - birth date - address - „TAJ” – patient code Phone book: - name - address - phone number

12 12 INFORMATION 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..dataknowledge The Sesame Street character Cookie Monster describes information as "news or facts about something."Sesame Street Cookie Monster

13 13 INFORMATION Why do we create databases? Storing and searching of data Retrieval of new informations from stored data collections

14 14 DATA TYPES Basic property of data fields Defines: –a set of values –structure of data –allowable operations on those values Makes it possible, that in one column of a table only same type of data can be stored.

15 15 BASIC DATA TYPES Can not be divided to further separete parts

16 16 COUNTABLE DATA TYPE CLASSESS NUMERIC Byte0-2558 bit Shortint(-128)-1278 bit Integer(-32768)-3276716 bit LOGICAL1 or 01 bit CHARACTERAny characters1 byte (8 bit)

17 17 REAL DATA TYPE CLASSESS Numeric real data types Real(-2,9*10 -39 )-(1,7*10 38 )48 bit Single(-1,5*10 -45 )-(3,4*10 38 )32 bit Double(-5*10 -324 )-(1,7*10 308 )64 bit Extended(-3,4*10 -4932 )- (1,1*10 4932 ) 80 bit Comp-2 -63 + 1..2 63 -164 bit

18 18 DATA TYPE Choosing the correct data type: –Helps making your database more structured –Eg.: 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

19 19

20 20 Data Types Binary –Database specific binary objects –Pictures, digital signatures, etc. Boolean –True/False values Character –Fixed width or variable size Numeric –Integer, Real (floating decimal point), Money Temporal –Time, Date, Timestamp

21 21 SPREADSHEET DATABASE Spreadsheet (EXCEL table): structured. - search - order - filter Software: Eg.: MS-Excel

22 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 23 SPREADSHEET DATABASE TAJNameAddressBirth date.:Phone number: 123456789Iv BélaBp. 1014 Palota utca 1 1235.12.20.06-1-2020030 234567890Könyves Kálmán IV. kerület Mély utca 3 1308.Jan.1+36-20-1234567 345678901Harmadi k András Székesfehérvár 8000 Fő út 4. 1290-04-01(30) 1234567 456789012Dobzse László Bp. 1031 Kis utca 31492.Március 22345678 012345678Kalapos József Bp. 1220 Nagy utca 1 30/04/183506201234321

24 24 SPREADSHEET DATABASE Disadvantages of Spreadsheet -The same data set can only be modified by one user at the same time -Storage of data is not safe enough -Structure of data and connections are not defined

25 25 SPREADSHEET DATABASE Disadvantages of Spreadsheet -Logical limit: can not use multiple tables easiliy, as connections between tables can not be defined

26 26 SPREADSHEET DATABASE NamePostal code CityAddressDoctorOff_P C Office_cityOff_addressOffice_phone Balla Béla2080ÉrdFő u. 3.Dr. House1191BudapestKék u. 3.405-2039 Kis Péter1022BudapestKis u. 2.Dr. Green1221BudapestFa u. 5.373-8022 Nagy Irén1134BudapestÚj u. 4.Dr. House1191BudapestKék u. 3.303-1048 Pók Géza2560DiósdTár u. 9.Dr. Kovac2205DiósdZár u. 10.323-581 INDIRECT PROPERTY => REDUNDANCY, MISTAKES IN DATA INPUT

27 27

28 28

29 29

30 30

31 31

32 32 DATABASE Data collection organized on the basis of a data model. Contains: – data –Structure of data –Connection rule descriptions

33 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 34 DATA MODEL CONCEPTUAL DATA MODEL: Analysis of the informations and connections between them. Independent from software tools PHYSICAL DATA MODEL: Structured used in the database:definition of tables, data types, connection Software dependent

35 35 CONCEPTUAL DATA MODEL MOZIK MOZI_ID MOZICIM MOZITEL MOZIWEB MOZINEV M FILMEK FILM_ID HOSSZ NYELV RENDEZO FILMCIM PK N

36 36 PHYSICAL DATA MODEL MOZIK MOZI_ID MOZICIM MOZITEL MOZIWEB MOZINEV 1 FILMEK FILM_ID HOSSZ NYELV RENDEZO FILMCIM PK 1 MOZI__FILM MOZIFILM_ID FILM_FK VETITES MOZI_FK PK N N

37 37 Parts of a database Attributes (fields) –An attribute or field is a component of a record that describes something about an item. Records –A record is the representation of an individual item. Table –A collection of records Database –A collection of tables and rules for accessing the tables

38 38 Parts of a database Record Attribute/Field Tables Records become “rows” Attributes/fields become “columns” Rules determine the relationship between the tables and tie the data together to form a database

39 39 Referential Integrity Rules to preserve relationships Prevents orphan records –Cannot add records on many sides –Cannot delete from one side Cascade update Cascade delete

40 40 NORMAL FORMS The 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 41 Normalizing Dependencies between data are identified Redundant data is minimized Reduces chances of data errors Reduces disk space The data model is flexible and easier to maintain

42 42 First Normal Form Eliminate repeating columns in each table Create a separate table for each set of related data Identify each set of related data with a primary key Contacts IdNameCompanyAddressPhoneZipCode 1JoeABC123553212345 1JoeABC123223412345 1JoeABC123321112345 2JaneXYZ456342114454 3ChrisPDQ789234114423 3ChrisPDQ789665514423 Benefits: 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 43 Second Normal Form Create separate tables for sets of values that apply to multiple records Relate these tables with a “foreign key”. People IdNameCompanyAddressZip 1JoeABC12312345 2JaneXYZ45614454 3ChrisPDQ78914423 PhoneNumbers PhoneIDIdPhone 115532 212234 313211 423421 532341 636655

44 44 Third Normal Form Eliminate fields that do not depend on the primary key. People IdNameAddressID 1Joe1 2Jane2 3Chris3 Address AddressIDCompanyAddressZip 1ABC12312345 2XYZ45614454 3PDQ78914423 PhoneNumbers PhoneIDIdPhone 115532 212234 313211 423421 532341 636655 Is this enough? Codd thought so… What about “many to many”?

45 45 Kinds of Relationships “One to One” –One row of a table matches exactly to another One person, one id number, one address “One to Many” –One row of a table matches many of another One person, many phone numbers “Many to Many” –One row may match many of another or many rows match one row of another

46 46 TAJNévIrszVárosCímHáziorvosRend_irszRend_városRend_címRendMh_tel 123456789Balla Béla2080ÉrdFő u. 3.Dr. Ház1191BudapestKék u. 3.405-2039 123456790Kis Péter1022BudapestKis u. 2.Dr. Zöld1221BudapestFa u. 5.373-8022 123456791Nagy Irén1134BudapestÚj u. 4.Dr. Ház1191BudapestKék u. 3.303-1048 123456792Pók Géza2560DiósdTár u. 9.Dr. Kovács2205DiósdZár u. 10.323-5819 TAJNévIrszVárosCímHáziorvo s 1234567 89 Balla Béla 20 80 ÉrdFő u. 3. Dr. Ház 1234567 90 Kis Péter 10 22 Budape st Kis u. 2. Dr. Zöld 1234567 91 Nagy Irén 11 34 Budape st Új u. 4. Dr. Ház 1234567 92 Pók Géza 25 60 DiósdTár u. 9. Dr. Kovács HáziorvosRend_ir sz Rend_vár os Rend_cí m RendMh_t el Dr. Ház1191BudapestKék u. 3.405-2039 Dr. Zöld1221BudapestFa u. 5.373-8022 Dr. Ház1191BudapestKék u. 3.303-1048

47 47 BETEGEK TAJ IRSZ VAROS CIM NEV PK HAZIORVOS REND IRSZ REND VAROS REND_CIM RENDMH_TEL BETEGEK TAJ IRSZ VAROS CIM NEV M ORVOSOK PECSÉT IRSZ VAROS TEL ORVOS PK N CIM

48 48 DATA MANAGEMENT LANGUAGE SQL = Structured Query Language DDL – Data Definition (CREATE) DML – Data Manipulation (INSERT, UPDATE, DELETE) QL – Query Language (SELECT)

49 49 TABLE TYPES Main (core) tables Subtables Linking tables (association table) Dictionary tables (look-up table, value list)

50 50 DATABASE SERVER A 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.computer program database computersclient-servermodelDatabase management systemsDBMS'sMySQL Database Master servers are central and main locations of data while Database Slave servers are synchronized backups of the master acting as proxies.

51 51 DATABASE SERVER Special DBMS software user interface is not an important aim Allows multi-user change access Controll of user rights Backup of stored data Transaction management

52 52 DATABASE SERVERS Oracle MS-SQL My-SQL PostgreSQL

53 53 Gergely Zajzon Dr. Med. E-mail:zajzon.gergely@zazacom.huzajzon.gergely@zazacom.hu Web:http://www.gyogyszerugy.huhttp://www.gyogyszerugy.hu Telefon:+36-20-9604294


Download ppt "DATA TYPES, DATABASES Gergely ZAJZON Dr. Med.. 2 DATABASE Simply:structured collection of data."

Similar presentations


Ads by Google