Presentation is loading. Please wait.

Presentation is loading. Please wait.

Nic Shulver Chris Introduction to databases Introduction Storage Temporary and Permanent Unstructured.

Similar presentations


Presentation on theme: "Nic Shulver Chris Introduction to databases Introduction Storage Temporary and Permanent Unstructured."— Presentation transcript:

1 Nic Shulver N.A.Shulver@staffs.ac.uk, Chris MayerN.A.Shulver@staffs.ac.uk Introduction to databases Introduction Storage Temporary and Permanent Unstructured and Structured Ways to structure information Simple databases Relationships, example relationship Some Database Terminology SQL – Structured Query Language

2 Nic Shulver N.A.Shulver@staffs.ac.uk, Chris MayerN.A.Shulver@staffs.ac.uk Introduction to databases Storage – Temporary and Permanent Many applications store information for later use Storage may be temporary or permanent Permanent storage is usually in the form of a file (e.g. a plain text file) stored on a physical disc drive Many applications add, modify and retrieve information from structured data stores, often called databases

3 Nic Shulver N.A.Shulver@staffs.ac.uk, Chris MayerN.A.Shulver@staffs.ac.uk Introduction to databases Storage – Unstructured and Structured Unstructured information (e.g. the stream of words in a speech) is easy to store in a plain text file Structured information (name, occupation, date of birth, eye colour – for a set of people) is easy to store in a database What is the advantage of using a database? (The personal information could be stored in a text file, after all.)

4 Nic Shulver N.A.Shulver@staffs.ac.uk, Chris MayerN.A.Shulver@staffs.ac.uk Introduction to databases Ways to structure information A lot of collected data is repetitive in form Data may be repetitive in content, too For example, if we have the following information for 15 people; [Age in years], [Name], [Height in metres] then we have 15 records of 3 fields, in this format; [whole number], [text], [fractional number]

5 Nic Shulver N.A.Shulver@staffs.ac.uk, Chris MayerN.A.Shulver@staffs.ac.uk Introduction to databases More example information Here is some simple information: Danny DeVito(USA), Hugh Jackman (Australia), Halle Berry(USA), Patrick Stewart (UK), … This kind of information has a simple structure or format We can put the information into a table

6 Nic Shulver N.A.Shulver@staffs.ac.uk, Chris MayerN.A.Shulver@staffs.ac.uk Introduction to databases Table (with repeated information) No.First NameLast NameOrigin 1DannyDeVitoUnited States of America 2ArnoldSchwarzeneggerAustria 3HalleBerryUnited States of America 4PatrickStewartUnited Kingdom 5KarismaKapoorIndia 6HughJackmanAustralia 7AlecGuinnessUnited Kingdom 8JackNicholsonUnited States of America 9KylieMinogueAustralia

7 Nic Shulver N.A.Shulver@staffs.ac.uk, Chris MayerN.A.Shulver@staffs.ac.uk Introduction to databases Table (no repeated information) No.First NameLast NameOrigin 1DannyDeVito1 2ArnoldSchwarzenegger2 3HalleBerry1 4PatrickStewart3 5KarismaKapoor5 6HughJackman4 7AlecGuinness3 8JackNicholson1 9KylieMinogue4 No.Country Name 1 United States of America 2 Austria 3 United Kingdom 4 Australia 5 India This is an example of a simple one-to-many relationship.

8 Nic Shulver N.A.Shulver@staffs.ac.uk, Chris MayerN.A.Shulver@staffs.ac.uk Introduction to databases Table (with repeated information) No.First Name Last NameOriginFilms 1DannyDeVitoUnited States of America Batman Returns Twins 2ArnoldSchwarzeneggerAustriaTerminator True Lies Twins

9 Nic Shulver N.A.Shulver@staffs.ac.uk, Chris MayerN.A.Shulver@staffs.ac.uk Introduction to databases Tables (repeated information) No.First NameLast NameOrigin 1DannyDeVito1 2ArnoldSchwarzenegger2 No.Country Name 1United States of America 2Austria 3United Kingdom 4Australia 5India This is an example of several linked tables No.Films 1Batman Returns 2Terminator 1Hook 1Twins 2

10 Nic Shulver N.A.Shulver@staffs.ac.uk, Chris MayerN.A.Shulver@staffs.ac.uk Introduction to databases Repeated Information The previous example does not solve the problem What about the other actors/actresses in the films? Databases can soon get complicated Need to think carefully about structure before you start – may be difficult later on DSA will only need simple structures in DB

11 Nic Shulver N.A.Shulver@staffs.ac.uk, Chris MayerN.A.Shulver@staffs.ac.uk Introduction to databases Some Database Terminology Rows and Columns Broad view of the table – each row is a record, each column is a set of fields This is analogous to a spreadsheet view Records and Fields Detailed view of the information Each record (entry) in the database is made up of fields, possibly with some fields from joined tables

12 Nic Shulver N.A.Shulver@staffs.ac.uk, Chris MayerN.A.Shulver@staffs.ac.uk Introduction to databases Relationships and Joins Tables may be joined together – this is very powerful but can get complex Database systems which allow join relationships are known as Relational Databases (see RDSD) To build, use and maintain joins between tables, it is often easiest to use tools built into database programs (e.g. MS Access, SQLyog)

13 Nic Shulver N.A.Shulver@staffs.ac.uk, Chris MayerN.A.Shulver@staffs.ac.uk Introduction to databases SQL – Structured Query Language Structured Query Language is the language of databases It is very widely used in industry – look for mySQL, PL/SQL, SQLplus, Oracle SQL and so on We can use little chunks of SQL in our applications to ask a database for information (i.e query the database)

14 Nic Shulver N.A.Shulver@staffs.ac.uk, Chris MayerN.A.Shulver@staffs.ac.uk Introduction to databases Structured Query Language Structured Query Language (SQL), is a set of commands that all programs and users may use to access data within databases Application programs and tools often allow users to access SQL databases without directly using SQL, but these applications in turn must use SQL when executing the user’s request

15 Nic Shulver N.A.Shulver@staffs.ac.uk, Chris MayerN.A.Shulver@staffs.ac.uk Introduction to databases History of SQL In June 1970 in the Association of Computer Machinery (ACM) journal, Communications of the ACM published the paper, “A Relational Model of Data for large Shared Data Banks,” by Dr. E. F. Codd Codd’s model is the definitive model for relational database management systems (RDBMS) IBM Corporation, Inc. developed Structured English Query Language(SEQUEL) using Codd’s model SEQUEL later became SQL, the standard RDBMS language

16 Nic Shulver N.A.Shulver@staffs.ac.uk, Chris MayerN.A.Shulver@staffs.ac.uk Introduction to databases What can it do? SQL provides commands for a variety of tasks including: querying data, inserting, updating, and deleting rows in a table, creating, replacing, altering, and dropping objects, controlling access to the database and its objects, guaranteeing database consistency and integrity.

17 Nic Shulver N.A.Shulver@staffs.ac.uk, Chris MayerN.A.Shulver@staffs.ac.uk Introduction to databases Conclusion We need to store some information in a structured way Simple tables are conceptually simple Relational databases provide a powerful and convenient way to store data Structured Query Language provides us with a way to interact with databases


Download ppt "Nic Shulver Chris Introduction to databases Introduction Storage Temporary and Permanent Unstructured."

Similar presentations


Ads by Google