Presentation is loading. Please wait.

Presentation is loading. Please wait.

Do it now – PAGE 10 You will find your do it now task in your workbook – look for the start button! Sunday, 28 April 2019.

Similar presentations


Presentation on theme: "Do it now – PAGE 10 You will find your do it now task in your workbook – look for the start button! Sunday, 28 April 2019."— Presentation transcript:

1 Do it now – PAGE 10 You will find your do it now task in your workbook – look for the start button! Sunday, 28 April 2019

2 Home learning Due today DUE:

3 Searching and sorting data

4 “Investigate how to search and sort data”
Learning Objective “Investigate how to search and sort data” You will find differentiated outcomes for this lesson on the front of your workbook. Sunday, 28 April 2019

5 New learning To search for particular data the select statement is used. An example of a select statement might be: SELECT * FROM Product One of the most significant advantages of sorting information in databases is that SQL provides us with an easy to use syntax to search and sort data. Therefore, we do not need to need to think about how to implement searching and sorting algorithms - SQL is a declarative language, implementation details are handled for us and we are left to focus on declaring what we want to find and how we want it to be organised This statement would return all of the products that are stored. Notice that an asterisk is used as a wildcard to denote that all fields of each product should be returned.

6 New learning To search for particular data the select statement is used. An example of a select statement might be: SELECT * FROM Product One of the most significant advantages of sorting information in databases is that SQL provides us with an easy to use syntax to search and sort data. Therefore, we do not need to need to think about how to implement searching and sorting algorithms - SQL is a declarative language, implementation details are handled for us and we are left to focus on declaring what we want to find and how we want it to be organised This statement would return all of the products that are stored. Notice that an asterisk is used as a wildcard to denote that all fields of each product should be returned.

7 Learning Development SELECT * FROM Product WHERE Price > 2.00
all products that have a price higher than 2.00

8 Independent Task SELECT * FROM Product WHERE Price > 3.25 AND ProductID > 10 all products that have a price higher than 3.25 and a ProductID of more than 10

9 Independent Task SELECT Name, Price FROM Product WHERE Price > 3.25 AND ProductID > 10 Returns only name and price from products that have a price higher than 3.25 and a ProductID of more than 10

10 Learning Development Have a go at adapting the SQL statements in the worksheet to query your database. Screenshot your SQL statements and the data they return

11 Learning Development We can improve select statements by adding an additional clause to sort data in a particular way: SELECT Name, Price FROM Product WHERE Price > ? AND ProductID > ? ORDER BY Name ASC Another important ability of databases is that they can sort data easily. What do you think ASC stands for? What do you think will happen if you switch it for DESC Add the ORDER BY Name ASC line to the end of your SQL statement (see example)

12 Learning Development Download the movie database file and the movie_worksheet file. Work your way through the worksheet – you may need to use a search engine to help you in places!

13 Talk Task What act states that data must be kept up to date?
What is meant by an update query? Explain a situation where an update query would need to be used? What other queries can be used? Why is using a database more suitable for updating and deleting data than a spreadsheet? Based on what you know explain how a website would update the records of their customers

14 Name one piece of data that you used to search for data
Exit ticket Name one piece of data that you used to search for data R A G


Download ppt "Do it now – PAGE 10 You will find your do it now task in your workbook – look for the start button! Sunday, 28 April 2019."

Similar presentations


Ads by Google