6
TDDD37 TDDD37 Database technology Fang Wei6Kleiner [email protected] h?p://www.ida.liu.se/~TDDD37 TDDD37 Todays lecture Formalities about the course Database introduction Data models and history Course content SQL (part1) 2 TDDD37 Course organisation 12 lectures Wri?en exam Lab exercises o 2 computer labs o 1 paper lab Project work 3 TDDD37 Teaching staff Fang Wei6Kleiner: Examiner, lecturer and lab assistant. Jose M. Peña: Lecturer and lab assistant. 4 TDDD37 Course literature Elmasri, R., Navathe, S., Fundamentals of Database Systems, 6th edition, Addison6Wesley, 2011 Lab compendium (available from the course website) 5 TDDD37 Laboratory schedule Lab schedule on the course web6page. o One group has two rooms. Project work: Less supervision. o One mandatory section discussing your data model. 6

Data%models%and%history2 Database%technology2

  • Upload
    others

  • View
    19

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Data%models%and%history2 Database%technology2

TDDD37

TDDD37%%Database%technology2

Fang%[email protected]

h?p://www.ida.liu.se/~TDDD372

TDDD37

Todays%lecture2

•  Formalities%about%the%course2•  Database%introduction2•  Data%models%and%history2•  Course%content2

•  SQL%(part1)2

22

TDDD37

Course%organisation2

•  12%lectures2•  Wri?en%exam2•  Lab%exercises2

o  2%computer%labs2o  1%paper%lab%2

•  Project%work2

32 TDDD37

Teaching%staff2

•  Fang%Wei6Kleiner:%Examiner,%lecturer%and%lab%assistant.2•  Jose%M.%Peña:%Lecturer%and%lab%assistant.2

42

TDDD37

Course%literature2

•  Elmasri,%R.,%Navathe,%S.,%Fundamentals%of%Database%Systems,%6th%edition,%Addison6Wesley,%20112

•  Lab%compendium%(available%from%the%course%website)2

52 TDDD37

Laboratory%schedule2

•  Lab%schedule%on%the%course%web6page.2o  One%group%has%two%rooms.2

•  Project%work:%Less%supervision.2o  One%mandatory%section%discussing%your%data%model.2

62

Page 2: Data%models%and%history2 Database%technology2

TDDD37

Laboratory%information2

•  You%need%a%special%database%account2o  automatically%created%at%course%registration2o  e6mail%[email protected]%if%any%problems2

•  Subscribe%for%labs%via%course%home%page2o  Deadline:%September%4.2o  Students%that%retake%the%labs:%discuss%with%Fang2

72 TDDD37

Handing%in%labs2

•  Each%lab%requires%a%wri?en%report2•  Labs%can%be%handed%in:2

o  At%IDAs%postboxes,%opposite%to%Café%Java%(take%a%brown%envelope%for%internal%mail%that%is%usually%available%there,%write%the%name%of%the%lab%assistant%and%drop%it%in%the%mail%room)2

•  Labs%can%be%fetched:2o  From%the%teacher%at%the%lab2o  At%the%OUT%box%outside%each%teachers%office2o  Remember%to%fetch%your%labs,%it%is%your%only%proof%that%you%have%

passed%the%labs.2

82

TDDD37

Labs%reports%deadlines2

•  Lab%reports%are%handed%in:2o  Lab1,%2,%3:%As%soon%as%possible,%not%later%than%October%202o  Project’s%ER%diagram:%No%later%than%September%272o  Project’s%report:%No%later%than%October%20%2o  Project’s%demo:%October%112o  Send%e6mail%to%Urkund%with%your%project%code%(read%more%in%

course%website)2

•  Next%occasions:%Next%two%exams%(January%and%August%2013)2

•  Later:%Redo%the%labs!!!2

92 TDDD37

Lab%policy2

•  You%are%expected%to%do%the%lab%assignments%by%yourself.%Merely%copying%others%solutions%will%not%be%tolerated,%even%if%you%make%cosmetic%changes%to%the%code/solution.%If%we%suspect%that%this,%or%any%other%form%of%cheating%has%happened%we%will%report%it%to%the%disciplinary%board%of%the%university.2

•  Be%prepared%to%be%asked%questions%by%your%lab%assistant%about%detailed%and%specific%code%and%also%inquiries%about%why%you%have%selected%a%specific%solution.%This%applies%to%all%lab%group%members.2

•  If%you%have%problems%meeting%a%deadline%it%is%much%be?er%to%talk%to%the%instructor%about%it%than%to%cheat.2

102

TDDD37

Wri?en%exam2

