Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 1 (0.5 points) If a primary key is not a unique number for each ID ente

ID: 3885983 • Letter: Q

Question


Question 1 (0.5 points)

If a primary key is not a unique number for each ID entered in as part of the INSERT command, an error message will be displayed.

Question 1 options:

Save

Question 2 (0.5 points)

What is the error in this SQL statement?

CREATE vehicletype (carid INTEGER PRIMARY KEY, typeofvehicle TEXT, manufacturer TEXT);

Question 2 options:

The CREATE command is incomplete

The primary key is not constructed correctly.

There are too many columns designated for the table.

Save

Question 3 (0.5 points)

(True/False). Will this SQL statement create a table called vehicletype?

INSERT INTO vehicletype (carid INTEGER PRIMARY KEY, typeofvehicle TEXT, manufacturer TEXT);

Question 3 options:

Save

Question 4 (0.5 points)

If this command correctly enters a row of data into a table, which of the following would be the correct command to create that table?
INSERT INTO vehicletype VALUES (1, “truck”, “Chevrolet”);

Question 4 options:

CREATE vehicletype (carid INTEGER PRIMARY KEY, typeofvehicle TEXT, manufacturer TEXT);

CREATE TABLE vehicletype (carid INTEGER PRIMARY KEY, typeofvehicle TEXT, manufacturer TEXT);

CREATE TABLE vehicletype (typeofvehicle TEXT, manufacturer TEXT);

CREATE TABLE (carid INTEGER PRIMARY KEY, typeofvehicle TEXT, manufacturer TEXT);

Save

Question 5 (0.5 points)

(True/False). This command was used to create a table:
CREATE TABLE vehicletype (carid INTEGER PRIMARY KEY, typeofvehicle TEXT, manufacturer TEXT);
Will the following instruction add a row to the table?
INSERT INTO vehicletype VALUES (1, SUV, Honda);

Question 5 options:

Save

Question 6 (0.5 points)

This command was used to create a table:
CREATE TABLE vehicletype (carid INTEGER PRIMARY KEY, typeofvehicle TEXT, manufacturer TEXT,year INTEGER);

At least 25 rows have been inserted with different types of vehicles (truck, sedan, SUV, sport, etc.) and manufacturer (Chevrolet, Ford, Toyota, etc.), and year the vehicle was manufactured. What would be the result of this command:

Select * FROM vehicletype WHERE manufacturer=”Ford” ORDER BY year;

Question 6 options:

A list of all the rows in the database would be displayed.

A list of only the cars manufactured by Ford would be displayed and those cars would be listed in order of the year the vehicle was manufactured.

A list of all the cars would be displayed and all cars manufactured in the same year would be listed together.

A list of cars manufactured by Ford would be displayed in the order in which they were entered into the database.

Save

Question 7 (0.5 points)

This table has been created (Database Schema) and populated with values listed in RESULTS.

Database Schema

vehicletype 10 rows

Id (PK) INTEGER

typeofvehicle TEXT

manufacturer TEXT

year INTEGER

inventoryonhand INTEGER

RESULTS

Id

typeofvehicle

manufacturer

year

inventoryonhand

1

Pickup

Chevrolet

2009

12

2

SUV

Ford

2017

13

3

SUV

Toyota

2015

7

4

Sedan

Toyota

2014

8

5

Sedan

Ford

2017

10

6

Coupe

Hyundai

2010

8

7

Pickup

Honda

2015

7

8

Sedan

Honda

2017

23

9

SUV

Hyundai

2013

6

10

Pickup

Ford

2017

16

Which of the following commands would result in a value of 11 being displayed?

Question 7 options:

SELECT MIN(inventoryonhand) FROM vehicletype;

SELECT MAX(inventoryonhand) FROM vehicletype;

SELECT AVG(inventoryonhand) FROM vehicletype;

SELECT COUNT(inventoryonhand) FROM vehicletype;

Save

Question 8 (0.5 points)

This table has been created (Database Schema) and populated with values listed in RESULTS.

Database Schema

vehicletype 10 rows

Id (PK) INTEGER

typeofvehicle TEXT

manufacturer TEXT

year INTEGER

inventoryonhand INTEGER

RESULTS

Id

typeofvehicle

manufacturer

year

inventoryonhand

1

Pickup

Chevrolet

2009

12

2

SUV

Ford

2017

13

3

SUV

Toyota

2015

7

4

Sedan

Toyota

2014

8

5

Sedan

Ford

2017

10

6

Coupe

Hyundai

2010

8

7

Pickup

Honda

2015

7

8

Sedan

Honda

2017

23

9

SUV

Hyundai

2013

6

10

Pickup

Ford

2017

16


Which of the following commands would result in a value of 23 being displayed?

Question 8 options:

SELECT SUM(inventoryonhand) FROM vehicletype;

SELECT MAX(inventoryonhand) FROM vehicletype;

SELECT MAX(inventoryonhand) FROM typeofvehicle;

SELECT SUM(inventoryonhand) FROM typeofvehicle;

Save

Question 9 (0.5 points)

This table has been created (Database Schema) and populated with values listed in RESULTS.

Database Schema

vehicletype 10 rows

Id (PK) INTEGER

typeofvehicle TEXT

manufacturer TEXT

year INTEGER

inventoryonhand INTEGER

RESULTS

Id

typeofvehicle

manufacturer

year

inventoryonhand

1

Pickup

Chevrolet

2009

12

2

SUV

Ford

2017

13

3

SUV

Toyota

2015

7

4

Sedan

Toyota

2014

8

5

Sedan

Ford

2017

10

6

Coupe

Hyundai

2010

8

7

Pickup

Honda

2015

7

8

Sedan

Honda

2017

23

9

SUV

Hyundai

2013

6

10

Pickup

Ford

2017

16

Which of the following commands would result in a value of 2009 being displayed?

Question 9 options:

SELECT MIN(year) FROM vehicletype;

SELECT MAX(year) FROM vehicletype;

SELECT AVG(inventoryonhand) FROM vehicletype;

SELECT COUNT(YEAR) FROM vehicletype;

Save

Question 10 (0.5 points)

Assuming that a table has been correctly constructed with the command
CREATE TABLE vehicletype (carid INTEGER PRIMARY KEY, typeofvehicle TEXT, manufacturer TEXT,year INTEGER);
and populated with at least 25 rows,
which of the following is a valid aggregate function:

Question 10 options:

SELECT * FROM vehicletype;

SELECT typeofvehicle FROM vehicletype ORDER BY manufacturer;

SELECT SUM inventoryonhand FROM vehicletype;

SELECT MIN(year) FROM vehicletype;

SELECT MAX(inventoryonhand) FROM typeofvehicle;

Save

True False

Explanation / Answer

Answer 1) False,

because a primary key is the unique id given, it can not be null or same as that of another row.

Answer 2) The CREATE command is incomplete

The correct syntax to create a table is to write

CREATE TABLE table_name(col1 datatype,col2 datatype...........);

table name is not provided which is the error in the question.

Answer 3) False

Insert into is used to add elements as per the schema defined. Create table is used to create a table.

Answer 4) CREATE TABLE vehicletype (carid INTEGER PRIMARY KEY, typeofvehicle TEXT, manufacturer TEXT);

is the correct option as the correct syntax for creating a table is yo write create table than the table name and than the schema

Answer 5) False

The correct syntax to insert values is

INSERT INTO table_Name

    (column1,column2,column3)

VALUES

    ('value1' , 'value2', 'value3''),

    ('value1' , 'value2', 'value3',);

Answer 6) A list of only the cars manufactured by Ford would be displayed and those cars would be listed in order of the year the vehicle was manufactured.

where clause is used to define the condition which means only the rows satisfying this condition will be displayed. Order by is used to decide the order that is either ascending or descending.