9 Databases Flashcards

1
Q

What are the 6 database datatypes you need to know?

A
  • Integer: whole number
  • Real: decimal number
  • Text: sequence of characters
  • Character: single character
  • Date/Time -
  • Boolean - one of 2 values e.g. Yes/No, True/False
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a field?

A

One piece of information about an object e.g. student name (column)

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

What is a record?

A

A collection of fields about the same object e.g. one student (row)

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

What is a table?

A

A collection of records about the same entity e.g. students

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

What is a primary key?

A

A field that uniquely identifies each record. No duplicates e.g. StudentID

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

What is a database?

A

A persistent and structured collection of data

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

How many fields are in the table?

How many records are in the table?

A

How many fields are in the table? 5

How many records are in the table? 8

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

Which field is suitable as a primary key and why?

A

Show Number because it uniquely identifies each show/record

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

State an appropriate data type for the field Date

State an appropriate data type for the field Sold out

State an appropriate data type for the field Show Number

A

State an appropriate data type for the field Date: Date

State an appropriate data type for the field Sold Out: Boolean

State an appropriate data type for the field Show Number: Text

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

Which field is suitable as a primary key and why?

A

PCID because it uniquely identifies each stock item/record

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

State an appropriate data type for the field PCID:

State an appropriate data type for the field Screen Size:

State an appropriate data type for the field Price:

A

State an appropriate data type for the field PCID: text

State an appropriate data type for the field Screen Size: Integer

State an appropriate data type for the field Price: Real

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

An SQL SELECT statement is used to retrieve data that meets a specified criteria from a database table. The data may also be sorted in ascending or descending order. What are all of the key words used in an SQL SELECT statement?

A

SELECT Flight_Code, Flight_Name

FROM FLIGHTS

WHERE Flight_Duration > 14 AND

Flight_Duration < 17

ORDER BY Flight_Name DESC

Retrieves the flight code and flight name from the table where the flight duration is 15 or 16 hours and sorts the data in descending order by Flight Code

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

SUM can be used as part of a SELECT statement to find the sum of all the values that meet a specified criteria. How is it used?

A

SELECT Sum(Flight_Duration)

FROM FLIGHTS

WHERE Flight_Name = “Emirates”

Calculates the sum of the flight durations or all Emirate flights

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

COUNT can be used as part of a SELECT statement to count the number of records that meet a specified criteria. How is it used?

A

SELECT Count(Flight_Duration)

FROM FLIGHTS

WHERE Flight_Duration < 17

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