Presentation is loading. Please wait.

Presentation is loading. Please wait.

Session 1Introduction to Database Technology Introduction to Relational Databases and MySQL Lecturer: Jerry Smallwood

Similar presentations


Presentation on theme: "Session 1Introduction to Database Technology Introduction to Relational Databases and MySQL Lecturer: Jerry Smallwood"— Presentation transcript:

1 Session 1Introduction to Database Technology Introduction to Relational Databases and MySQL Lecturer: Jerry Smallwood Email: ubaceg4@dcs.bbk.ac.uk

2 Session 1Introduction to Database Technology DT-Wed Class Schedule  Session 1: Wed 14 th October  Session 2: Wed 21 st October  Session 3: Wed 28 th October  Session 4: Wed 4 th November  TMA Self-Study Session: Wed 11 th November  Session 5: Wed 18 th November (TMA Due)  Session 6: Wed 25 th November  Session 7: Wed 2 nd Devember  Session 8: Wed 9 th December  FMA Due: 2pm on Monday 11 th January 2010

3 Session 1Introduction to Database Technology DT Assessment (2009/10) TMA (Tutor Marked Assignment)  The TMA carries 25% of the total marks  requires you to produce a design for a database for Miles Better, a small car hire company  TMA Self-Study Session: Wed 11 th November  TMA Submission Deadline: 6pm on Wed 18 th November FMA (Final Module Assignment)  FMA carries 75% of the total marks  requires you to create the Miles Better car hire database that you designed for the TMA  FMA Submission Deadline: 2pm on Monday 11 th January 2010

4 Session 1Introduction to Database Technology ITApps Assessment (2009/10) ITApps Assessment Process (2009/10)  Full details on the ITApps website: http://www.dcs.bbk.ac.uk/itapps/assessment.html http://www.dcs.bbk.ac.uk/itapps/assessment.html  Note: Late submissions is possible but at a penalty (mark capped at 40% of total marks for that assignment)  Note: note issue of ‘mitigating circumstances’ Chair ITApps/FdScIT Exam Board  Ian Harrison, email: i.harrison@bbk.ac.uki.harrison@bbk.ac.uk  Contact re. ‘mitigating circumstances’ or any other issues that prevent you submitting the TMA/FMA on time.  Note: Lecturers cannot grant extensions to deadlines

5 Session 1Introduction to Database Technology Session 1 - Overview Introduces the basic concept of a database and shows why it is useful. Introduces the Yum Juices case study that will be used throughout this module. Introduces you to MySQL, the Open Source Relational Database Management System that you will use to study this module.

6 Session 1Introduction to Database Technology What is a database? an organized body of related information wordnet.princeton.edu/perl/webwn wordnet.princeton.edu/perl/webwn A collection of data organized for rapid search and retrieval by a computer. www.clock.org/~jss/glossary/d.html www.clock.org/~jss/glossary/d.html A collection of related data stored in one or more computerized files in a manner that can be accessed by users or computer programs via a database management system. sparc.airtime.co.uk/users/wysywig/gloss.htm sparc.airtime.co.uk/users/wysywig/gloss.htm A database collects information into an electronic file, for example a list of customer addresses and associated orders. Each item is usually called a ‘record’ and the items can be sorted and accessed in many different ways. www.webmotion.co.uk/resources/d.php www.webmotion.co.uk/resources/d.php A database is an electronic filing collection of information that is organized so that it can easily be accessed, managed, and updated. www.salvagedata.com/hard-drive-recovery-terms/ www.salvagedata.com/hard-drive-recovery-terms/ A set of related files that is created and managed by a database management system (DBMS). www.bradycommunications.com/perspectives/glossary.aspx www.bradycommunications.com/perspectives/glossary.aspx A collection of information stored in one central location. Many times, this is the source from which information is pulled to display products or information dynamically on a website. www.gravitatedesign.com/glossary.htm www.gravitatedesign.com/glossary.htm Relational data structure used to store, query, and retrieve information. fwie.fw.vt.edu/tws-gis/glossary.htm fwie.fw.vt.edu/tws-gis/glossary.htm Source: Google “Define: database”

7 Session 1Introduction to Database Technology A database consists of… A collection of data Software to store, access and manage the data (DBMS) User A User B Collection of Data DBMS

8 Session 1Introduction to Database Technology Advantages 1 Data independence –Changes to structure of the data do not affect programs used to access it Consistency of data –Each item only recorded once. No danger of its being updated in one place but not another Reduced redundancy –Each item of data is only stored in a single place. No duplication of data Data integrity –Control and check data entry Data security –Restrict access to authorised users

9 Session 1Introduction to Database Technology Centralised control –Database administrator will control who has access to the data More information –Users have access to wider range of data that might previously have been held in different places and possibly on incompatible systems Greater productivity –The DBMS query language allows users to design their own queries and get an immediate response Advantages 2

10 Session 1Introduction to Database Technology Disadvantages Cost –Database systems are complex, difficult, and time-consuming to design. –Initial training required for all programmers and users. –Hardware and software start-up costs. Potential loss of data through system failure –Need for backup and recovery procedures –Essential to ensure that no data is lost Security –Data may get into the wrong hands Privacy –The increased use of databases means a large amount of personal information is stored in many different places