•  Two%parts:2o  Theoretical%and%practical2o  Have%to%pass%both%parts2

•%Equipment2o  Dictionary%–%not%electronic2o  No%calculator2o  No%books%allowed2

•  Registration%to%the%exam2o  Studentportalen2o  Exam%October%20%2012%14.00618.002o  Old%exams%available%at%the%course%website,%from%Expeditionen%in%

the%E%building2o  h?p://www.ida.liu.se/~jospe/LostaTentor.pdf2

112 TDDD37

LiU:%Disciplinary%actions2

•  Any%kind%of%academic%dishonesty,%such%as%cheating,%plagiarism,%use%of%unauthorized%assistance,%fraud%and%failure%to%comply%with%University%examination%rules,%may%result%in%the%filing%of%a%complaint%to%the%University%Disciplinary%Commi?ee.%The%potential%penalties%include%expulsion,%suspension,%and%revocation%of%previously%earned%grade%or%degree.2

•  LiU%Rules%and%regulations2

122

Page 3: Data%models%and%history2 Database%technology2

TDDD37

Organization%issues22

•  Question?2

132 TDDD37

Types%of%Database%Applications2

•  Traditional%Applications:2o  Numeric%and%Textual%Databases2

•  More%Recent%Applications:2o  Multimedia%Databases2o  Geographic%Information%Systems%(GIS)2o  Data%Warehouses2o  Real6time%and%Active%Databases2o  Internet%search%engines2o  Mobile%apps2o  Many%others2

142

TDDD37

What%is%a%database?%6%Definition2

•  Database:2o  an%integrated%collection%of%data%records,%files,%and%other%objects.%2

•  Database%Management%System%(DBMS):2o  A%software%package/%system%to%facilitate%the%creation%and%

maintenance%of%a%computerized%database.2

•  Database%System:2o  The%DBMS%software%together%with%the%data%itself.%Sometimes,%the%

applications%are%also%included.2

152 TDDD37

Pre6DBMS%(1960s)2

162

TDDD37

A%new%generation%of%DBMS2

172 TDDD37

The%relational%revolution%(1970’s)2

•  A%simple%data%model:%data%is%stored%in%relations%(tables)2•  A%declarative%query%language:%SQL2

SELECT Account.owner

FROM Account, Branch WHERE Account.balance = 0

•  Programmer%specifies%what%answers%a%query%should%return,%but%not%how%the%query%is%executed2

•  DBMS%picks%the%best%execution%strategy%based%on%availability%of%indexes,%data/workload%characteristics,%etc.2

•  Provides%physical/data/independence2

182

Page 4: Data%models%and%history2 Database%technology2

TDDD37

Physical%data%independence2

•  Applications%should%not%need%to%worry%about%how%data%is%physically%structured%and%stored2

•  Applications%should%work%with%a%logical/data/model/and%declarative/query/language2

•  Leave%the%implementation%details%and%optimization%to%DBMS2

•  The%single%most%important%reason%behind%the%success%of%DBMS%today2o  And%a%Turing%Award%for%E.%F.%Codd%in%19812

192 TDDD37

Course%goals2•  Design%a%database%for%a%given%application2

o  EER6modeling,%Normalization2•  Design%and%use%a%relational%database2

o  Concept%of%relations2o  Use%SQL,%MySQL2

•  Understand%how%the%database%is%stored%on%the%computer2o  Basic%technology,%file%structures,%indexing2o  Impact%on%database%performance2o  B6Trees,%Hashing2

•  Understand%how%databases%can%support%multiple%users2o  Views2o  Transactions,%serialization2

•  Understand%how%persistency%can%be%guaranteed2o  Recovery2

Application2

System2

202

TDDD37

Category%of%data%models2

•  Conceptual%(high6level,%semantic)%data%models:2o  Provide%concepts%that%are%close%to%the%way%many%users%perceive%

data.2o  (Also%called%entity6based%or%object6based%data%models.)2

•  Physical%(low6level,%internal)%data%models:2o  Provide%concepts%that%describe%details%of%how%data%is%stored%in%

the%computer.2

•  Implementation%(representational)%data%models:2o  Provide%concepts%that%fall%between%the%above%two,%used%by%many%

commercial2o  DBMS%implementations%(e.g.%relational%data%models%used%in%

many%commercial%systems).%2

212 TDDD37

Example%of%a%database2

•  Mini6world%for%the%example:2o  Part%of%a%UNIVERSITY%environment.2

•  Some%mini6world%entities:2o  STUDENTs2o  COURSEs2o  SECTIONs%(of%COURSEs)2o  (academic)%DEPARTMENTs2o  INSTRUCTORs2

