Storing and Searching Data Flashcards

1
Q

What is a record?

A

A type of data structure which means that it’s used to store a collection of data values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What makes records so useful?

A

Unlike arrays, they can store values with different data types.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is each item in a record called?

A
  • field
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What can a field name help do?

A

Describe the data stored in that field of the record.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Why can’t you add extra fields to a record once they’ve been created?

A

Records are fixed in length.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What can records help do?

A

keep related information in one place.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What happens when you create a record structure?

A

You can assign a data type and a name to each field.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

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
A
  • record called ‘recipes’
  • fields called:
    ‘recipe_number’
    ‘recipe_name’
    ‘tested’
    ‘score’
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What happens once you’ve created the structure of your record?

A

You can assign it to variables.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does the data in each filed need?

A

To have the correct data type. e.g. if an int it has to be a number.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What can you use the variable name for?

A
  • To access a whole record

- or use both the variable name and a field name to access a particular item of a record.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What can happen to individual items in a record?

A

They can be accessed and changed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

If you have multiple variables with the same record structure what can you do?

A

collect them into an array.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What can Structured Query Language (SQL) be used for?

A
  • search tables (usually in a database) for specific data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does it mean when we talk about records and fields of a database table?

A

rows and columns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the SELECT and FROM keywords used for?

A
  • 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.
17
Q

What you do if you want to return all the fields?

A

wildcard: SELECT *

18
Q

What can you use WHERE for?

A

To filter the results.

19
Q

What is the WHERE keyword?

A

A statement used to specify conditions that a record must satisfy before it’s returned.

20
Q

What can the boolean operators be used for with WHERE?

A

makes more specific searches

21
Q

What can the LIKE statement be used for with WHERE?

A
  • search for a pattern

- % character is used as a wildcard to represent any combination of letters and numbers

22
Q

In SQL what does the ORDER BY command do?

A

To sort records into ascending (ASC) or descending (DESC) order.