Download presentation
Presentation is loading. Please wait.
Published byJuuso Mikkola Modified over 5 years ago
1
Human and Computer Interaction (H.C.I.) &Communication Skills
Lecture (8) Prepared by Dr. Dunia Hamid Hameed
2
Designing Queries When users ask questions of or communicate with the database, they are said to query it. Six different types of queries are among the most common.
3
Query Types Query Type 1 The entity and one of the entity’s attributes are given. The purpose of the query is to find the value. The query can be expressed as follows: What is the value of a specified attribute for a particular entity? Sometimes it is more convenient to use notation to formulate the query. This query can be written as V ← (E, A) where V stands for the value, E for entity, and A for attribute, and the variables in parentheses are given.
4
Query Types Query Type 2 The intent of the second query type is to find an entity or entities when an attribute and value are given. Query type 2 can be stated as follows: What entity has a specified value for a particular attribute? Because values can also be numeric, it is possible to search for a value equal to, greater than, less than, not equal to, greater than or equal to, and so on. The notation for query type 2 is E ← (V, A)
5
Query Types Query Type 3 The purpose of this query type is to determine which attributes fit the description provided when the entity and value are given. Query type 3 can be stated as follows: What attribute(s) has a specified value for a particular entity? This query is useful when many similar attributes have the same property. The notation for query type 3 is A←(V, E)
6
Query Types Query Type 4 Query type 4 is similar to query type 1. The difference is that the values of all attributes are desired. Query 4 can be expressed as follows: List all the values for all the attributes for a particular entity. The notation for query type 4 is all V ←(E, all A)
7
Query Types Query Type 5 The fifth type of query is another global query, but it is similar in form to query type 2. Query type 5 can be stated as follows: List all entities that have a specified value for all attributes. The notation for query type 5 is all E ← (V, all A)
8
Query Types Query Type 6 The sixth query type is similar to query type 3. The difference is that query type 6 requests a listing of the attributes for all entities rather than a particular entity. Query type 6 can be stated as follows: List all the attributes that have a specified value for all entities. The notation for query type 6 is all A←(V, all E)
9
Building More Complex Queries
The preceding six query types are only building blocks for more complex queries. Expressions, referred to as Boolean expressions, can be formed for queries.
10
Query Methods 1- Query by Example (QBE) is a simple but powerful method for implementing queries in database systems, such as Microsoft Access.
11
2- Structured Query Language Structured query language (SQL) is another popular way to implement queries. It uses a series of words and commands to select the rows and columns that should be displayed in the resulting table.
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.