University of North Carolina, Charlotte
ITCS 3160
2/20/2018 Activity: SQL III: 201810-Spring 2018-ITCS-3160-051-Data Base Design & Implementation
https://uncc.instructure.com/courses/65873/quizzes/70384 1/14
Activity: SQL III
Score for this attempt: 2 out of 38 Submitted Feb 20 at 3:36pm This attempt took 4 minutes.
This lab is based on the 2 SQL pre
...[Show More]
2/20/2018 Activity: SQL III: 201810-Spring 2018-ITCS-3160-051-Data Base Design & Implementation
https://uncc.instructure.com/courses/65873/quizzes/70384 1/14
Activity: SQL III
Score for this attempt: 2 out of 38 Submitted Feb 20 at 3:36pm This attempt took 4 minutes.
This lab is based on the 2 SQL presentations on the topic 4 page.
The database used for these questions is named AP. Posted here is Database Description Language (DDL) listing and a small sample of the database posted under the lab. You might want to use these when answering the questions.
You will have 3 attempts and the computer will automatically grade your answers after each attempt. When an answer consists of more than one word be careful about spacing. Leave only one space between words.
Take the Quiz Again
Question 1 1 / 3 pts
|
Fill in the blanks in the SQL statement below that will list the vendor number, vendor name, vendor contact name for all vendors located in Iowa. Format all vendor contact names as last name, first name (example: Bucket, Charles) and name the column contact.SELECT vendor_id, name, name (last_name, ‘, ‘,first_name)
|
2/20/2018 Activity: SQL III: 201810-Spring 2018-ITCS-3160-051-Data Base Design & Implem
https://uncc.instructure.com/courses/65873/quizzes/70384 2/14
Answer 1:
Answer 2:
Answer 3:
AS contact
FROM vendors, vendor_contacts
WHERE contact = vendor_contacts.contact_id AND
vendor_state = ‘IA’;
Question 2 1 / 2 pts
|
Answer 1:Fill in the blanks in the SQL statement below that will list all vendor names for vendors with a name that begins with a letter from A to L.SELECT name FROM vendorsWHERE A BETWEEN ‘A’ AND 'L' ;A
|
Y You Answered ou Answered
2/20/2018 Activity: SQL III: 201810-Spring 2018-ITCS-3160-051-Data Base Design & Implem
https://uncc.instructure.com/courses/65873/quizzes/70384 3/14
Question 3 0 / 1 pts
|
Answer 1:Fill in the blanks in the SQL statement below that will list the invoice_id, invoice_total and payment_total that were due with 25 days of the invoice date.SELECT invoice_id, invoice_total , payment_total FROM invoicesWHERE invoice_due_date <= ƭme ;timeinvoice_date + 25invoice_date+25DATE_ADD(invoice_date INTERVAL 25 DAYS)
|
Question 4 0 / 2 pts
|
Fill in the blanks in the SQL statement below that will list the invoice number, vendor contact initials (first letter of first name and first letter of second name example: M.D.) and the invoice date for vendors that have not paid a payment on the invoice.
|
2/20/2018 Activity: SQL III: 201810-Spring 2018-ITCS-3160-051-Data Base Design & Implem
https://uncc.instructure.com/courses/65873/quizzes/70384 4/14
Answer 1:
Answer 2:
SELECT invoice_number, CONCAT( payment , ‘.’, total , ‘.’ )
AS initials, invoice_date
FROM vendor, vendor_contacts, invoices WHERE invoices.vendor_id = vendors.vendor_id
AND vendors.contact_id = vendor_contacts. contact_id AND payment_total = 0.0;
Question 5 0 / 1 pts
|
Answer 1:Fill in the blanks in the SQL statement below that will list the invoice number, vendor name and the invoice date for vendors that have not paid a payment on the invoice. Format the invoice date as DD-Mon-YYYY (example: 28-Mar- 2017).SELECT invoice_number, name, ƭmeFROM vendors, invoicesWHERE invoices.vendor_id = vendors. vendor_id AND payment_total = 0.0;time
|
Y You Answered ou Answered
2/20/2018 Activity: SQL III: 201810-Spring 2018-ITCS-3160-051-Data Base Design & Implem
https://uncc.instructure.com/courses/65873/quizzes/70384 5/14
_FORMAT(invoice_date, %e-%b-%Y)
Question 6 0 / 2 pts
|
Answer 1:Answer 2:Fill in the blanks in the SQL statement below that will list the invoice_id, invoice_total and the invoice_date for invoices with amounts over $1000. Format the invoice date as DD/MM/YYYY (example: 3/28/2017). Round invoice amount to one decimal place.SELECT invoice_id, DATE_FORMAT , DATE_FORMAT(invoice_date,invoice )FROM invoices WHERE invoice_total > 1000;DATE_FORMATROUND(invoice_total, 1)invoice%m/%d/%Y
|
Question 7 0 / 1 pts
|
Fill in the blanks in the SQL statement below that will list the vendor name where the vendor’s address2 would be NULL.SELECT name FROM vendors
|
2/20/2018 Activity: SQL III: 201810-Spring 2018-ITCS-3160-051-Data Base Design & Implem
https://uncc.instructure.com/courses/65873/quizzes/70384 6/14
Question 8 0 / 1 pts
|
Answer 1:Fill in the blanks in the SQL statement below that will list the vendor contacts whose last name begins with the letter A, B, C or D.SELECT first_name, last_name FROM vendor_contactsWHERE FIRST IN (‘A’, ‘B’, ‘C’, ‘D’);FIRSTLEFT(last_name, 1)
|
Question 9 0 / 1 pts
|
Fill in the blanks in the SQL statement below that will list the rows with an invoice_total that is greater than or equal to 500 and less than or equal to 1000. Sort in descending sequence by invoice total. Do not return duplicate rows.SELECT ALL *FROM invoices
|
2/20/2018 Activity: SQL III: 201810-Spring 2018-ITCS-3160-051-Data Base Design & Implem
https://uncc.instructure.com/courses/65873/quizzes/70384 7/14
Question 10 0 / 1 pts
|
Answer 1:Fill in the blanks in the SQL statement below that will list the invoice number, invoice total and credit which is the total sum of the payment_total and credit_total. Format the payment credit to 2 decimal places.SELECT invoice_number, invoice_total, sort AS creditFROM invoices;sortROUND(payment_total + credit_total, 2)
|
Question 11 0 / 1 pts
|
Fill in the blanks in the SQL statement below that will list the invoice_id, vendor name, invoice_due_date and an extended date of 20 days for all invoices with an invoice_total greater than 3000. Name the new field extended due date.SELECT invoice_id, name, invoice_due_date,DATE_ADD(invoice_due_date, invoice_amount )
|
2/20/2018 Activity: SQL III: 201810-Spring 2018-ITCS-3160-051-Data Base Design & Implem
https://uncc.instructure.com/courses/65873/quizzes/70384 8/14
Question 12 0 / 2 pts
|
Answer 1:Answer 2:Fill in the blanks in the SQL statement below that will list vendor name, sum of the invoice_total for that vendor. Include a grand total for all vendors at the end.SELECT vendor_id, name, SUM( TOTAL )FROM vendors, invoicesWHERE vendors_invoice_id = invoices_invoice_idGROUP BY vendor_id Count ;TOTALinvoice_totalCountWITH ROLLUP
|
2/20/2018 Activity: SQL III: 201810-Spring 2018-ITCS-3160-051-Data Base Design & Implem
https://uncc.instructure.com/courses/65873/quizzes/70384 9/14
Question 13 0 / 4 pts
|
Answer 1:Answer 2:Answer 3:Answer 4:Fill in the blanks in the SQL statement below that will list invoice_number, vendor name, invoice_total. Use the alias i for invoices and the alias v for vendors.SELECT invoice_number, name, invoice_totalFROM count , invoiceWHERE number .invoice_id = state .invoice_id ;countinvoices ivendors vinvoicevendors vinvoices inumberivstatev
|
Question 14 0 / 4 pts
|
Answer 1:Answer 2:Answer 3:Fill in the blanks in the SQL statement below that will create a view named vendor_invoices which lists invoice_number, vendor name, invoice_date and invoice_total for all invoices.CREATE VIEW * ASSELECT invoice_number, name, invoice_date, invoice_totalFROM invoices , tablesWHERE invoice .invoice_id = invoice_total .invoice_id ;*vendor_invoicestablesvendorsvendors vinvoiceinvoicesinvoices i
|
2/20/2018 Activity: SQL III: 201810-Spring 2018-ITCS-3160-051-Data Base Design & Implem
https://uncc.instructure.com/courses/65873/quizzes/70384 11/14
Question 15 0 / 4 pts
|
Answer 1:Answer 2:Fill in the blanks in the SQL statement below that will create a view named summary which lists the vendor name along with the number of invoices for that vendor for all vendors.CREATE VIEW summary all SELECT name, * FROM invoices , tableWHERE invoice.invoice_id = invoice .invoice_id ;allAS
|
2/20/2018 Activity: SQL III: 201810-Spring 2018-ITCS-3160-051-Data Base Design & Implem
https://uncc.instructure.com/courses/65873/quizzes/70384 12/14
Question 16 0 / 3 pts
|
Answer 1:Fill in the blanks in the SQL statement below that will an index named date on the invoice_date field in the invoices table.CREATE invoice table ON *(invoice_date);invoiceINDEX
|
Y You Answered ou Answered orrect Answer orrect Answer
2/20/2018 Activity: SQL III: 201810-Spring 2018-ITCS-3160-051-Data Base Design & Implem
https://uncc.instructure.com/courses/65873/quizzes/70384 13/14
Answer 2:
Answer 3:
Y You Answered ou Answered table
orrect Answer orrect Answer date
Y You Answered ou Answered *
orrect Answer orrect Answer invoices
Question 17 0 / 2 pts
|
Answer 1:Answer 2:Fill in the blanks in the SQL statement below to add to the vendors table a new character field named waiver that is one character in length.all vendors * waiver CHAR(1);allALTER TABLE*ADD
|
Y You Answered ou Answered orrect Answer orrect Answer Y You Answered ou Answered orrect Answer orrect Answer
2/20/2018 Activity: SQL III: 201810-Spring 2018-ITCS-3160-051-Data Base Design & Implem
https://uncc.instructure.com/courses/65873/quizzes/70384 14/14
Answer 1:
Answer 2:
Answer 3:
Fill in the blanks in the SQL statement below to change the name in the vendors table a character field that is 60 characters in length.
[Show Less]