Database Flashcards

1
Q

In the University of Portsmouth, each course contains many students, but each student can register in one course only. Which of the following represent this relationship. Assume that the primary key of for the table COURSE is (C_CODE) and the primary key for the table STUDENT (S_ID). How this relation could be implemented.

Select one:

Put the C_CODE as foreign key in the STUDENT table.
Put the C_CODE as foreign key in the COURSE table.
Create a new entity with the C_CODE and S_ID as composite primary key.
Put the S_ID as foreign key in the COURSE table.
Put the S_ID as foreign key in the STUDENT table.

A

Put the C_CODE as foreign key in the STUDENT table.

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

There is an error in the PostgreSQL script below. On what line number is it?

  1. SELECT *
  2. IN Client
  3. WHERE maxRent = 450
  4. ORDER BY lName;
A
  1. IN Client
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Fill in the missing word below:

A ________ key is one that is composed of more than one attribute.

Select one:

domain
primary
foreign
composite
complex
A

composite

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

Which of the following is NOT a standard SQL data type?

Select one:

decimal
int
text
string
double
A

string

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

A foreign key is an attribute, or set of attributes, within one table that matches the primary key of another table

Select one:
True
False

A

True

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

What SQL commands would you use to create a table called Viewing?

Select one:

CREATE TABLE Viewing(clientNo varchar(12) propertyNo varchar(12) viewDate date comment varchar(250));

CREATE TABLE Viewing(
varchar(12) clientNo not null,
varchar(12) propertyNo not null,
date viewDate not null,
varchar(250) comment
); 
CREATE TABLE Viewing(
clientNo varchar(12) not null,
propertyNo varchar(12) not null,
viewDate date not null,
comment varchar(250)
); 
CREATE TABLE Viewing(
clientNo: varchar(12) not null,
propertyNo: varchar(12) not null,
viewDate: date not null,
comment: varchar(250)
);
CREATE Viewing TABLE(
clientNo varchar(12) not null,
propertyNo varchar(12) not null,
viewDate date not null,
comment varchar(250)
)
A
CREATE TABLE Viewing(
clientNo varchar(12) not null,
propertyNo varchar(12) not null,
viewDate date not null,
comment varchar(250)
);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A composite key can only consist of 2 attributes

Select one:
True
False

A

False

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

What PostgreSQL commands would you use to change the branchNo in table Branch to the value B010 for all assistants where their branchNo currently equals the value B005?

Select one:

UPDATE Branch
CHANGE branchNo = ‘B005’
TO branchNo = ‘B010’

UPDATE Branch
SET branchNo = ‘B010’
WHERE branchNo = ‘B005’;

UPDATE Branch
SET branchNo = B010
WHERE branchNo = B005;

SET branchNo = ‘B010’
WHERE branchNo = ‘B005’
IN TABLE Branch;

UPDATE branchNo
SET branchNo = ‘B010’
WHERE branchNo = ‘B005’;

A

UPDATE Branch
SET branchNo = ‘B010’
WHERE branchNo = ‘B005’;

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

Assume that you have two entities CAR and OWNER. Each owner can have 1 or many cars but each car is owned by one owner. Which of the following represents this relationship:

Select one:

CAR * ———- 1 OWNER

CAR 1 ———- m OWNER

CAR 1 ———- 1 OWNER

CAR * ———- * OWNER

CAR 1 ———- * OWNER

A

CAR * ———- 1 OWNER

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

What does DML stand for?

Select one:

digital management list
data manipulation language
data management lifecycle
digital maximisation language
data migration list
A

data manipulation language

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

There is an error in the SQL script below. On what line number is it?

  1. SELECT fName, lName
  2. FROM Staff
  3. WHERE gender==’f’
  4. ORDER BY lName;
A
  1. WHERE gender==’f’
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Within a table, each primary key value ________. (select all possible answers)

Select one or more:

must be unique
is always the first field in each table
must be NULL
must be numeric
must be not NULL
all the above
A

must be unique

must be not NULL

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

What does DDL stand for?

Select one:

data dictionary list
dictionary definition language
dictionary data list
digital data language
data definition language
A

data definition language

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

The symbol used to represent an entity in a Crow’s Foot ERD is:

Select one:

a circular shape
an oval shape
a rectangular box
a triangle shape
a diamond shape
A

a rectangular box

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

Fill in the missing word in the sentence below:

The “ “ clause filters rows to be included in the result table by applying a search condition to the rows of the named table

A

where

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

What does DBMS stand for?

Select one:

database management system
digital byte management schema
database model schema
directory block manipulation system
database management structure
A

database management system

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

NOT NULL means that an attribute is allowed to be empty and does not need to have a value assigned

Select one:
True
False

A

False

18
Q

Fill in the missing word in the sentence below:

A data “ “ is a collection of concepts that can be used to describe a set of data, the operations to manipulate the data, and a set of integrity constraints for the data.

A

model

19
Q

In the database schema below, the attribute propertyNo in table PropertyForRent is what?

PropertyForRent (propertyNo, street, city, postcode, type, rooms, rent, ownerNo, staffNo, branchNo)

Select one:
a composite key
a foreign key
a partial key
a superkey
a primary key
A

a primary key

20
Q

In the term ERD, the E stands for what?

Select one or more:

a.
End

b.
Entity

c.
Element

d.
Example

A

Entity

21
Q

A one to one relationship should be “ “ in any relational database

A

rare

22
Q

Each table must have a “ “ key.
A “ “ key value must exist in both tables that have a relationship.

