Question

In: Computer Science

    Table Name: CUSTOMERS_1 CUST_NUM CUST_LNAME          CUST_FNAME          CUST_BAL 2001    James William        

    Table Name: CUSTOMERS_1

CUST_NUM CUST_LNAME          CUST_FNAME          CUST_BAL

2001    James William           $2,999

2002    Crane Frasier             $983

    Table Name: CUSTOMERS_2

CUST_NUM

            CUST_LNAME          CUST_FNAME          CUST_BAL

1999    Anderson         Anne $510

2000    Bryant Juan     $21

2002    Crane Frasier             $983

2003    Dent    George            $1,790

    Table Name: CUST_INVOICES

INV_NUM     CUST_NUM INV_DATE    INV_AMOUNT

9000    2000    23-Mar-16       245

9001    2001    23-Mar-16       260

9002    2001    30-Mar-16       275

9003    1000    10-Apr-16       286

using this information, i need help formulating an sql query:

    Write a SQL code that will show CUST_NUM, CUST_LNAME, and CUST_FNAME for the one who has minimal INV_AMOUNT

Solutions

Expert Solution

Ans:- Here we will use UNION ALL to fetch all the results from CUSTOMER_1 and CUSTOMER_2.

The query will be

SELECT CUST_NUM,CUST_LNAME, CUST_FNAME FROM CUSTOMER WHERE CUST_NUM IN(SELECT cust_num FROM INVOICE WHERE INV_AMOUNT IN (SELECT min(INV_AMOUNT)FROM INVOICE ) ) UNION ALL
SELECT CUST_NUM,CUST_LNAME, CUST_FNAME FROM CUSTOMER_2 WHERE CUST_NUM IN(SELECT cust_num FROM INVOICE WHERE INV_AMOUNT IN (SELECT min(INV_AMOUNT)FROM INVOICE ) )


Related Solutions

William is James’ employer. William paid the following payments on behalf of James. Item Payment by...
William is James’ employer. William paid the following payments on behalf of James. Item Payment by William Tax deduction had James paid $ $ Computer part 300 300 University fees 450 200 HELP charges 850 Nil Taxi fares 300 100 Required: Calculate is the taxable value for FBT purposes of the following payments. You must refer to relevant legislation and/or case law in your answer.
William James views on consciousness:
William James views on consciousness:
Procter and Gamble a Model of Innovative Outsourcing Founded in 1837 by William Procter and James...
Procter and Gamble a Model of Innovative Outsourcing Founded in 1837 by William Procter and James Gamble, the Procter and Gamble Company, or P&G as it is often called today, introduced many of the staples of American consumer culture, including Ivory soap, Gillette razors, Tide laundry detergent, Crest toothpaste, Tampax feminine hygiene products, and Pampers diapers—products that have changed people’s lives. Today, P&G sells its products in over 180 countries to five billion people—more than 70 percent of the world’s...
Compare and contrast William James’ bodily theory of emotion to Walter Cannon’s theory that the brain...
Compare and contrast William James’ bodily theory of emotion to Walter Cannon’s theory that the brain is the primary organ of emotion.?
How does William James use the notions of "illusions" and "hallucinations" to describe his ideas of...
How does William James use the notions of "illusions" and "hallucinations" to describe his ideas of perception?
Name instances of irony in "Holy Thursday" in the songs of innocence written by William Blake.
Name instances of irony in "Holy Thursday" in the songs of innocence written by William Blake.
Create a table with two columns. Name the table First Initial _ Last Name (e.g. John...
Create a table with two columns. Name the table First Initial _ Last Name (e.g. John Dow will create table j_dow). You have to audit all DML statements on your table. To do this you write two triggers: 1. To log any DML statements that users might run on this table. The results must be stored in the First Initial _ Last Name _ Log table (e.g. John Dow will create table j_dow_log). The table should have unique event ID,...
Name the five major events that happened between 2001-2004 that affected the demand in the lodging...
Name the five major events that happened between 2001-2004 that affected the demand in the lodging industry. How did they affect demand?
Starting in 2001, Sergio and Jasmine have been purchasing Series EE bonds in their name to...
Starting in 2001, Sergio and Jasmine have been purchasing Series EE bonds in their name to use for the higher education of their son, Devon, who currently is age 20. In 2017, they cash in $24,000 of the bonds to use for tuition, fees, and room and board. Of this amount, $10,000 represents interest. Of the $24,000, $19,200 is used for tuition and fees, and $4,800 is used for room and board. Sergio and Jasmine's AGI, before the educational savings...
Suppose the labor force and unemployment rate in 2001 are given in the following table. What...
Suppose the labor force and unemployment rate in 2001 are given in the following table. What is the slope coefficient estimate b of the regression of the unemployment rate as a function of the labor force? Country Labor Force Unemployment United States 122 5.5 Canada 13 7.8 Britain 28 8.6 Germany 29 6.1 Question 8 options: A) –0.20. B) –0.020. C) –0.0020. D) –2.0. E) 0.020.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT