Question

I am looking for help developing a SQL query that uses the MINUS operator to reproduce...

I am looking for help developing a SQL query that uses the MINUS operator to reproduce the following problem:

SELECT [CustFirstName]
   ,[CustLastName]
   FROM [OrderEntryBMIS325].[dbo].[Customer]
   WHERE [CustState] = 'CO' AND [CustNo] NOT IN (SELECT [CustNo]
                                               FROM [OrderEntryBMIS325].[dbo].[OrderTbl]
                                               WHERE [OrdDate] like '2013-Jan%') ;

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer is as follows :

MINUS operator in SQL helps us to find the table in which data of first statement is present but data of second one is eliminated.

So MINUS query for given scenario is :

SELECT [CustFirstName] ,[CustLastName]
FROM [OrderEntryBMIS325].[dbo].[Customer]
WHERE [CustState] = 'CO'

MINUS

SELECT [CustNo]
FROM [OrderEntryBMIS325].[dbo].[OrderTbl]
WHERE [OrdDate] like '2013-Jan%' ;

The query will find custFirstName and custLastName form given table where CustState is "CO" but eliminate those customers where ordDate be like 2013-Jan% .

if there is any query please ask in comments...

Add a comment
Know the answer?
Add Answer to:
I am looking for help developing a SQL query that uses the MINUS operator to reproduce...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Can someone please help me. I am having trouble writing the following SQL query: "Retrieve the...

    Can someone please help me. I am having trouble writing the following SQL query: "Retrieve the name and country of the player with the most yellow cards in the 2014 world cup." The player and country are in the player table, and the yellow cards are in the player_cards table. The tables can be connected on player_id. The problem I am having is that there are 3 players that have 3 yellow cards, not just a single player. (3 yellow...

  • My answer is supposed to look like the table above, but I am struggling. I am...

    My answer is supposed to look like the table above, but I am struggling. I am a novice at Oracle SQL and I just don't understand what I am doing wrong here....Below is the code I used and the results that I got. I don't understand why each Customer Id (CID) isn't each returning their own unique value. Q1 (7 Points) Use ONE SQL statement to show the total number of actual hours for each customer. In the output, show...

  • Part I. Create a library check-out database using Microsoft SQL Server that stores data about books,...

    Part I. Create a library check-out database using Microsoft SQL Server that stores data about books, patrons, and the check-out process. Books (BookID, BookName, Author, YearPublished) Patrons (PatronsID, PatronsName, PatronsAddress, PatronsBirthday) CheckInOut (TransactionID, PatronID, BookID, CheckOutDate, NumDay, ReturnDate, Late, Fees, Paid) - the NumDay field contains the number of days patrons can keep the book, if the return date is over the number of day, then the Late field will have a Y value and a fee of $1.00 per...

  • SQL injection problem I am studying web security and need to do a simple SQL injection...

    SQL injection problem I am studying web security and need to do a simple SQL injection to a self-built webpage. The webpage consists of a basic login page(username field and password field and a submit button). After submission of the data to a php file, it gives the result of authentication. .I need to bypass the authentication only knowing the ID is 'administrator'. The php file is like this: I tried inputting "admin';--" in the username field and password is...

  • Trying to run an sql query in VBA but every time I run the macro I...

    Trying to run an sql query in VBA but every time I run the macro I get an error message stating " Run-time error’- 2147217900 (80040e14)’: ORA-00923: From keyboard not found where expected”. I am a newbie with using queries and am wondering if anyone knows what the problem is with the query I wrote and why I keep getting this error in VBA. Everything in my code works except this query so I know the problem has to be...

  • SQL help I am using livesql.oracle This is CTE I created for problem 4 SELECT CUST_LAST_NAME,...

    SQL help I am using livesql.oracle This is CTE I created for problem 4 SELECT CUST_LAST_NAME, CUST_EMAIL, ORDER_ID, SUM(QUANTITY) AS QTY FROM (SELECT CUST_LAST_NAME, CUST_EMAIL, ORDERS.ORDER_ID, PRODUCT_ID, QUANTITY FROM OE.CUSTOMERS INNER JOIN OE.ORDERS ON OE.CUSTOMERS.CUSTOMER_ID = OE.ORDERS.CUSTOMER_ID INNER JOIN OE.ORDER_ITEMS ON OE.ORDERS.ORDER_ID = OE.ORDER_ITEMS.ORDER_ID ORDER BY ORDER_ID ASC) CTE GROUP BY CUST_LAST_NAME, CUST_EMAIL, ORDER_ID; 5. Using the CTE named customer_information that you created for the previous problem (problem 4). Add a correlated subquery that also shows the total value of...

  • Looking for help with stoichiometry chemistry. I am trying to get from molecules to gallons. I...

    Looking for help with stoichiometry chemistry. I am trying to get from molecules to gallons. I have the density and the chemical formula. I would love to know how to set up the problem. thank you!

  • I am attempting to incorporate sqlmap, and other sql injection tools, into a java GUI that will a...

    I am attempting to incorporate sqlmap, and other sql injection tools, into a java GUI that will allow me to select them from the GUI (windows builder) in order to run them. I will then test them on a website that I have created that's local in order to test its vulnerabilities.However, I have had some trouble with the implementation, and cannot seem to find a way to do it successfully. If someone knows the solution to my problem, or...

  • I need the SQL code to accomplish the following: Provide a list of orders that were...

    I need the SQL code to accomplish the following: Provide a list of orders that were created in January 2013.   Be sure to show the order number, date, employee name who took the order, and customer name who created the order. For all of the orders for 17” monitors in 2013, provide a list that shows the order number, date, and the quantity. here is the database CREATE DATABASE OrderEntryBMIS325 GO USE OrderEntryBMIS325 GO CREATE TABLE Customer ( CustNo CHAR(8),...

  • I am looking for help Maybe an example of what I can write about. I tend...

    I am looking for help Maybe an example of what I can write about. I tend to not write as organized as I would like. I have a problem with not being able to narrow down one topic exactly and I just turn the light on scattered. I'm only required to do one page I'm just looking for examples of what I can write about and how I can get started without having to fall off topic. Research a specific...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT