Download presentation
Presentation is loading. Please wait.
Published byIngvar Dahle Modified over 6 years ago
1
Do it now – PAGE 3 You will find your do it now task in your workbook – look for the start button! Tuesday, 09 April 2019
2
Home learning This term we will be creating a database for a burger bar which uses smart phones for taking orders. Think of a DIFFERENT scenario that a database could be used for and write a functional specification for it – this is all the things the database will need to do. DUE:
3
Green pen activity Complete the green pen activity in your booklet based on your teachers feedback. Tuesday, 09 April 2019
4
Introduction to relational databases
5
“Investigate how database tables are linked together”
Learning Objective “Investigate how database tables are linked together” You will find differentiated outcomes for this lesson on the front of your workbook. Tuesday, 09 April 2019
6
Investigate how database tables are linked together
New learning Issues with working with large amounts of data: What is the best way to structure the data so that it can be retrieved easily? What is the best way to search and sort the data? How will changes to the structure of the data impact on the program? Investigate how database tables are linked together
7
Investigate how database tables are linked together
New learning Issues with working with large amounts of data: What is the best way to structure the data so that it can be retrieved easily? What is the best way to search and sort the data? How will changes to the structure of the data impact on the program? Databases help to resolve these problems by providing us with guidelines on how the data should be structured and by providing mechanisms to enable searching and sorting without having to worry about how these methods work Investigate how database tables are linked together
8
Investigate how database tables are linked together
New learning A database is a organised body of related information that you can access in a clearly defined way. A database management system controls your access to the database and enables you to define, create and maintain that database. The database management system that we will using is called SQLite. It is used widely by companies as diverse as Apple, Airbus, General Electric and Mozilla to provide the database functionality in some of their applications. We will use SQLite as it is provided as part of the standard Python library and provides us with all of the functionality that is necessary to teach databases at A-Level. Whilst it lacks some of the advance features of systems such as MySQL or PostgreSQL it is much easier to use as it requires no additional configuration or installation. Investigate how database tables are linked together
9
Investigate how database tables are linked together
Learning Development A database is only useful when it has a clearly defined data model. This means that you have described how the data should be structured and added any constraints that are necessary. This structure is defined as an entity-relationship model and then created using the structured query language or SQL for short. The database management system that we will using is called SQLite. It is used widely by companies as diverse as Apple, Airbus, General Electric and Mozilla to provide the database functionality in some of their applications. We will use SQLite as it is provided as part of the standard Python library and provides us with all of the functionality that is necessary to teach databases at A-Level. Whilst it lacks some of the advance features of systems such as MySQL or PostgreSQL it is much easier to use as it requires no additional configuration or installation. Investigate how database tables are linked together
10
Investigate how database tables are linked together
Learning Development This term you will be developing a database to represent the order system of a small burger bar Over the course of this tutorial you will develop a database to represent the order system of a small burger bar. Imagine that you want customers to be able to order their food (and extras) without having to queue up - maybe they can build an order on their smartphone and then submit it whilst the sit surfing the web on their laptop at one of your benches. Investigate how database tables are linked together
11
Investigate how database tables are linked together
Learning Development To construct a data model for we must have an understanding of both the entities and relationships that exist in a given system. The entities that may exist in the coffee shop database include: Products Customers In general you can think of an entity as an object or person in your system. This means that a single product or single customer is an entity. A group of products is an entity-type but most people refer to the grouping as an entity as well. A single entity will have various attributes to represent its characteristics. Each attribute will have an attribute name (to describe the characteristic) and an attribute type (what kind of data it is). Investigate how database tables are linked together
12
Investigate how database tables are linked together
Learning Development Customers Products Product Customer ER Diagram In your booklet create an ER diagram for our burger bar Separate entities in the system may be related to one another. For example, a product may be purchased by customers - we can represent this as an entity-relationship diagram Notice the relationship between the entities has “crow’s feet” at each end, this means: a single product may be purchased by many customers a single customer may purchase many products Investigate how database tables are linked together
13
Investigate how database tables are linked together
Learning Development We call this the degree of the relationship, in this instance the degree is many-to-many. There are four possible degrees of relationship: Investigate how database tables are linked together
14
Investigate how database tables are linked together
Independent Task Make a list of all of the burgers that you will sell in your burger bar and a price that each one will cost Products To begin with we will ignore relationships and focus on a single entity - product. There are usually a number of different types of burger available, as well as soft drinks, and other food such as fries. Investigate how database tables are linked together
15
Investigate how database tables are linked together
Learning Development We can describe product using an entity description: Product(ProductID, Name, Price) Create an entity description for your burger table There are lots of different pieces of data that we could store about each product but we will keep it simple for now. The product name and price are obvious pieces of data to store about each product but why product id? This provides us with an obvious unique identifier for each product, making it easy to locate a particular product. This is called the Primary Key. In an entity description this is underlined to set it apart from the other fields in the table. Investigate how database tables are linked together
16
Investigate how database tables are linked together
Independent Task import sqlite3 with sqlite3.connect('example.db') as db: pass Try changing the file name (the example bit) to a different name – what happens? Students should write this in Python IDLE Creating a new, blank database using SQLite is very simple: Students can go to file > New database and save the database file Investigate how database tables are linked together
17
Investigate how database tables are linked together
Talk Task What is the word for storing data in linked tables? What is meant by a relational database? How would you use a database with a game? What are the different relationships a table can have? Can you suggest a better way of storing data other than a spreadsheet? Based on what you know explain how a computer program stores data that it will need to access later. Investigate how database tables are linked together
18
Investigate how database tables are linked together
Exit ticket What storage structure must data be written in when adding it to a database? R A G Investigate how database tables are linked together
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.