Storing and Searching Data Flashcards
What is a record?
A type of data structure which means that it’s used to store a collection of data values.
What makes records so useful?
Unlike arrays, they can store values with different data types.
What is each item in a record called?
- field
What can a field name help do?
Describe the data stored in that field of the record.
Why can’t you add extra fields to a record once they’ve been created?
Records are fixed in length.
What can records help do?
keep related information in one place.
What happens when you create a record structure?
You can assign a data type and a name to each field.
What is the record called and the fields in the example below?
record recipes int recipe_number string recipe_name bool tested int score endrecord
- record called ‘recipes’
- fields called:
‘recipe_number’
‘recipe_name’
‘tested’
‘score’
What happens once you’ve created the structure of your record?
You can assign it to variables.
What does the data in each filed need?
To have the correct data type. e.g. if an int it has to be a number.
What can you use the variable name for?
- To access a whole record
- or use both the variable name and a field name to access a particular item of a record.
What can happen to individual items in a record?
They can be accessed and changed.
If you have multiple variables with the same record structure what can you do?
collect them into an array.
What can Structured Query Language (SQL) be used for?
- search tables (usually in a database) for specific data
What does it mean when we talk about records and fields of a database table?
rows and columns
What is the SELECT and FROM keywords used for?
- SELECT followed by the names of the fields (columns) you want to receive and display.
- then FROM keyword followed by name of the table/tables you want to search.
What you do if you want to return all the fields?
wildcard: SELECT *
What can you use WHERE for?
To filter the results.
What is the WHERE keyword?
A statement used to specify conditions that a record must satisfy before it’s returned.
What can the boolean operators be used for with WHERE?
makes more specific searches
What can the LIKE statement be used for with WHERE?
- search for a pattern
- % character is used as a wildcard to represent any combination of letters and numbers
In SQL what does the ORDER BY command do?
To sort records into ascending (ASC) or descending (DESC) order.