Database queries Flashcards
(14 cards)
What is a database query?
A question used to retrieve selected information from a database.
A query can involve various conditions to filter the data returned.
What does the condition ‘=’ signify in a database query?
Equal to.
This condition is used to match values exactly.
What does the condition ‘BETWEEN’ indicate in a database query?
Numbers between x and y.
This is used to filter records within a specific range.
What does the condition ‘AND’ require in a database query?
Both conditions must be true.
This condition is used to narrow down results by requiring multiple criteria.
What does the condition ‘OR’ allow in a database query?
Either one of the conditions must be true.
This condition broadens the search by allowing multiple criteria.
What does the condition ‘>’ mean in a database query?
Greater than.
This condition is used to filter records with values exceeding a specified number.
What does the condition ‘<’ mean in a database query?
Less than.
This condition filters records with values below a specified number.
What does the condition ‘>=’ indicate in a database query?
Greater than or equal to.
This condition includes the specified number in the results.
What does the condition ‘<=’ signify in a database query?
Less than or equal to.
This condition includes the specified number in the results.
What are the two types of queries in databases?
- Simple: using one table & criteria
- Complex: using more than one table & search criteria
Simple queries are straightforward, while complex queries involve multiple tables and conditions.
Complete the query to find all female customers.
Complete the query below so that only females customers will be displayed.
This query needs specific criteria for filtering gender.
Complete the query to return people living in Belfast with insurance.
Complete the query below to return people who live in Belfast and have Insurance.
This query combines location and insurance criteria.
Complete the query to return all females born between specific dates.
Complete the query to return all females customers born between 01/01/1975 and 01/01/1985.
This query filters based on gender and birthdate range.
Complete the query to find females from Omagh with insurance.
Complete the query to return all females, from Omagh who have insurance.
This query combines gender, location, and insurance criteria.