1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alex787 [66]
3 years ago
3

Use a correlated subquery to return one row per customer, representing the customer’s oldest order (the one with the earliest da

te). Each row should include these three columns: email_address, order_id, and order_date.
CUSTOMERS TABLE: CUSTOMER_ID, EMAIL_ADDRESS, PASSWORD, FIRST_NAME, LAST_NAME, SHIPPING_ADDRESS_ID, BILLING_ADDRESS_ID

ORDERS TABLE: ORDER_ID, CUSTOMER_ID, ORDER_DATE, SHIP_AMOUNT, TAX_AMOUNT, SHIP_DATE_SHIP_ADDRESS_INFO, CARD_TYPE, CARD_NUMBER, CARD_EXPIRES, BILLING_ADDRESS_ID
Computers and Technology
1 answer:
kotykmax [81]3 years ago
7 0

Answer:

The correlated subquery for the given scenario is given below.

SELECT EMAIL_ADDRESS, ORDER_ID, ORDER_DATE

FROM CUSTOMERS JOIN ORDERS O ON CUSTOMERS.CUSTOMER_ID = O.CUSTOMER_ID

WHERE ORDER_DATE = ( SELECT MIN(ORDERS.ORDER_DATE)

                   FROM ORDERS JOIN CUSTOMERS

                   ON ORDERS.CUSTOMER_ID=CUSTOMERS.CUSTOMER_ID

                   GROUP BY CUSTOMERS.CUSTOMER_ID ) ;

Explanation:

The steps in the formation of the outer query are explained below.

1. We need three columns in the output – email address, order id and date of order.

2. The above mentioned columns are taken in SELECT clause.

3. The email address belongs to the customers table. While order id and date of order belongs to the orders table.

4. Both the orders and the customers tables are joined using JOIN keyword on the common column, CUSTOMER_ID.

5. The tables are joined in the FROM clause.

6. The oldest order for each customer is required using sub query. Hence, in the WHERE clause, the ORDER_DATE is equated to the result of the subquery.

7. After ORDER_DATE, equal sign is used and IN keyword is not used since there can be only one oldest order or earliest order date for each customer.

8. The outer query is written as shown.

SELECT EMAIL_ADDRESS, ORDER_ID, ORDER_DATE

FROM CUSTOMERS JOIN ORDERS O ON CUSTOMERS.CUSTOMER_ID = O.CUSTOMER_ID

WHERE ORDER_DATE =

The steps in the formation of the subquery are explained below.

1. We need to find the oldest order for each customer.

2. The oldest order or the earliest ORDER_DATE can be found out by using an aggregate function MIN().

3. The function, MIN(ORDER_DATE), gives the oldest order for each customer.

4. Since aggregate function is used, we use GROUP BY clause since this function is not used in an overall scenario.

5. GROUP BY CUSTOMER_ID indicates for each customer.

6. The customers table is the same table as that of the outer query.  

7. Hence, the sub query created is as follows.

SELECT MIN(ORDERS.ORDER_DATE)

                   FROM ORDERS JOIN CUSTOMERS

                   ON ORDERS.CUSTOMER_ID=CUSTOMERS.CUSTOMER_ID

                   GROUP BY CUSTOMERS.CUSTOMER_ID

You might be interested in
You can use the Ignore All button to ignore the current and all future occurrences of a flagged word. True or False
Pepsi [2]

Answer: True

Explanation: "Ignore All" button is the button that operates when the user wants to ignore the word that is flagged .Flagged words are those which chosen by user to be banned and don't want to use in future.

Ignore all button helps in the ignoring of the spelling check of the words that the user is sure about and the words that user don't want to be the part of their content.This banning is for the future use and current time as well.Thus, the statement is true.

4 0
3 years ago
The first step in the information systems planning process is to ___________.
Basile [38]

Answer: Analyze the organization's strategic plan

Explanation:

 The initial step in the information system is to first analyze the strategic plan of the organization so that we can easily identify the main objective and challenge.

It is basically archived by enlisting the particular objective and function in the planning of information system in the organization.

All the remining option are involve in the remaining step of the information system planning not in the initial step.

Therefore, analyze the organization's strategic plan is correct as it is the first step of the information system planning.  

7 0
3 years ago
Using powerpoint 2016, ethan develops a short five-slide presentation for his marketing project. â â powerpoint files consist of
Lady bird [3.3K]
b. Ribbons  - Powerpoint 2016 has a tabbed ribbon system that groups relevant menus together according to category. The ribbon contains a number of tabs, each having a separate group of commands. The tabs can be used to do most of the common tasks in Powerpoint.
8 0
3 years ago
Which of the following is FALSE? Select one: a. The fast-paced and collaboration-based business environment makes email less use
12345 [234]

Answer:

The Atos case demonstrates that it is possible to cut out e-mail entirely.

Explanation:

6 0
3 years ago
The Dark Web is _____. Select 2 options.
fiasKO [112]

Answer:

a. an international marketplace where criminals buy and sell products.

c. a capitalistic marketplace for criminals and non-criminals.

Explanation:

In computing, WWW simply means World Wide Web. The world wide web was invented by Sir Tim Berners-Lee in 1990 while working with the European Council for Nuclear Research (CERN); Web 2.0 evolved in 1999. Basically, WWW refers to a collection of web pages that are located on a huge network of interconnected computers (the Internet). Also, users from all over the world can access the world wide web by using an internet connection and a web browser such as Chrome, Firefox, Safari, Opera, etc.

In a nutshell, the world wide web (www) is an information system that is generally made up of users and resources (documents) that are connected via hypertext links.

The dark web also referred to as darknet, can be defined as a subset of the world wide web that is intentionally encrypted from conventional web browser and search engines. Thus, it is a peer-to-peer network that requires the use of specialized configuration and web browser such as "Tor browser" in order to access its contents.

Generally, all the internet activities carried out on the dark web are anonymous and private, thereby making it suitable for either legal or illegal operations. Also, it's devoid of government influence or control and as such it's typically a capitalistic marketplace, where goods and services are privately owned and controlled by the people.

Hence, we can deduce that the dark web is simply;

I. An international marketplace where criminals buy and sell their products.

II. A capitalistic marketplace for criminals and non-criminals.

4 0
3 years ago
Other questions:
  • After earning a learners license what test must be successfully passed to earn an operators license in Florida
    14·1 answer
  • When you reach a YIELD sign, yield to cross traffic and ____ before you enter the intersection.
    14·2 answers
  • What is the simplest way to permanently get rid of an unwanted file? A. Go to the Start menu and then delete the file. B. Erase
    5·1 answer
  • How much heat is needed to raise the temperature of 7g of water by 15oC?
    6·1 answer
  • What does a converter do? A. It converts one technological system into another. B. It converts one type of electrical signal int
    10·2 answers
  • Zahra's softball team needs money for team T-shirts. The coach makes some fundraising suggestions, while team members brainstorm
    5·2 answers
  • 3. Comparing the Utopian and dystopian views of Technology according to Street (1992) which one in your view is more applicable
    9·1 answer
  • Imagine that your parents were starting a small business, and they wanted to upgrade their data storage. Would you recommend a f
    11·1 answer
  • Gourmet pizza shop with a
    6·1 answer
  • What do you mean by computer ethics?​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!