Sophia __ Welcome milestone 1 test
pdf
keyboard_arrow_up
School
Southern New Hampshire University *
*We aren’t endorsed by this school
Course
CS-210
Subject
Information Systems
Date
Feb 20, 2024
Type
Pages
42
Uploaded by Matthewdbills
1
31/36
that's 86%
RETAKE
31 questions were answered correctly
.
5 questions were answered incorrectly
.
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
USING the SELECT statement, query the track table ordered by
the track_id. Set the LIMIT to 8 and OFFSET to 40.
What is the name of the last row returned?
RATIONALE
●
●
Hand In My Pocket
Not The Doctor
●
Ironic
●
Right Through You
UNIT 1 — MILESTONE 1
31/36
CONCEPT
→
LIMIT and OFFSET to Cap Results
2
Common mistakes with the LIMIT and OFFSET clauses include
mixing up the two, not using the ORDER BY clause to enforce a
predictable result set, and not using the rows skipped using
OFFSET.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Identify the correctly constructed ALTER TABLE statement that
removes the age column from the user table.
RATIONALE
●
●
ALTER TABLE user DROP
age_now;
●
ALTER TABLE user ADD age int;
ALTER TABLE user DROP age;
●
ALTER TABLE user DROP age int;
UNIT 1 — MILESTONE 1
31/36
CONCEPT
→
ALTER TABLE to Change Columns: Add/Drop
3
Common mistakes when adding or dropping a column include
incorrectly naming the table or column names, not including
the data type and size when adding a column, and using the
incorrect syntax structure of the ALTER TABLE command.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Using the LIKE operator in the WHERE clause, filter the customer
table to list the individuals that have a phone number ending with
88.
Identify the 2nd individual's country.
RATIONALE
●
●
Toronto
●
USA
●
India
Canada
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
4
Common mistakes when using the LIKE operator are filtering
the wrong column of data, using the wrong data table, omitting
the single quotes around the data, and forgetting to include the
wild card % in the correct location of the LIKE operator.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Given the employee table and the data that it contains, and
assuming that you have the rights to modify the table, which of
the following ALTER TABLE statements would create an error?
●
●
ALTER TABLE employee ALTER
COLUMN city TYPE VARCHAR
(100);
ALTER TABLE employee ALTER
COLUMN employee_id TYPE
VARCHAR (50);
●
ALTER TABLE employee ALTER
COLUMN postal_code TYPE
VARCHAR (100);
UNIT 1 — MILESTONE 1
31/36
CONCEPT
→
ALTER TABLE to Change Columns: Data Characteristics
5
RATIONALE
Common mistakes when modifying the data type of a column
include: not casting the variables if needed; not including the
table and column names to change; the column being a
primary or foreign key; and failing to consider the error
messages that may occur when converting the existing data in
the table.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Using the GROUP BY and HAVING clauses, filter the customer
table by country.
How many countries have more than 3 customers?
●
●
ALTER TABLE employee ALTER
COLUMN email TYPE VARCHAR
(100);
5
UNIT 1 — MILESTONE 1
31/36
CONCEPT
→
HAVING to Filter On Aggregates
6
RATIONALE
Common mistakes when using the HAVING clause with the
GROUP BY clause in a SELECT statement include: not using
aggregate functions in the SELECT clause; not including each
column in the SELECT clause in the GROUP BY clause; using
the incorrect aggregate function; and incorrectly including the
filter in the WHERE clause instead of the HAVING clause.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Using the IN operator, filter the album table to find those with the
artist ID set to 8, 17, 22, or 3.
Identify the title of the 4th record.
●
●
18
●
7
●
6
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
CONCEPT
→
IN to Filter Data
7
RATIONALE
Common mistakes include filtering the wrong column of data,
using the wrong table, not using commas to separate out each
criterion, omitting single quotes around string data, and
incorrectly spelling the values.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Using the SELECT statement, query the track table to find the
total cost of the tracks on album_id 10, rounded to the nearest
cent.
●
●
Big Ones
Minha Historia
●
Out of Exile
●
Coda
UNIT 1 — MILESTONE 1
31/36
CONCEPT
→
ROUND to Round Numbers
8
RATIONALE
Common mistakes when using the ROUND function include not
selecting the right column, not including the precision level,
omitting the ( ) around the column/function, and failing to add in
the filter conditions.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Using the AND or OR statement, filter the employee table for
employees who have a title starting with Sales and an address
containing Ave.
Identify the last name of the 3rd record.
●
●
13.9
●
13
13.86
●
14
UNIT 1 — MILESTONE 1
31/36
CONCEPT
→
Multiple Filters
9
RATIONALE
Common mistakes include using the = instead of LIKE when
utilizing wild cards, filtering the wrong column of data, using
the wrong data table, omitting the single quotes around the
data, and forgetting to include the wild cards in all parts of the
string rather than just on one end. Another common mistake
when using the AND and OR statements is selecting the
incorrect option; the AND operator should be used when both
conditions need to apply whereas the OR operator should be
used when only one condition of the two should apply.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
●
●
Peacock
Johnson
●
Margaret
●
Steve
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
CONCEPT
→
AVG to Average Values
10
Using the SELECT statement, query the invoice table to find the
average total cost for all orders placed between 2011-01-01 and
2012-01-01.
RATIONALE
Common mistakes when using the AVG function include not
selecting the right column, omitting the ( ) around the column,
and failing to add in the filter conditions.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Which of the following is a correctly formatted INSERT
statement that will insert three records into the album table?
●
●
5.8095238095238095
5.7063106796116505
●
5.7357723577235772
●
0
UNIT 1 — MILESTONE 1
31/36
CONCEPT
→
INSERT INTO to Add Multiple Rows
RATIONALE
Common mistakes when inserting multiple records using a
single INSERT statement include not using commas between
each set of criteria, not adhering to the constraints, not
including the same number of parameters for each statement,
and mixing up the types.
Report an issue with this question
insert into album (artist_id, title,
album_id) values (1, 'Genesis',
450) (1, 'Self-Titled', 451) (1, 'Lyrics',
452)
●
insert into album (artist_id, title,
album_id) values (1, 'Genesis',
450), (1, 'Self-Titled', 451), (1,
'Lyrics', 452)
●
insert into album (album_id, title,
artist_id) values (1, 'Genesis', 450),
(1, 'Self-Titled', 451), (1, 'Lyrics',
452)
●
insert into album (artist_id, title,
album_id) values (1, 'Genesis',
450), (1, 'Self-Titled', 451), (1,
'Lyrics', 450)
UNIT 1 — MILESTONE 1
31/36
11
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Consider the following new table:
CREATE TABLE contact(
user_id SERIAL PRIMARY KEY,
phone VARCHAR NOT NULL
);
Given this new table, which INSERT statement would query
from the customer table to insert the phone number of all
customers that have an email address that contains the word
"apple" in it?
●
●
INSERT INTO contact (phone)
SELECT phone FROM customer;
●
INSERT INTO contact (user_id,
phone)
SELECT phone FROM customer
WHERE email LIKE %apple%;
●
INSERT INTO contact
SELECT phone FROM customer
WHERE email LIKE '%apple%';
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
CONCEPT
→
INSERT to Add Queried Data
12
RATIONALE
Common mistakes when inserting data queried from another
table include: not setting the value for the sequence; not
having the same number of values as the number of columns;
not including data for rows with a NOT NULL constraint; not
adhering to the UNIQUE constraint; not considering foreign
keys; not quoting string data; and not having the set of values
in the same order as the column list.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Using the SELECT statement, query the customer table to find
the number of customers that do not live in the country France.
●
INSERT INTO contact (phone)
SELECT phone FROM customer
WHERE email LIKE '%apple%';
●
5
●
59
UNIT 1 — MILESTONE 1
31/36
CONCEPT
→
COUNT to Count Records
13
RATIONALE
Common mistakes when using the COUNT function include not
selecting the right column, omitting the ( ) around the column,
and failing to add in the filter conditions.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Which of these SELECT statements would successfully display
exactly five columns of data from the customer table?
●
54
●
6
●
SELECT customer_id + city +
state + phone + company
FROM customer
UNIT 1 — MILESTONE 1
31/36
CONCEPT
→
SELECT to Display Data
14
RATIONALE
Common mistakes when displaying columns of data by using
a SELECT statement include using the * wildcard when the
table has more than the desired number of columns;
misspelling a clause name, table name, or column name; and
forgetting to use commas appropriately.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Which of the following would set the postal_code of the
customer with the customer_id equal to 22, to 33433.
●
SELECT customer_id, city, state,
phone, company
FROM customer;
●
SELECT customer_id, city_id,
state_id, phone_id, company_id
FROM customer;
●
SELECT *
FROM customer;
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
CONCEPT
→
UPDATE to Edit Row
15
RATIONALE
Common mistakes when using the UPDATE statement that
impacts a single row in a table include omitting commas
between each variable set, not including the WHERE clause to
identify specific rows, not updating all fields, and using AND in
the SET clause.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
●
●
UPDATE customer
SET postal_code
WHERE customer_id = '33433'
UPDATE customer
SET postal_code = '33433'
WHERE customer_id = 22
●
UPDATE customer
IN postal_code = '33433'
WHERE customer_id = 22
●
UPDATE customer
WHERE customer_id = 22
SET postal_code = '33433'
UNIT 1 — MILESTONE 1
31/36
CONCEPT
→
Aggregate Functions
16
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Identify the SQL command that uses an aggregate function that
could be used to find the newest employee in the employee
table.
RATIONALE
Common mistakes when using aggregate functions include not
choosing the right aggregate function, omitting the ( ) around
the columns, and misspelling the aggregate function name.
Report an issue with this question
●
●
SELECT min(hire_date) FROM
employee;
●
SELECT small(hire_date) FROM
employee;
SELECT max(hire_date) FROM
employee;
●
SELECT large(hire_date) FROM
employee;
UNIT 1 — MILESTONE 1
31/36
CONCEPT
→
WHERE to Filter Data
17
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Using the WHERE clause, filter the track table to include the
tracks that are on album_id 4.
Identify the name of the 2nd track listed.
RATIONALE
Common mistakes when using a WHERE clause are using the
wrong inequality comparison (e.g., > rather than <), filtering on
the wrong column of data, and using the wrong data table.
Report an issue with this question
●
Dog Eat Dog
●
AC/DC
●
Go Down
●
Let There Be Rock
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Which of the following statement(s) would successfully delete
the invoice_id 280 from the invoice table?
RATIONALE
Common mistakes when deleting from tables include not
removing tables that reference their foreign keys, not deleting
from the tables in the right order, not deleting data from all of
the tables, not using quotes around string literals, and not
using the right syntax.
●
DELETE FROM invoice_line
WHERE invoice_id = 280;
DELETE FROM invoice WHERE
invoice_id = 280;
DELETE FROM invoice_line
WHERE invoice_id = 280;
●
DELETE FROM invoice WHERE
invoice_id = 280;
DELETE FROM invoice_line
WHERE invoice_id = 280;
●
DELETE FROM invoice WHERE
invoice_id = 280;
UNIT 1 — MILESTONE 1
31/36
CONCEPT
→
DELETE FROM to Remove Row
18
CONCEPT
→
Table Constraints
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Which of these constraints verifies that data in a column is
based on columns in other tables?
RATIONALE
The foreign key constraint ensures that the data entered in the
column is based on columns in other tables and must exist.
●
FOREIGN KEY
●
UNIQUE
●
CHECK
●
PRIMARY KEY
UNIT 1 — MILESTONE 1
31/36
19
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Using the WHERE and HAVING clauses, filter the track table for
the tracks having the milliseconds greater than 100,000, grouped
by the album_id having the number of tracks greater than 20.
Provide the list of album_id's and the count of tracks that fit these
criteria.
Which of the following queries would provide the correct
results?
●
●
SELECT album_id, count(track_id)
FROM track
GROUP BY album_id
HAVING count(track_id) > 20
WHERE milliseconds > 100000
●
SELECT album_id, sum(track_id)
FROM track
WHERE milliseconds > 100000
GROUP BY album_id
HAVING sum(track_id) > 20
SELECT album_id, count(track_id)
FROM track
WHERE milliseconds > 100000
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
CONCEPT
→
Filters to Specify Data
20
RATIONALE
Common mistakes when using both the WHERE and HAVING
clause include using the aggregate function in the WHERE
clause, listing the clauses in the incorrect order, failing to
include all of the columns listed in the SELECT clause in the
GROUP BY clause, and using the incorrect aggregate
functions.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Which of the following is a correctly formatted INSERT
statement that will successfully add a record into the playlist
table?
●
GROUP BY album_id
HAVING count(track_id) > 20
●
SELECT album_id, count(track_id)
FROM track
WHERE count(track_id) > 20
GROUP BY album_id
HAVING milliseconds > 100000
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
CONCEPT
→
INSERT INTO to Add Row
21
RATIONALE
Common mistakes when inserting a new record into an existing
table include: not having the same number of values as the
number of columns; not including data for rows with a NOT
NULL constraint; not adhering to the UNIQUE constraint; not
considering foreign keys; not quoting string data; and not
having the set of values in the same order as the column list.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
●
insert into playlist (playlist_id,
name) values (30, 'New Age
Playlist' )
●
insert into playlist (playlist_id,
name) values ('New Age
Playlist', 35)
●
insert into playlist (playlist_id,
name) values ('New Age Playlist' )
●
insert into playlist (playlist_id,
name) values (40, New Age
Playlist)
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
CONCEPT
→
CREATE TABLE Syntax
this assessment.
https://postgres.sophia.org/
The following CREATE TABLE statement creates a table called
'users' that consists of the user_id as the primary key, the
username, and the password.
CREATE TABLE users(
user_id int PRIMARY KEY,
username VARCHAR 50,
password VARCHAR (50)
);
Identify the line of code that would generate an error in this
CREATE TABLE statement.
RATIONALE
Common mistakes with creating a table are: not including all
column names, not matching the names exactly, not including
data types, not including sizes for strings, omitting commas to
separate out each column, and not using ( ) around the entire
table set.
3
●
1
●
4
●
2
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
22
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Identify the correctly constructed ALTER TABLE statement to
add a UNIQUE constraint to the column student_number with
the constraint name student_number_unique on the table
called 'student'.
●
●
ALTER TABLE student ADD
CONSTRAINT student_number
UNIQUE
(student_number_unique);
●
ALTER TABLE student ADD
UNIQUE student_number
CONSTRAINT
(student_number_unique);
●
ALTER TABLE student ADD
CONSTRAINT student_number
UNIQUE (student_number);
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
CONCEPT
→
UNIQUE to Validate Data
23
RATIONALE
Common mistakes with adding the UNIQUE constraint to an
existing column include not having ( ) around the column
names, omitting the keyword UNIQUE, incorrectly spelling the
column name, and not including the constraint name.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Consider the following table:
CREATE TABLE artwork(
artwork_id SERIAL PRIMARY KEY,
artwork_name VARCHAR NOT NULL
);
Which of the following is a correctly formatted INSERT
statement that will successfully add a new record that uses the
auto-incremented primary key into this table?
●
ALTER TABLE student ADD
CONSTRAINT
student_number_unique UNIQUE
(student_number);
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
CONCEPT
→
INSERT to Add Data
24
RATIONALE
Common mistakes when inserting a new record into an existing
table using an auto-incremented ID include: not setting the
value for the sequence; not having the same number of values
as the number of columns; not including data for rows with a
NOT NULL constraint; not adhering to the UNIQUE constraint;
not considering foreign keys; not quoting string data; and not
having the set of values in the same order as the column list.
Report an issue with this question
●
●
insert into artwork
(artwork_name) values (Mona
Lisa)
insert into artwork
(artwork_name) values ('Mona
Lisa' )
●
insert into artwork (artwork_id,
artwork_name) values (1, 'Mona
Lisa' )
●
insert into artwork (artwork_id,
artwork_name) values (nextval,
'Mona Lisa')
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
CONCEPT
→
LIKE Wildcards
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Using the LIKE operator in the WHERE clause, use the necessary
wildcards to filter the album table to find the albums that have a
year starting with 19 in the title.
Identify the 4th album ID.
RATIONALE
Common mistakes when using the LIKE operator are filtering
the wrong column of data, using the wrong data table, omitting
the single quotes around the data, and forgetting to include the
wild cards in all parts of the string rather than just on one end.
Report an issue with this question
●
104
●
196
●
123
146
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
25
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Which of the following would set the company of the customers
that live in the city of Prague to Humor Inc.?
RATIONALE
Common mistakes when using the UPDATE statement to edit
multiple rows in a table include omitting commas between
each variable set, not including the WHERE clause to identify
specific rows, not updating all fields, and using AND in the SET
clause.
●
UPDATE customer
SET company = Humor Inc.
WHERE city = 'Prague'
●
UPDATE customer
SET company = 'Humor Inc.'
AND city = 'Prague'
●
UPDATE customer
SET company = 'Humor Inc.'
WHERE city = 'Prague'
●
UPDATE customer
WHERE city = 'Prague'
SET company = 'Humor Inc.'
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
CONCEPT
→
UPDATE to Edit Multiple Rows
26
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Given the invoice table and the data that it contains, and
assuming that you have the rights to modify the table, which of
the following ALTER TABLE statements would work without
errors?
●
●
ALTER TABLE invoice ALTER total
TYPE VARCHAR (1);
ALTER TABLE invoice ALTER
COLUMN total TYPE VARCHAR
(100);
●
ALTER TABLE invoice ALTER
COLUMN billing_state TYPE
BOOLEAN;
●
ALTER TABLE customer ALTER
COLUMN billing_city TYPE
VARCHAR (1);
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
CONCEPT
→
ALTER TABLE to Change Columns: Data Type
27
RATIONALE
Common mistakes when modifying the data type of a column
include: not casting the variables if needed; not including the
table and column names to change; the column being a
primary or foreign key; and failing to consider the error
messages that may occur when converting the existing data in
the table.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Using the SELECT statement, query the track table to find the
maximum bytes where the milliseconds are greater than 11650.
●
●
387360
●
319888
1059546140
●
38747
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
CONCEPT
→
MAX & MIN to Find Extremes
28
RATIONALE
Common mistakes when using the MAX function include not
selecting the right column, omitting the ( ) around the column,
and failing to add in the filter conditions.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Select the correctly constructed CHECK constraint to validate
the date_of_birth column of type data, to ensure that values
placed into it are greater than 1850-01-01
●
●
CHECK (date_of_birth > 1850-01-
01)
●
CHECK (date_of_birth < '1850-01-
01')
CHECK (date_of_birth > '1850-01-
01')
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
CONCEPT
→
CHECK to Validate Data
29
RATIONALE
Common mistakes with CHECK constraints include having the
incorrect range, incorrectly using AND and OR, using the
incorrect comparison operator, incorrectly naming columns, not
considering the right data type, and omitting quotes around
string data.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Given the tables provided, which of the following DROP TABLE
series of statements would correctly remove the tables without
causing an error?
●
●
CHECK (date_of_birth >= '1850-
01-01')
●
DROP TABLE customer;
DROP TABLE invoice;
DROP TABLE invoice_line;
●
DROP TABLE track;
DROP TABLE playlist_track;
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
CONCEPT
→
DROP TABLE to Remove Tables
30
RATIONALE
Common mistakes when dropping a table include not
considering the foreign keys linked to the table, not removing
the foreign keys on the table, and not including the correct
table name.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
What is the main function of the SELECT clause in SQL?
●
DROP TABLE artist;
DROP TABLE playlist_track;
DROP TABLE invoice_line;
DROP TABLE playlist;
●
DROP TABLE album;
DROP TABLE artist;
DROP TABLE playlist;
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
CONCEPT
→
SQL Clauses
31
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Using the SELECT statement, query the track table to find the
total price for all tracks that have the genre_id equal to 2.
●
To retrieve rows from one or
more table columns
●
To identify one or more tables as
the source for a query
●
To apply conditions to filter the
dataset
128.7
●
3552.27
●
130
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
CONCEPT
→
SUM to Add Values
32
RATIONALE
Common mistakes when using the SUM function include not
selecting the right column, omitting the ( ) around the column,
and failing to add in the filter conditions.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
The following CREATE TABLE statement creates a table called
'artist' that consists of the artist_id as the primary key that is auto-
incremented, the first_name, and the last_name.
CREATE TABLE artists(
artist_id serial INT,
first_name VARCHAR (50),
last_name VARCHAR (50)
);
Identify the line of code that would either generate a syntax,
logical, or requirements error in this CREATE TABLE statement.
●
●
0.99
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
CONCEPT
→
Primary Key and Auto-increment
33
RATIONALE
Common mistakes with creating a table are: not including all
column names, not matching the names exactly, not including
data types, not including sizes for strings, omitting commas to
separate out each column, not using ( ) around the entire table
set, not using SERIAL in the primary key, and listing SERIAL for
multiple columns.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Using the ORDER BY clause, sort the customer table by the last
name of the customer in descending order and identify the 14th
name in the list from among the answer options.
●
●
3
●
2
1
●
4
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
CONCEPT
→
ORDER BY to Sort Data
34
RATIONALE
Some common mistakes in using ORDER BY are sorting by
ASC rather than DESC or vice versa, reporting the wrong
column, and using the wrong column for the sort.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Using the BETWEEN operator, filter the album table to find the
albums with an artist ID between 5 and 10.
Identify the 5th album ID.
●
●
Goyer
●
Brooks
●
Michelle
Sampaio
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
CONCEPT
→
BETWEEN to Filter Data
35
RATIONALE
Common mistakes include filtering the wrong column of data,
using the wrong table, using incorrect boundaries in the
BETWEEN clause, and omitting the word 'and' between the
values.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Using the GROUP BY clause and the count aggregate function,
filter the track table to group the tracks based on album_id.
How many tracks are in album 99?
●
●
7
●
9
11
●
12
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
CONCEPT
→
GROUP BY to Combine Data
36
RATIONALE
Common mistakes when using the GROUP BY clause in a
SELECT statement include not using aggregate functions in the
SELECT clause, not including each column in the SELECT
clause in the GROUP BY clause, and using the incorrect
aggregate function.
Report an issue with this question
In each milestone, you may want or need to use the database
and query tool to answer some of the questions. We suggest you
open the tool in another browser tab while you are working on
this assessment.
https://postgres.sophia.org/
Using the WHERE clause, filter the invoice table to find the
invoices dated prior to January 19th, 2009.
Identify the invoice date closest to that invoice.
●
●
11
●
10
12
●
13
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
CONCEPT
→
Filter by Date
RATIONALE
A common mistake when filtering dates can be incorrectly
identifying the day, month, and year, as different countries may
list them in a different order. Always check your data first to
ensure the correct order of the day, month, and year. Other
common errors are using the wrong inequality comparison
(e.g., > rather than <), filtering on the wrong column of data, and
using the wrong data table. Also, make sure that you use the
correct format for the date, using yyyy-mm-dd.
Report an issue with this question
●
2009-01-01
2009-01-11
●
2009-01-19
●
2009-02-01
About
Contact Us
Privacy Policy
Cookie Policy
Terms of Use
Your Privacy Choices
© 2024 SOPHIA Learning, LLC. SOPHIA is a registered trademark of SOPHIA Learning, LLC.
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
UNIT 1 — MILESTONE 1
31/36
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help