Database Design and Development Flashcards

1
Q

What law do companies have to adhere to concerning peoples private data?

A

The General Data Protection Regulation (GDPR)

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

Under the General Data Protection Regulation (GDPR) data must be:

A
•processed lawfully, fairly 
  and in a transparent 
  manner 
  in relation to individuals
•used for the declared 
  purpose only
•limited to the data needed 
  for the declared purpose
•accurate
•not kept for longer than •necessary
•held securely
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe and exemplify entity-relationship diagrams

A

Entity – a place where information about a person, thing or concept is collected – a table.
Attribute – describe the facts, details or characteristic of an entity – a field.

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

What are the rules about an entity diagram?

A

crows foot- means one to many, one line that branches into three.
primary key- underline and label
foreign key- put an asterix* and label

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

What are the attribute types for a database?

A
— text —A combination of 
               text and number e.g. 
               name, address, 
               telephone number.
— number—whole numbers 
                     and decimal 
                     numbers.
— date— usually in the format 
                 DD/MM/YYYY
— time— usually in the format 
                00:00 but can be 
                00:00:00
— Boolean— true or false
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the different types of validation?

A

Range – ensures data is
between a lower and
upper limit
Restricted Choice – limits the
user to a
list of
options.
Length Check – restricts the
number of
characters that
can be
entered.
Presence Check – ensures that
the field is
not left
blank – it is
required

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

What is a foreign key used for?

A

A FOREIGN KEY is a key used to link two tables together

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

What is a primary key used for?

A

A primary key is a unique identifier for a row/record in a table.

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

Display the team name, town, contact person and e-mail address for all teams in the east district from the table “team”

A

SELECT teamName, teamTown, teamContact, teamEmail
FROM Team
WHERE teamDistrict= “East”;

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

Display the surname, DOB and number of points scored for all players aged under 18 who have scored more than 5000 points from the table “Player”

A

SELECT playerSurname, playerDOB, playerPoints
FROM Player
WHERE playerAge< 18
AND playerPoints >= 5000;

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

Display the forename, surname and town of any players who play for a team based in Hamilton (equi-join):

A

SELECT playerForename, playerSurname, teamTown
FROM Player, Team
WHERE (Team.teamID= Player.teamID)
AND teamTown = “Hamilton”;

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

Display the forename, surname, number of points scored, team name and team ID for any players who have scored at least 4000 points for a team in the West district. As the teamID field appears in both tables, you must indicate which table you want to use, e.g. player.teamID (equi-join):

A
SELECT playerForname, playerSurname, playerPoints, teamName, Team.teamID
FROM Team, Player
WHERE (Team.teamID=Player.teamID)
AND (playerPoints>= 4000)
AND (teamDistrict="West");
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Display the forename, surname,number of points scored,team name and team ID for any players who has scored afewer than 1000 points this season, with the player who has scored the most points listed first:

A

SELECT playerForename, playerSurname, teamID, playerPoints
FROM Player
WHERE playerPoints < 1000
ORDER BY playerPoints DESC;

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

Display the forename, surname and teamID of all players from teams based in Glasgow. The listing should be in alphabetical order of surname. players with the same surname should be listed in alphabetical order of first name.

A

SELECT playerForename, playerSurname, Player.TeamID,
FROM Player,Team
WHERE teamTown = “Glasgow”
ORDER BY playerSurname ASC, playerForename ASC;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
Add the following data into the table player:
PLAY2048
Stewart
Chalmers
TEAM007
A

INSERT INTO PLAYER (playerID, playerForename,playerSurname,teamID)
VALUES (“PLAY2048”,”Stewart”,”Chalmers”,”TEAM007”);

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

in the table player the surname for PLAY2048 has been misspelled. It should be “stuart”, rather than “stewart”. you could update the correct record of the database by writing…….

A

UPDATE Player
SET playerForename = “Stuart”
WHERE playerID=”PLAY2048”;

17
Q

In the Team table the contact details for the Airdrie Avengers have changed. the teams contact person is now steve rogers and the email address is now airdrie@scotsdarts.com, you could update the table by……

A

UPDATE Team
SET teamContact = “Steve Rogers”, teamEmail = “airdrie@scotdarts.com”
WHERE teamName = “Airdrie Avengers”;

18
Q

Remove the team Border Reivers from the table Team.

A

DELETE FROM Team

WHERE teamName=”Border Reivers”;

19
Q

From the table Player delete Jessica Stark’s information as she has now given up darts

A

DELETE FROM Player
WHERE playerForname = “Jessica”
AND playerSurname = “Stark”;

20
Q

Give the example SELECT SQL

A

SELECT fieldName1, fieldName2, fieldName3, etc
FROM tableName
WHERE feildName = data;

21
Q

Give the example EQUI-JOIN SELECT SQL

A

SELECT fieldName1, fieldName2,fieldName3
FROM tableName1, tableName2
WHERE tableName1.fieldName = tableName2.fieldName
AND fieldName = data;

22
Q

Give the example SELECT SQL that is ordered either ascending or descending

A

SELECT fieldName1, fieldName2, fieldName3
FROM tableName
WHERE feildName = data
ORDER BY fieldName ASC/DESC;

23
Q

Give the example INSERT SQL

A

INSERT INTO tableName (fieldName1, fieldName2,)

VALUES (value 1, value2);

24
Q

Give the example UPDATE SQL

A

UPDATE tableName
SET fieldName=”updated value”
WHERE fieldname = “value”;

25
Q

Give the example DELETE SQL

A

DELETE FROM tablename

WHERE fieldname=”value”;