5. 1. Challenge SQL MAXO) A sql-6-2.sql file has been opened for you Write each
ID: 3706897 • Letter: 5
Question
5. 1. Challenge SQL MAXO) A sql-6-2.sql file has been opened for you Write each of the following tasks as a SQL statement in a new line (remember that you can source the file to compare the output reference) 1. Select the newest product from the e_store.products newest_product .The table. Alias the column name as: output should look like this l newest_productI | 2015-10-30 06:30:30 I 1 row in set (0.01 sec) 2. Select the oldest product from the| e_store.products table. Alias the column name as: oldest_product . The output should look like this I oldest_productI | 2015-10-09 00:49:30 I 1 row in set (0.01 sec)Explanation / Answer
1)
dbms_output.enable;
dbms_output.put_line("+-----------+")
SELECT MAX(prodDate) AS newest_product
FROM e_store.products
dbms_output.put_line("+-----------+")
2)
dbms_output.enable;
dbms_output.put_line("+-----------+")
SELECT MIN(prodDate) AS oldest_product
FROM e_store.products
dbms_output.put_line("+-----------+")
**NOTE: column name used is prodDate which may change based on the e_store.products schema structure
To get query output into a variable and then printing it use: SET @dat := (SELECT statement goes here);
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.