composite logical set secondary primary foreign

A
  1. primary

2. foreign

23
Q

A database would normally be in which normalisation form?

Select one or more:

3rd
2nd
4th
0
1st
A

3rd

24
Q

A many to many relationship cannot be implemented as such in a relational database

Select one:
True
False

A

True

25
Q

A ________ identifier is a key that is composed of more than one attribute.

Select one:

foreign
referential
domain
composite
primary
A

composite

26
Q

A foreign key value must exist in both tables that have a relationship.

Select one:
True
False

A

True

27
Q

The * symbol denotes a wildcard in SQL

Select one:
True
False

A

False

28
Q

What PostgreSQL commands would you use to insert a new record into table Viewing?

Select one:

INSERT INTO Viewing VALUES(‘CR56’, ‘PA14’, ‘01/03/14’, ‘too small’);
INSERT INTO Viewing (‘CR56’, ‘PA14’, ‘01/03/14’, ‘too small’);
PUT INTO Viewing VALUES(‘CR56’, ‘PA14’, ‘01/03/14’, ‘too small’);
INSERT Viewing (‘CR56’, ‘PA14’, ‘01/03/14’, ‘too small’):
SET Viewing VALUES(‘CR56’, ‘PA14’, ‘01/03/14’, ‘too small’);

A

INSERT INTO Viewing VALUES(‘CR56’, ‘PA14’, ‘01/03/14’, ‘too small’);

29
Q

What is the correct description for the following business rule?

A car has a single owner. A person can own many cars.

This denotes a “ “ relationship

A

one to many

30
Q

Which of the following best describes a database?

Select one:

a collection of data designed to store information
a group of related files sorted alphabetically for easy information retrieval
a shared collection of logically organised data designed to flexibly meet the information needs of an organisation
a unique set of information for management use
None of the above

A

a collection of data designed to store information

31
Q

Which of the following is NOT a standard SQL data type?

Select one:

text
decimal
string
double
int
A

string

32
Q

Which of the following are DDL commands? (PostgreSQL)

Choose 1 or more.

REPLACE
SELECT
CREATE
DROP
UPDATE
DELETE
ALTER
A

DROP
ALTER
CREATE

33
Q

Fill in the missing word below:

A ________ key is one that is composed of more than one attribute.

Select one:

complex

domain

foreign

composite

primary

A

composite

34
Q

Each database table must have a ________ key.

Select one:

primary

foreign

secondary

logical

A

primary

35
Q

What PostgreSQL commands would you use to delete all records from table Registration where the value of staffNo is SL35?

Select one:

DELETE FROM Registration
WHERE staffNo = ‘SL35’;

DELETE IN Registration
WHERE staffNo = ‘SL35’;

DELETE In Registration
WHERE staffNo == ‘SL35’;

DELETE FROM Registration
WHERE staffNo is ‘SL35’

DELETE FROM Registration
WHERE staffNo == ‘SL35’;

A

DELETE FROM Registration

WHERE staffNo = ‘SL35’;

36
Q

Which of the following code snippets will successfully create a table called country?

CREATE TABLE NAME COUNTRY (
COUNTRY_ID SERIAL PRIMARY KEY,
COUNTRY_CODE CHAR(2) NOT NULL,
COUNTRY_NAME VARCHAR(15) NOT NULL);

CREATE TABLE COUNTRY (
COUNTRY_ID PRIMARY KEY,
COUNTRY_CODE CHAR(2) NOT NULL,
COUNTRY_NAME VARCHAR(15) NOT NULL);

CREATE TABLE COUNTRY
COUNTRY_ID SERIAL PRIMARY KEY,
COUNTRY_CODE CHAR(2) NOT NULL,
COUNTRY_NAME VARCHAR(15) NOT NULL;

CREATE TABLE COUNTRY (
COUNTRY_ID SERIAL PRIMARY KEY,
COUNTRY_CODE CHAR(2) NOT NULL,
COUNTRY_NAME VARCHAR(15) NOT NULL);

CREATE TABLE COUNTRY (
COUNTRY_ID SERIAL PRIMARY KEY
COUNTRY_CODE CHAR(2) NOT NULL
COUNTRY_NAME VARCHAR(15) NOT NULL);

A

3.

CREATE TABLE COUNTRY (
COUNTRY_ID SERIAL PRIMARY KEY,
COUNTRY_CODE CHAR(2) NOT NULL,
COUNTRY_NAME VARCHAR(15) NOT NULL);

37
Q

The primary key in a database table does not have to be unique

Select one:
True
False

A

False

38
Q

Fill in the missing word in the sentence below:

” “ DML is a language that allow the user to tell the system what data is needed and exactly how to retrieve it

A

procedural

39
Q

The keyword “ “ is used to return one version of an attribute value.

SINGLE DISTINCT ONE ORDER SELECT ONLY

A

DISTINCT

The keyword “ “ is used to return one version of an attribute value.

40
Q

Which of the descriptions below best describes a database?

Select one:

A collection of data, software and hardware working together to further business goals

A collection of information that is organized so that it can easily be accessed, managed, and updated

A collection of linked data

A complex infrastructure of layered software to control user access to data

A single, possibly large, repository of data that can be used simultaneously by many departments and users

A

A single, possibly large, repository of data that can be used simultaneously by many departments and users

41
Q

NOT NULL means that an attribute is allowed to be empty and does not need to have a value assigned

Select one:
True
False

A

False

42
Q

Choose the correct word from the dropdown in the sentence below:

A database “ “ is a description of the database structure

A

schema