222

TDDD37

Example%of%a%database2

•  Some%mini6world%relationships:2o  SECTIONs%are%of%specific%COURSEs2o  STUDENTs%take%SECTIONs2o  COURSEs%have%prerequisite%COURSEs2o  INSTRUCTORs%teach%SECTIONs2o  COURSEs%are%offered%by%DEPARTMENTs2o  STUDENTs%major%in%DEPARTMENTs2

•  Note:%During%the%course%you%will%learn%how%to%express%this%as%an%E/R%model%and%translate%the%model%into%a%data%model.2

232 TDDD37 242

Page 5: Data%models%and%history2 Database%technology2

TDDD37

Characteristics%of%DB%approach2

•  Self6describing%nature%of%a%database%system:2o  A%DBMS%catalog%stores%the%description%of%a%particular%database%

(e.g.%data%structures,%types,%and%constraints)2o  The%description%is%called%meta6data.2o  This%allows%the%DBMS%software%to%work%with%different%database%

applications.2o  Important%information%for%query%optimization.2

•  Support%of%multiple%views%of%the%data:2o  Each%user%may%see%a%different%view%of%the%database,%which%

describes%only%the%data%of%interest%to%that%user.2

252 TDDD37 262

TDDD37

Schema%vs.%instance2

•  Database%Schema:2o  The%description%of%a%database.2o  Includes%descriptions%of%the%database%structure,%data%types,%and%

the%constraints%on%the%database.2

•  Database%State:2o  The%actual%data%stored%in%a%database%at%a%particular%moment%in%

time.2o  This%includes%the%collection%of%all%the%data%in%the%database.2o  Also%called%database%instance%(or%occurrence%or%snapshot).2o  The%term%instance%is%also%applied%to%individual%database%

components,%e.g.%record%instance,%table%instance,%entity%instance2

272 TDDD37

An%Example%schema2

282

TDDD37

Example%of%instances2

292 TDDD37

DBMS%languages2

•  Data%Definition%Language%(DDL)2

•  Data%Manipulation%Language%(DML)2o  High6Level%or%Non6procedural%Languages:%These%include%the%

relational%language%SQL2•  May%be%used%in%a%standalone%way%or%may%be%embedded%in%a%programming%language2

o  Low%Level%or%Procedural%Languages:2•  These%must%be%embedded%in%a%programming%language2

302

Page 6: Data%models%and%history2 Database%technology2

TDDD37

Concurrency%control2

•  Sharing%of%data%and%multi6user%transaction%processing:2o  Allowing%a%set%of%concurrent%users%to%retrieve%from%and%to%update%

the%database.2o  Concurrency%control%within%the%DBMS%guarantees%that%each%

transaction%is%correctly%executed%or%aborted2o  Recovery%subsystem%ensures%each%completed%transaction%has%its%

effect%permanently%recorded%in%the%database2o  OLTP%(Online%Transaction%Processing)%is%a%major%part%of%database%

applications.%This%allows%hundreds%of%concurrent%transactions%to%execute%per%second.2

312 TDDD37

Handling%multiple%users2

322

TDDD37

Persistency%and%error2

332 TDDD37

History%of%data%models2

•  Network%Model%(introduced%in%the%60’s)2•  Hierarchical%Model%(introduced%in%the%60’s)2•  Relational%Model%(introduced%in%the%70’s)2•  Object6oriented%Data%Models%(introduced%in%the%80’s)2•  Object6Relational%Models%(introduced%in%the%90’s)2•  XML%databases%and%Hybrid%models%(2000%6%)2

342

TDDD37

Today2

•  Relational%databases%dominating.2•  Hierarchical%and%navigational%databases%still%in%use.

(Mainly%in%flight%industry.)2•  Object6oriented%databases%in%use,%especially%as%object6

relational%databases.2•  XML6databases%–%new,%first%commercial%products%

appearing.2

352 TDDD37

Major%DBMS%today2

•  Oracle2•  IBM%DB2%(from%System%R,%System%R*,%Starburst)2•  Microsoft%SQL%Server2•  Teradata2•  Sybase%(acquired%by%SAP)2•  Informix%(acquired%by%IBM)2•  PostgreSQL%(from%UC%Berkeley’s%Ingres,%Postgres)2•  Tandem%NonStop%(acquired%by%Compaq,%now%HP)2•  MySQL%(acquired%by%Sun,%then%Oracle)2•  ?%SQLite2•  ?%Microsoft%Access2•  ?%BerkeleyDB%(acquired%by%Oracle)2

362