MYSQL Chapter 8 How to work with data types Exercises 1. Write a SELECT s from t
ID: 3598993 • Letter: M
Question
MYSQL
Chapter 8 How to work with data types Exercises 1. Write a SELECT s from the I table: The invoice total column A column that uses the FORMAT function to return the invoice total column with 1 digit to the right of the decimal point A column that uses the CONVERT function to return the invoice total column as an integer A column that uses the CAST function to return the invoice,total column as an integer Write a SELECT statement that returns these colums from the Inmvoices table: 2. The invoice_date column A column that uses the CAST function to return the invoice date column with its full date and time A column that uses the CAST function to return the invoice_ date column with just the year and the monthExplanation / Answer
1. Select invoice_total, FORMAT(invoice_total, 1),CONVERT (invoice_total, UNSIGNED), CAST(invoice_total as UNSIGNED) from Invoices ;
The above query retrieves invoice_total column in the required formats.
2. Select invoice_total, CAST(invoice_total as DATETIME), CAST(invoice_total as DATE) from Invoices ;
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.