11 Session 1Introduction to Database Technology Data Storage Data is stored in tables Each row is a record Each column is an item of data (field) within the record Pet pet_namepet_type Sidsnake Minniemouse Mickeymouse Grommitdog Mogcat Bubblesgoldfish

12 Session 1Introduction to Database Technology Types of Database Flat file –All data in a single table –You can use a spreadsheet such as Excel to create a database of this type Relational –Data split into related tables, linked by keys

13 Session 1Introduction to Database Technology Flat File Database – example 1 Yum has stored details of customers and the orders they have placed in a single table. What problems might this cause? What happens when they also record details of the items included in each order?

14 Session 1Introduction to Database Technology Flat File Database – example 2 IDDateOrderItemsCustIDTitleFname Sname… 112/06/200816 Sparkling Sunshine £3.25 x 2 1 Citrus Zing £2.50 x 3 2MrJackHill Multiple items in each order Table needs a record for each order item Even more duplication of data!

15 Session 1Introduction to Database Technology Relational Database Data is split into entities An entity is something that the database stores information about A noun A person, place, thing, event Data for each entity is stored in a separate table (known as a relation) What are the entities in the previous example?

16 Session 1Introduction to Database Technology Yum Database Entities Each of the following entities will be stored in a table in the Yum database: –Customers –Orders –Order Items –Juices

17 Session 1Introduction to Database Technology Attributes An attribute is a property of an entity Each attribute is a column in the table for its associated entity Each row in the table is a record. The attributes are the fields in the record What are the attributes for the customer entity in the Yum database? –Customer ID –Title –First name –Surname –…

18 Session 1Introduction to Database Technology Primary Key A field (or fields) that uniquely identifies each record in a table All tables in a relational database should have a primary key What would be a suitable primary key for the customer table in the Yum database?

19 Session 1Introduction to Database Technology Foreign key Used to relate one entity to another to allow the database to retrieve related data The primary key of the parent table is stored in the related record of the child table

20 Session 1Introduction to Database Technology Foreign key - example To relate customers to the orders they have placed we store the customer ID of the customer placing the order in the order table Customer ID is the primary key of the customer table and a foreign key in the order table Each customer ID will be recorded just once in the customer table but may be recorded many times in the order table

21 Session 1Introduction to Database Technology Customer Table CustIDTitleFnameSnameAddress1 1MrsJillHill2 Steep St 2MrJackHill2 Steep St 3MsBoPeep5 Flockington Rd 4MrHumptyDumpty29 Shell Ave 5MrHarleyDavidson5b Bike Alley 6MissMaryContrary1 Flower Gdns Order Table Order ID Cust ID Date 1212/06/2008 25 3615/06/2008 4223/06/2008 53 61 7501/08/2008 8402/08/2008 9310/08/2008 10315/08/2008 Primary key Foreign key Customer and Order Tables in the Yum Database What is the name of the customer who placed order number 1? What are the numbers of the orders placed by Bo Peep?

22 Session 1Introduction to Database Technology Database Terminology Entity Attribute Record (row) Column or Field Table or Relation Primary Key Foreign Key

23 Session 1Introduction to Database Technology Now do… Hands-on Exercise 1 –Explore the Yum Juices sample data

24 Session 1Introduction to Database Technology Relational Database Management System (RDBMS) Software to manage data stored in related tables Examples: –MySQL –Access –Oracle –SQL Server

25 Session 1Introduction to Database Technology SQL Structured Query Language Query language for accessing and modifying data in relational databases Used by all RDBMSs Data Definition –Store data –Tables Data Manipulation –Retrieve information –Queries

26 Session 1Introduction to Database Technology MySQL is… An Open Source Relational Database Management System (RDBMS)

27 Session 1Introduction to Database Technology Open Source Software Free to use, modify and redistribute Source code available for modification by users Developed collaboratively

28 Session 1Introduction to Database Technology Finding out about MySQL The MySQL website: http://www.mysql.com/ The Reference Manual

29 Session 1Introduction to Database Technology Using MySQL for this Module MySQL is a client/server system Your database is stored on the School of Computer Science MySQL server mysqlsrv –A database has been created for you as you do not have sufficient permissions to create a database on this server You use the telnet Internet Protocol to connect to the server –You need a username and password from your tutor before you can do this

30 Session 1Introduction to Database Technology Now do… Hands-on Exercise 2: –Connect to your database –Use basic SQL commands Make sure you have got your MySQL username and password from your tutor.

31 Session 1Introduction to Database Technology Review Basic SQL Commands SHOW DATABASES USE database_name SHOW TABLES CREATE TABLE SHOW COLUMNS INSERT INTO table_name UPDATE table_name SELECT * FROM table_name DELETE FROM table_name DROP table_name


Download ppt "Session 1Introduction to Database Technology Introduction to Relational Databases and MySQL Lecturer: Jerry Smallwood"

Similar presentations


Ads by Google