10
CORE 2: Informatio n systems and Databases STORAGE & RETRIEVAL 2 : SEARCHING, SELECTING & SORTING

Storage & Retrieval 2 : Searching, Selecting & Sorting

Embed Size (px)

DESCRIPTION

Storage & Retrieval 2 : Searching, Selecting & Sorting. CORE 2: Information systems and Databases. Storage and Retrieval. In this part of the topic we said we would look at the following… Types of Storage Hardware Techniques for Data Security Searching, Selecting and Sorting. - PowerPoint PPT Presentation

Citation preview

Page 1: Storage & Retrieval 2 : Searching, Selecting & Sorting

CORE 2: Information systems and Databases

STORAGE & RETRIEVAL 2:

SEARCHING, SELECTING & SORTING

Page 2: Storage & Retrieval 2 : Searching, Selecting & Sorting

In this part of the topic we said we would look at the following…

1. Types of Storage Hardware 2. Techniques for Data Security3. Searching, Selecting and Sorting

STORAGE AND RETRIEVAL

Page 3: Storage & Retrieval 2 : Searching, Selecting & Sorting

Searching is looking through a collection of data in order to locate required data. Selecting is a combined process used to identify the data needing to be retrieved.

eg. Looking for Year 7 students in Currey House

Sorting involves arranging a collection of items in some specified order eg. Alphabetical or Numerical. Sorted data is easier for people to understand and as such it becomes information (data with meaning).

eg. Ordering Year 7 students in Currey house by alphabetical order A – Z.

SEARCHING, SELECTING AND SORTING

Page 4: Storage & Retrieval 2 : Searching, Selecting & Sorting

Tools for Database Searching and Retrieval - Indexes

In a database table the order in which records are stored is entirely irrelevant. When a search is applied to a large database there are potentially thousands of records needing to be examined individually and in an unspecifi ed order. The solution to this is indexes.

Indexes are similar to that in a book, in that they give and ordered listing of areas where content can be found. Database indexes describe a particular record order without actually ordering or displaying the records. For example: An attribute of the index may be "sort order" which has cells beneath it specifying the organisational order for the fi elds listed in the index eg ascending or descending. The index is in order hence it can be used to quickly search through the data for records to be retrieved.

SEARCHING, SELECTING AND SORTING

Page 5: Storage & Retrieval 2 : Searching, Selecting & Sorting

Tools for Database Searching and Retrieval - SQL

QUERY is a search of a database for records that meet a certain condition. It is a question you ask the database. The results are usually displayed in a table but can be used as the basis for a form, report, graph or another query. A query can also update or delete multiple records at the same time and perform calculations on data. Queries are constructed in the form <Field name> <Operator> . The data is often called the criteria. A common method for constructing a query is query by example, which requires a user to enter the criteria against a field. If the search of a database involves two or more entities it is called a relational query.

SEARCHING, SELECTING AND SORTING

Page 6: Storage & Retrieval 2 : Searching, Selecting & Sorting

Tools for Database Searching and Retrieval - SQL

STRUCTURED QUERY LANGUAGE (SQL) is a query language used to access and manipulate data in a relational database. SQL statements contain keywords that are used to perform a particular task. When searching in SQL it is essential to use correct syntax. In most DBMSs keywords are in uppercase, fields are separated by commas, an entity and an attribute in that entity are separated by a fullstop, and the search criteria or data item is enclosed in double quotes. The keyword ORDER BY sorts on a field in ascending (ASC) or descending (DESC) order with ascending as the default.

SEARCHING, SELECTING AND SORTING

Page 7: Storage & Retrieval 2 : Searching, Selecting & Sorting

Tools for Database Searching and Retrieval - SQL

SQL – Stands for (Structured Query Language). SQL statements are structured using the following:

SELECT – Attributes to retrieve (e.g. surname)FROM – Table (database)WHERE – Search criteria (e.g. client age > 15)ORDER BY – Alphabetical etc.

SEARCHING, SELECTING AND SORTING

Page 8: Storage & Retrieval 2 : Searching, Selecting & Sorting

Tools for Database Searching and Retrieval - SQL‘WHERE’ is the SQL statement that declares a criteria to be followed in order to complete the query. The following operators can be utilised as criteria for ‘WHERE’…

SEARCHING, SELECTING AND SORTING

RELATIONAL OPERATORSEnglish meaning SQL

Contains LIKEDoes not contain NOT LIKEEquals =Not equal to <> Greater than > Greater than or equal to >=Less than < Less than or equal to <=

LOGICAL OPERATORSTrue when both expressions are true AND

True when at least one expression is true OR

Opposite NOT

WILDCARD OPERATORS

Substitute a single character ?

Substitute any number of characters *

Page 9: Storage & Retrieval 2 : Searching, Selecting & Sorting

Tools for Database Searching and Retrieval - QBE

QBE or Query by Example is a visual technique for specifying a database query. Common search criteria are entered into what appears to be an empty record, thus users do not need to understand the details of SQL. For example a modified QBE is used by most Internet Search engines.

In Access a simple QBE can be initiated using a ‘fi lter’ whilst more complex QBE can be utilised using the design view .

SEARCHING, SELECTING AND SORTING

Page 10: Storage & Retrieval 2 : Searching, Selecting & Sorting

Tools for Database Searching and Retrieval - QBE

SEARCHING, SELECTING AND SORTING