locked
SQL help using no Table SELECT SELECT FROM WHERE AND, OR, NOT, IN, LIKE GROUP BY HAVING (which also implies a join and a group by) MC/TF portion all multiple choice and True False RRS feed

  • Question

  • 1. Show ship countries and a count of orders by Ship Country. Include orders placed in 1997 and shipped to Belgium, Mexico, and Poland.

    2. Show year of order (YEAR(OrderDate)) and a count of orders by year of order. Only include orders after 1997. Include years with more than 40 counts of order. 3.

    Show ShipCountry, ShipCity, and the average Freight by by ShipCountry and then ShipCity.

    4. Show a list of CustomerIDs, OrderID, ShipCountry and year of shipping (YEAR(ShippedDate)). Only include orders in 1996 and CustomerID begins with the letter E.

    5.Show a list of CustomerIDs, OrderID, and Freight charges. Only include customers where their freight charges were over $30. Order by CustomerID and then OrderID. The freight charges shown in the table is in dollar. Create an additional column and show the freight charges in euros (1 Dollar = 0.86Euro).

    Monday, September 28, 2020 8:55 PM

All replies

  • Hi JAckie101,

    Thank you for posting here.

    According to your question, I need more information to make a test.

    Could you provide more details about your design of database and what you want to do ?

    Could you show some related code here? It will help us analyze your problem.

    We are waiting for your update.

    Best Regards.

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, September 29, 2020 2:41 AM
  • 1. Show ship countries and a count of orders by Ship Country. Include orders placed in 1997 and shipped to Belgium, Mexico, and Poland. 

    select o.ShipCountry, Count(*) AS CountOrder
    from Orders as o
    where o.OrderDate BETWEEN '19970101' AND '19971231'
          and o.ShipCountry IN ('DE', 'MX' 'PL')
    group by o.ShipCountry

    For more please post table design as DDL, some sample data as DDL statement and the expected result.

    You can find SQL specifc forums at Question&Answer: https://docs.microsoft.com/en-us/answers/products/sql-server


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Tuesday, September 29, 2020 6:03 AM