Chapter 7 Flashcards

1
Q

The SQL CREATE TABLE statement is used to name a new table and describe the table’s columns.

A

True

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

The SQL keyword CONSTRAINT is used to define one of five types of constraints.

A

True

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

The SQL keyword PRIMARY KEY is used to designate the column(s) that are the primary key for the table

A

True

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

The SQL keyword CONSTRAINT is used to limit column values to specific values.

A

True

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

The SQL keyword CONSTRAINT is used in conjunction with the SQL keywords PRIMARY KEY and FOREIGN KEY.

A

True

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

One advantage of using the CONSTRAINT command to define a primary key is that the database designer controls the name of the constraint.

A

True

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

The SQL keyword UNIQUE is used to define alternative keys.

A

True

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

If the table PRODUCT has a column PRICE, and PRICE has the data type Numeric (8,2), the value 98765 stored in that field will be displayed by the DBMS as 98765.00.

A

False

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

If the table ITEM has a column WEIGHT, and WEIGHT has the data type Numeric (7,2), the value 4321 with be displayed by the DBMS as 43.21.

A

True

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

The SQL keyword CHECK is used to limit column values to specific values.

A

True

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

The SQL keyword MODIFY is used to change the structure, properties or constraints of a table.

A

False

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

Data values to be added to a table are specified by using the SQL VALUES clause.

A

True

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

The SQL keyword DELETE is used to delete a table’s structure.

A

False

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

When the correct SQL command is used to delete a table’s structure, the command can only be used with a table that has already had its data removed.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
Which SQL keyword is used to name a new table and describe the table's columns?
A) SET
B) CREATE
C) SELECT
D) ALTER
E) CONSTRAINT
A

B

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

If the table PRODUCT has a column PRICE that has the data type Numeric (8,2), the value 12345 will be displayed by the DBMS as ________.

A

A

17
Q

Which SQL keyword is used to impose restrictions on a table, data or relationship?

A

E

18
Q
One advantage of using the CONSTRAINT phrase to define a primary key is that the database designer controls the \_\_\_\_\_\_\_\_.
A) name of the primary key
B) name of the foreign key
C) name of the constraint
D) A and B
E) A, B, and C
A

C

19
Q
Which of the following illustrates the authors' preferred style of defining a primary key?
A) CREATE TABLE CUSTOMER (
	CustomerID	Integer	Primary Key
	LastName	Char(35)	Not Null
	First Name	Char(25)	Null
B) CREATE TABLE CUSTOMER (
	CustomerID	Integer	Not Null
	LastName	Char(35)	Not Null
	First Name	Char(25)	Null	
	CONSTRAINT CustomerPK PRIMARY KEY (CustomerID)
C) CREATE TABLE CUSTOMER (
	CustomerID	Integer	Not Null
	LastName	Char(35)	Not Null
	First Name	Char(25)	Null
ALTER TABLE CUSTOMER	
	ADD CONSTRAINT CustomerPK PRIMARY KEY        (CustomerID);
D) either B or C
E) The authors do not demonstrate a preference for how to define a primary key.
A

B

20
Q

Given the SQL statement

CREATE TABLE SALESREP (
SalesRepNo	int	NOT NULL,
RepName	char(35)	NOT NULL,
HireDate	date	NOT NULL,

CONSTRAINT	SalesRepPK	PRIMARY KEY (SalesRepNo),
CONSTRAINT	SalesRepAK1	UNIQUE (RepName)
);
we know that \_\_\_\_\_\_\_\_.
A) RepName is the primary key
B) RepName is a foreign key
C) RepName is a candidate key
D) RepName is a surrogate key
E) None of the above is true
A

C

21
Q
The SQL keyword used to limit column values to specific values is \_\_\_\_\_\_\_\_.
A) CONSTRAINT
B) CHECK
C) NOT NULL
D) UNIQUE
E) UPDATE
A

B

22
Q
Which SQL keyword is used to change the structure, properties or constraints of a table?
A) SET
B) CREATE
C) SELECT
D) ALTER
E) CONSTRAINT
A

D

23
Q
Which SQL keyword is used to delete a table's structure?
A) DELETE
B) DROP
C) DISPOSE
D) ALTER
E) MODIFY
A

B

24
Q

When the correct SQL command is used to delete a table’s structure, what happens to the data in the table?
A) If the deleted table was a parent table, the data is added to the appropriate rows of the child table.
B) If the deleted table was a child table, the data is added to the appropriate rows of the parent table.
C) The data in the table is also deleted.
D) Nothing because there was no data in the table since only an empty table can be deleted.
E) A and B

A

C

25
Q
Which SQL keyword is used to add one or more rows of data to a table?
A) DELETE
B) INSERT
C) SELECT
D) SET
E) UPDATE
A

B