Databases and SQl Flashcards

1
Q

What are the data types to choose from when creating database fields?

A

⚫️integer
⚫️float
⚫️date / time /Datetime
⚫️Char (FIXED length up to 8,000 characters)
⚫️Varchar (variable length string up to 8,000 characters )
⚫️Text (variable length string up to 2GB)
⚫️autonumber

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

What are flat file databases?

A

Stores sa single table of data inside a single text file

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

What are primary keys ?

A

A field that stores unique data for each record in a table.

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

What are some flat file database issues ?

A

🔵inconsistencies in the data , making it hard to search or sort the data
🔵redundant data, so the databases use more storage/memory than needed

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

What is a ‘flat file database “?

A

A database that has all the data stored in one table.
▪️Each record is identified as a new line
▪️flat file databases are often stored using a CSV (comma separated values )format
▪️each field is separated by a comma

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

What are relational databases ?

A

Contain multiple tables , each table is known as a relation. Each table has links to others known as relations.

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

What is a foreign key?

A

A field in a table that references the primary key of another table.

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

What is SQL?

A

Structured query language
The language allows you to create , query, update and delete data to and from databases

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

Write an SQL query to output all the first names of members and their memberID, who are male

A
  • all normal PSEUDOCODE arithmetic and operational comparatives can be used
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you select all the fields within a table to output

A

SELECT *

Wildcard

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

Write an SQL query to find all the fields of dogs that are older than four (including those that are 4) and whose colour contains the letter ‘B’

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

Sort this array called members into ascending order of town , up outputting the first name and memberID

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

Change the age of Molly from 5 to 6

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

Delete all the black spaniels from the table

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

Select the owner and dog names for all the four year old dogs
(Multiple tables )

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

Why are databases used?

A

They are used to store large amounts of data.
They make retrieving information easy and efficient

17
Q

What are some advantages of flat file databases ?

A

All data in one table , so easier to set up and understand

18
Q

What are some advantages of relational databases ?

A

🔵data is only stored in one place and then referenced. This means that to input , update or delete pieces of data, it only has to be done in one place which can prevent inconsistencies
🔵only storing the same price of dat once will also save storage space
🔵relational databases can be more secure , some tables can be made more confidential so only some users can see certain data (helps companies meet data protection laws)

19
Q

What is a data redundancy?

A

Having the same piece of data stored in multiple places

20
Q

How do you insert a full record into a table ?

A
21
Q

How would insert bits of a record into a table ?

A
22
Q

What is a table ?

A
23
Q

What is a record ?

A

The row of a table

24
Q

What is a field ?

A

Columns of the table

25
Q

How do relational databases eliminate data inconsistencies?

A

Since the data only has to be entered once, and can be referenced through other tables, there is less likely to be any inconsistencies such as spelling mistakes made when entering data in. This will reduce the amount of errors made when making queries

26
Q

How do relational databases eliminate data redundancy?

A

Since the data can be referenced from other tables using foreign keys, the same pieces of data do not have to be repeated and stored in multiple places, there are no longer pieces of data that are being repeated unnecessarily