+ All Categories
Home > Documents > Databases – Queries and Database Practice Queries

Databases – Queries and Database Practice Queries

Date post: 23-Feb-2016
Category:
Upload: dayo
View: 87 times
Download: 0 times
Share this document with a friend
Description:
Databases – Queries and Database Practice Queries When you create a database – one of the main strengths of it is the ability to query it to get the relevant information that you need. In DBMS systems like Access it allows you to create your own queries using QBE (Query by Example). - PowerPoint PPT Presentation
Popular Tags:
9
ICT@ WJEC Applied IC Databases – Queries and Database Practice Queries When you create a database – one of the main strengths of it is the ability to query it to get the relevant information that you need. In DBMS systems like Access it allows you to create your own queries using QBE (Query by Example). In this interface you can put parameters to refine your searches through your database to return only the items you wish.
Transcript
Page 1: Databases – Queries and Database Practice Queries

ICT@WJEC Applied ICT

Databases – Queries and DatabasePractice

QueriesWhen you create a database – one of the main strengths of it is the ability to query it to get the relevant information that you need. In DBMS systems like Access it allows you to create your own queries using QBE (Query by Example).

In this interface you can put parameters to refine your searches through your database to return only the items you wish.

Page 2: Databases – Queries and Database Practice Queries

ICT@WJEC Applied ICT

Databases – Queries and DatabasePractice

Queries – ParametersWhen you select the fields you want to include in a query and run it, every record in the database would be returned.

Page 3: Databases – Queries and Database Practice Queries

ICT@WJEC Applied ICT

Databases – Queries and DatabasePractice

Queries – ParametersIn order to make a query more meaningful, it is usual to include at least one parameter (search criteria) in the query. When you run the query, you will be presented with the result that matches the parameter used.

Page 4: Databases – Queries and Database Practice Queries

ICT@WJEC Applied ICT

Databases – Queries and DatabasePractice

Queries – Parameters - RangesParameters can also be ranges as well. If you are using a criteria on a currency field or numerical field – Range Parameters are especially relevant.

Here are some further examples of types of parameters which could be used within a query:

Greater than >500Less than <250Greater or equal to >=310Less than or equal to <=1000Between between 200 AND 600

>=200 AND <=600

Page 5: Databases – Queries and Database Practice Queries

ICT@WJEC Applied ICT

Databases – Queries and DatabasePractice

Queries – Parameters - WildcardsThe * is used as a wildcard. This means you can search for a record, even if you don't know the exact thing to write in your query.

E* - will search for everything which starts with an E. So for example, if we couldn't remember the customer's name was Eaton, but we knew it started with E, then we could have used a wild card to find the record i.e. E*. This would have also found us Ely and Essen, but it would have helped tonarrow down the search.

*N - will search for everything which ends with a N. This search might find customers such as, Brown, Green, Richardson.

*as* - This will search for everything which contains the consecutive letters 'as' somewhere within the field, e.g. Aston, Last, Brasier

Page 6: Databases – Queries and Database Practice Queries

ICT@WJEC Applied ICT

Databases – Queries and DatabasePractice

Queries – Parameters – Boolean QueriesYou can use the keywords AND, NOT and OR in your queries as well and they perform exactly as boolean values should.

You can combine them as well.

Page 7: Databases – Queries and Database Practice Queries

ICT@WJEC Applied ICT

Databases – Queries and DatabasePractice

Queries – Parameters – Dynamic ParametersYou can also set up your queries so you can ask the user what the criteria is at run time – this makes it more dynamic. To do this you simply use the [] and a prompt in the criteria box.

Page 8: Databases – Queries and Database Practice Queries

ICT@WJEC Applied ICT

Databases – Queries and DatabasePractice

Task

Can you normalise the Basement Order form and create a database?

Resources are on the interanet.

Page 9: Databases – Queries and Database Practice Queries

ICT@WJEC Applied ICT

Databases – Queries and DatabasePractice

Task

Using the Basement Database – create an example of the following queries.

1) Static query with one criteria2) Static query with two or more criteria3) Dynamic query with one criteria4) Dynamic query with two or more critera5) Query with range criteria6) Query with wildcard criteria7) Query with boolean criteria8) Complex query with multiple features from

above9) EXTENSION – Query with a function.


Recommended