Create the following table in your database with the following schema: Table: Sales | Column Name I Туре +---- | sale_id I product_name | sale date | int varchar| I date +----- +---- sale id is the...



Write all the sql code (including create, insert and select), screenshot the output alongside the codes please.


Create the following table in your database with the following schema:<br>Table: Sales<br>| Column Name<br>I Туре<br>+----<br>| sale_id<br>I product_name<br>| sale date<br>| int<br>varchar|<br>I date<br>+-----<br>+----<br>sale id is the primary key for this table.<br>Each row of this table contains the product name and the date it was sold.<br>Add the following data to your tables:<br>Input:<br>Sales table:<br>+--<br>I sale idI product name | sale date<br>+--<br>| 1<br>| 2<br>| 3<br>| LCPHONE<br>| LCPhone<br>| LcPhOnE<br>| LCKeyCHAiN<br>| LCKeyChain<br>| Matryoshka<br>| 2000-01-16 |<br>| 2000-01-17 |<br>| 2000-02-18 |<br>| 2000-02-19 |<br>| 2000-02-28 |<br>| 2000-03-31 |<br>| 5<br>Since table Sales was filled manually in the year 2000, product_name may contain leading and/or<br>trailing white spaces, also they are case-insensitive.<br>Write an SQL query to report<br>• product_name in lowercase without leading or trailing white spaces.<br>• sale_date in the format (

Extracted text: Create the following table in your database with the following schema: Table: Sales | Column Name I Туре +---- | sale_id I product_name | sale date | int varchar| I date +----- +---- sale id is the primary key for this table. Each row of this table contains the product name and the date it was sold. Add the following data to your tables: Input: Sales table: +-- I sale idI product name | sale date +-- | 1 | 2 | 3 | LCPHONE | LCPhone | LcPhOnE | LCKeyCHAiN | LCKeyChain | Matryoshka | 2000-01-16 | | 2000-01-17 | | 2000-02-18 | | 2000-02-19 | | 2000-02-28 | | 2000-03-31 | | 5 Since table Sales was filled manually in the year 2000, product_name may contain leading and/or trailing white spaces, also they are case-insensitive. Write an SQL query to report • product_name in lowercase without leading or trailing white spaces. • sale_date in the format ("YYYY-MM'). • total the number of times the product was sold in this month. Return the result table ordered by product_name in ascending order. In case of a tie, order it by sale_date in ascending order. Hint: you may need to use the following functions: • LOWER(O • TRIM() • DATE_FORMAT() The results should be: Output: I product_name | sale_date | total | +-- | lckeychain | lcphone | lcphone | matryoshka | 2000-02 | 2000-01 | 2000-02 | 2000-03 | 2 | 2 | 1 | 1

Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here