Database Flashcards
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.
Put the C_CODE as foreign key in the STUDENT table.
There is an error in the PostgreSQL script below. On what line number is it?
- SELECT *
- IN Client
- WHERE maxRent = 450
- ORDER BY lName;
- IN Client
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
composite
Which of the following is NOT a standard SQL data type?
Select one:
decimal int text string double
string
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
True
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) )
CREATE TABLE Viewing( clientNo varchar(12) not null, propertyNo varchar(12) not null, viewDate date not null, comment varchar(250) );
A composite key can only consist of 2 attributes
Select one:
True
False
False
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’;
UPDATE Branch
SET branchNo = ‘B010’
WHERE branchNo = ‘B005’;
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
CAR * ———- 1 OWNER
What does DML stand for?
Select one:
digital management list data manipulation language data management lifecycle digital maximisation language data migration list
data manipulation language
There is an error in the SQL script below. On what line number is it?
- SELECT fName, lName
- FROM Staff
- WHERE gender==’f’
- ORDER BY lName;
- WHERE gender==’f’
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
must be unique
must be not NULL
What does DDL stand for?
Select one:
data dictionary list dictionary definition language dictionary data list digital data language data definition language
data definition language
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 rectangular box
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
where
What does DBMS stand for?
Select one:
database management system digital byte management schema database model schema directory block manipulation system database management structure
database management system