Have I done this correct, but I still need help on #7

1. Provide a SQL statement that displays the FIRSTNAME and LASTNAME of each customer separated by a comma. The FIRSTNAME and LASTNAME should be capitalized and concatenated together with a column alias of “Full Name”. The output should be sorted in ascending order by LASTNAME.
SELECT FIRSTNAME||','||LASTNAME "FULL NAME"
FROM CUSTOMERS;
FULL NAME
BONITA,MORALES
RYAN,THOMPSON
LEILA,SMITH
THOMAS,PIERSON
CINDY,GIRARD
MESHIA,CRUZ
TAMMY,GIANA
KENNETH,JONES
JORGE,PEREZ
JAKE,LUCAS
REESE,MCGOVERN
WILLIAM,MCKENZIE
NICHOLAS,NGUYEN
JASMINE,LEE
FULL NAME
STEVE,SCHELL
MICHELL,DAUM
BECCA,NELSON
GREG,MONTIASA
JENNIFER,SMITH
KENNETH,FALAH
20 rows selected.
2. Provide a SQL statement that displays the current date in the format MM/DD/YY.
SELECT TO_CHAR( '10/25/06')
FROM DUAL
TO_CHAR(
10/25/06
3. Provide a SQL statement that displays the TITLE and publisher NAME of each book in the “COMPUTER” CATEGORY.
SELECT TITLE, CATEGORY
FROM BOOKS, PUBLISHER
WHERE CATEGORY = 'COMPUTER'
TITLE      CATEGORY
DATABASE IMPLEMENTATION      COMPUTER
HOLY GRAIL OF ORACLE      COMPUTER
HANDCRANKED COMPUTERS      COMPUTER
E-BUSINESS THE EASY WAY      COMPUTER
DATABASE IMPLEMENTATION      COMPUTER
HOLY GRAIL OF ORACLE      COMPUTER
HANDCRANKED COMPUTERS      COMPUTER
E-BUSINESS THE EASY WAY      COMPUTER
DATABASE IMPLEMENTATION      COMPUTER
HOLY GRAIL OF ORACLE      COMPUTER
HANDCRANKED COMPUTERS      COMPUTER
E-BUSINESS THE EASY WAY      COMPUTER
DATABASE IMPLEMENTATION      COMPUTER
HOLY GRAIL OF ORACLE      COMPUTER
TITLE      CATEGORY
HANDCRANKED COMPUTERS      COMPUTER
E-BUSINESS THE EASY WAY      COMPUTER
DATABASE IMPLEMENTATION      COMPUTER
HOLY GRAIL OF ORACLE      COMPUTER
HANDCRANKED COMPUTERS      COMPUTER
E-BUSINESS THE EASY WAY      COMPUTER
20 rows selected.
4. Provide a SQL statement that displays the CUSTOMER# and LASTNAME for each customer along with the ORDER# of any order that the customer placed. The statement should include all customers including those that have not placed any orders.
SELECT LASTNAME,ORDER#
FROM CUSTOMERS C, ORDERS O
WHERE C.CUSTOMER#=O.CUSTOMER#
ORDER BY O.ORDER#
LASTNAME      ORDER#
GIRARD      1000
LUCAS      1001
MCGOVERN      1002
MORALES      1003
FALAH      1004
MONTIASA      1005
SMITH      1006
GIANA      1007
PIERSON      1008
GIRARD      1009
SMITH      1010
LUCAS      1011
NELSON      1012
LEE      1013
LASTNAME      ORDER#
GIANA      1014
FALAH      1015
SMITH      1016
SCHELL      1017
MORALES      1018
MONTIASA      1019
JONES      1020
21 rows selected.
5. Provide a SQL statement that displays the total QUANTITY of books ordered.
SELECT CUSTOMER#, FIRSTNAME, LASTNAME
FROM ORDERS NATURAL JOIN ORDERITEMS NATURAL JOIN CUSTOMERS
HAVING SUM(QUANTITY)=ALL
(SELECT MAX(SUM(QUANTITY))
FROM ORDERS NATURAL JOIN ORDERITEMS GROUP BY CUSTOMER#)
GROUP BY CUSTOMER#, FIRSTNAME, LASTNAME;
CUSTOMER#      FIRSTNAME      LASTNAME
1007      TAMMY      GIANA
6. Provide a SQL statement that displays the TITLE of all books that COST more than the average cost of all books.
SELECT TITLE,AVG(COST)
FROM BOOKS
GROUP BY TITLE
TITLE      AVG(COST)
BIG BEAR AND LITTLE DOVE      5.32
BODYBUILD IN 10 MINUTES A DAY      18.75
BUILDING A CAR WITH TOOTHPICKS      37.8
COOKING WITH MUSHROOMS      12.5
DATABASE IMPLEMENTATION      31.4
E-BUSINESS THE EASY WAY      37.9
HANDCRANKED COMPUTERS      21.8
HOLY GRAIL OF ORACLE      47.25
HOW TO GET FASTER PIZZA      17.85
HOW TO MANAGE THE MANAGER      15.4
PAINLESS CHILD-REARING      48
REVENGE OF MICKEY      14.2
SHORTEST POEMS      21.85
THE WOK WAY TO COOK      19
14 rows selected.
7. Provide a SQL statement that displays each SHIPSTATE along with the number of orders shipped to each state. Include only those states that more than 3 orders were shipped to.
8. Provide a SQL statement that displays each book CATEGORY in the database. The category should only appear once in the output.
SELECT TITLE, CATEGORY
FROM BOOKS
TITLE      CATEGORY
BODYBUILD IN 10 MINUTES A DAY      FITNESS
REVENGE OF MICKEY      FAMILY LIFE
BUILDING A CAR WITH TOOTHPICKS      CHILDREN
DATABASE IMPLEMENTATION      COMPUTER
COOKING WITH MUSHROOMS      COOKING
HOLY GRAIL OF ORACLE      COMPUTER
HANDCRANKED COMPUTERS      COMPUTER
E-BUSINESS THE EASY WAY      COMPUTER
PAINLESS CHILD-REARING      FAMILY LIFE
THE WOK WAY TO COOK      COOKING
BIG BEAR AND LITTLE DOVE      CHILDREN
HOW TO GET FASTER PIZZA      SELF HELP
HOW TO MANAGE THE MANAGER      BUSINESS
SHORTEST POEMS      LITERATURE
14 rows selected.

3. Provide a SQL statement that displays the TITLE and publisher NAME of each book in the “COMPUTER” CATEGORY.
TITLE CATEGORY
DATABASE IMPLEMENTATION COMPUTER
HOLY GRAIL OF ORACLE COMPUTER
HANDCRANKED COMPUTERS COMPUTER
E-BUSINESS THE EASY WAY COMPUTER
DATABASE IMPLEMENTATION COMPUTER
HOLY GRAIL OF ORACLE COMPUTER
HANDCRANKED COMPUTERS COMPUTER
E-BUSINESS THE EASY WAY COMPUTER
DATABASE IMPLEMENTATION COMPUTER
HOLY GRAIL OF ORACLE COMPUTER
HANDCRANKED COMPUTERS COMPUTER
E-BUSINESS THE EASY WAY COMPUTER
DATABASE IMPLEMENTATION COMPUTER
HOLY GRAIL OF ORACLE COMPUTER
TITLE CATEGORY
HANDCRANKED COMPUTERS COMPUTER
E-BUSINESS THE EASY WAY COMPUTER
DATABASE IMPLEMENTATION COMPUTER
HOLY GRAIL OF ORACLE COMPUTER
HANDCRANKED COMPUTERS COMPUTER
E-BUSINESS THE EASY WAY COMPUTER
20 rows selected.
Result is wrong - you have a catrtesian product between books and publisher i.e. each book is repeated for each publisher. You need to join books to publisher and you need to select the publisher name
4. Provide a SQL statement that displays the CUSTOMER# and LASTNAME for each customer along with the ORDER# of any order that the customer placed. The statement should include all customers including those that have not placed any orders.
SELECT LASTNAME,ORDER#
FROM CUSTOMERS C, ORDERS O
WHERE C.CUSTOMER#=O.CUSTOMER#
ORDER BY O.ORDER#This is wrong, you need to use an outer join between customers and orders to satisfy the requirement:
The statement should include all customers including those that have not placed any orders.
5. Provide a SQL statement that displays the total QUANTITY of books ordered.
SELECT CUSTOMER#, FIRSTNAME, LASTNAME
FROM ORDERS NATURAL JOIN ORDERITEMS NATURAL JOIN CUSTOMERS
HAVING SUM(QUANTITY)=ALL
(SELECT MAX(SUM(QUANTITY))
FROM ORDERS NATURAL JOIN ORDERITEMS GROUP BY CUSTOMER#)
GROUP BY CUSTOMER#, FIRSTNAME, LASTNAME;
CUSTOMER# FIRSTNAME LASTNAME
1007 TAMMY GIANA
I can't see a quantity here and you should avoid NATURAL JOINs like the plague:
SELECT CUSTOMER#, FIRSTNAME, LASTNAME, SUM(QUANTITY)
I'm not exactly sure what you're attempting with the
HAVING SUM(QUANTITY)=ALL
(SELECT MAX(SUM(QUANTITY))
FROM ORDERS NATURAL JOIN ORDERITEMS GROUP BY CUSTOMER#)
GROUP BY CUSTOMER#, FIRSTNAME, LASTNAME;bit.
6. Provide a SQL statement that displays the TITLE of all books that COST more than the average cost of all books.
SELECT TITLE,AVG(COST)
FROM BOOKS
GROUP BY TITLEThis doesn't do what was asked, it just selects the average cost of each book - which will be exactly the same as the actual cost of each book. You need to use a sub query here.
8. Provide a SQL statement that displays each book CATEGORY in the database. The category should only appear once in the output.
The title does not need to be in the output here and you need to use distinct.
HTH
David

Similar Messages

  • My Safari is suddenly opening strange tabs when I am trying to open something else.  I have never had this problem before and I need help please, I don't know how to stop this happening

    Hi there,
    I have had my Macbook for 18 months and have never experienced this problem with strange windows suddenly opening in Safari.  I know this happens on windows 8 computers a lot, and it has never happened on my Macbook before.
    Please can someone tell me how to get rid of these.  I have reset my Safari and rebooted my computer, and don't know what else to do.  This is very frustrating, as I cannot just do what I need to do.
    Thank you
    Cheryl

    I'm pretty sure you've got adware installed on your Mac. Please download and install adwaremedic: www.adwaremedic.com
    This will remove most know adware plugins for you.

  • Read every font topic, but I still need help

    I have been at this for about 4 hours, and I need help.
    I read Flash Help and every font forum topic, which say
    Static Text need not use embedded fonts.
    Links to .fla and .swf files below.
    Everything shows up fine in 'Control/Test Movie'
    Using Arial font, I cannot see static text in my test .swf
    file.
    I then embedded Arial (24 pt, bold, italic - 'ArialEmbedded'
    in the library).
    Using that font on Static text, can see the text, but not in
    Arial. It is in TimesNewRoman, regular, non-italic.
    I then used the embedded font in text I described as dynamic,
    but could not see any text.
    Everything shows up fine in Control/Test Movie.
    I get around this by building .gifs using graphics packages
    and importing them,
    but the results are less than desirable. (see layer ".gif
    from outside appl."
    Links:
    http://www.ph4d.com/FlashFonts/TestingText3.fla,
    and
    http://www.ph4d.com/FlashFonts/TestingText3.swf
    I hope it's something I overlooked, and I appreciate any help
    provided.
    Thanks,
    vinceg

    Update.....
    I still cannot see text in .swf on my local machine, but I
    can see it on the web, after posting it, but the text looks awful.
    (The same text in Word lookas fine -
    http://ph4d.com/FlashFonts/TestingText3.doc)

  • HT201269 i for got my pin to my iphone and now im loced out of my phone all it says thet i have to connet to ituen but i cant need help to un lock my iphone its a 4s

    i for got my pin to open my iphone and now im locked out but i remmber now but  it tells me to connct to ituens but i  cant please hlep me unlock my phone

    Follow this article if you have forgotten the passcode for the lock screen:
    iOS: Forgotten passcode or device disabled after entering wrong passcode
    If you have forgotten the PIN for the SIM card, read this one:
    iOS: Understanding the SIM PIN

  • IPhone c question!!! PLEASE HELP! I guess it's not a life or death situation but I still need help :P

    So I'm getting an iPhone c for Christmas and I wanted to know buy like a cover for it. You know how it has the rubber cover can I take it off and put on it a plastic one or whatever. Please answer me!!

    I read your question as if you can remove the coloured back of iphone5c and put on another one
    if so then no I believe the rubber ones with colours and holes I linked to can be switchted between but I don't believe the back coloured part of iphone5c comes off

  • Still need help with case sensitive strings

    Hello guy! Sorry to trouble you with the same problem again,
    but i still need help!
    "I am trying to create a scrypt that will compare a String
    with an editable text that the user should type to match that
    String. I was able to do that, but the problem is that is not case
    sensitive, even with the adobe help telling me that strings are
    case sensitive. Do you guys know how to make that comparison match
    only if all the field has the right upper and lower case letters?
    on exitframe
    if field "t:texto1" = "Residencial Serra Verde"then
    go to next
    end if
    end
    |----> thats the one Im using!"
    There were 2 replys but both of them didnt work, and the
    second one even made the director crash, corrupting even previously
    files that had nothing to do with the initial problem..
    first solution given --
    If you put each item that you are comparing into a list, it
    magically
    makes it case sensitive. Just put list brackets around each
    item.
    on exitframe
    if [field "t:texto1"] = ["Residencial Serra Verde"] then
    go to next
    end if
    end
    Second solution given--
    The = operator is not case-sensitive when used on strings,
    but the < and > operators are case-sensitive.
    So another way to do this is to check if the string is
    neither greater than nor less than the target string:
    vExpected = "Residencial Serra Verde"
    vInput = field "t:texto 1"
    if vExpected < vInput then
    -- ignore
    else if vExpected > vInput then
    -- ignore
    else
    -- vExpected is a case-sensitive match for vInput
    go next
    end if
    So any new solutions??
    Thanks in advance!!
    joao rsm

    The first solution does in fact work and is probably the most
    efficient way
    of doing it. You can verify that it works by starting with a
    new director
    movie and adding a field named "t:texto1" into the cast with
    the text
    "Residencial Serra Verde" in the field. Next type the
    following command in
    the message window and press Enter
    put [field "t:texto1"] = ["Residencial Serra Verde"]
    You will see it return 1 which means True. Next, make the R
    in the field
    lower case and execute the command in the message window, it
    will return 0
    (true).
    Now that you know this works, you need to dig deeper in your
    code to find
    what the problem is. Any more info you can supply?

  • I just bought a new ipad 2, but cannot use it as it only shows the itunes logo and a cable. This means it's telling me to connect to itunes. I've done this and performed sync, still no way out. I have been told by friends to "unlock" it. Please how?

    I just bought a new ipad 2, but cannot use it as it only shows the itunes logo and a cable. This means it's telling me to connect to itunes. I've done this and performed sync, still no way out. I have been told by friends to "unlock" it. Please how?

    Have you already activated the iPad? That is what the screen is telling you to do - connect to the computer with the supplied cable and run iTunes while connected - and iTunes should guide you through the set up process. If you have already set up the iPad and you are still getting thos screen message - restore your iPad. You must be running iTunes 10.5 on your computer as well.
    Restore iPad
    If you can't restore this way, you will need recovery mode.
    Unable to Restore

  • Hi, I forgot my user password mac 10.9.4 I don't need it to log in but i need it to make changes, etc. It says a password hasn't been set for this account but it still asks for one when i click on the lock icon. can anyone help me? thx!

    Hi, I forgot my user password mac 10.9.4 I don't need it to log in but i need it to make changes, etc. It says a password hasn't been set for this account but it still asks for one when i click on the lock icon. can anyone help me? thx!

    This is a little confusing since you say you have forgotten your password and then the system says you have not entered a password.  Even with an Admin account you must have a password to install software.
    If you are using Mac OS X 10.7 or above, you can change the admin password by restarting holding the Command and R keys, from the menu bar select Utilities, then Terminal.  When the Terminal window opens, at the cursor type exactly:
    resetpassword
    and press Enter.  When the Reset Password window opens, select the internal hard drive, and then the user account.  Type a new password twice, leave the Hint blank, and then Save.  Accept the next dialog that opens, and at the bottom of the Reset Password window agree to resetting the home directory permissions.
    Quit the Reset Password window, go to the apple left side of the menu bar, Restart.
    And you have a new password for your account.

  • GMail.  Changed password on PC email account, and did same on IPhone 4 Settings for Gmail.  App opens but tells me username or password for Gmail is incorrect.  Have ensured both are correct...still no access

    GMail.  Changed password on PC email account, and did same on IPhone 4 Settings for Gmail.  App opens but tells me username or password for Gmail is incorrect.  Have ensured both are correct...still no access

    If you have 2-step verification set up for your gmail account, you will need to generate an application-specific password for your iphone applications (because those apps apparently don't support 2-step verification).
    Go into your google account, look in accounts/security/2-step verification, there is a link called "Manage your application specific passwords"   Use that to generate a special password for your iphone apps and use that instead of your usual gmail password on your phone.

  • I am trying to restore an older iPod Touch, but do not have the passcode.  I am getting an error message saying that I need to free up some space, but I cannot because I don't have the passcode and have never synced this device to my account.  Help..

    I am trying to restore an older iPod Touch, but do not have the passcode.  I am getting an error message saying that I need to free up some space, but I cannot because I don't have the passcode and have never synced this device to my account.  Help..

    If it is asking for the screen-lock passcode then:
    Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
    iOS: Wrong passcode results in red disabled screen                         
    If recovery mode does not work try DFU mode.                        
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings        
    For how to restore:
    iTunes: Restoring iOS software
    To restore from backup see:
    iOS: Back up and restore your iOS device with iCloud or iTunes
    If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
    You can redownload most iTunes purchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store        
    If problem what happens or does not happen and when in the instructions? When you successfully get the iPod in recovery mode and connect to computer iTunes should say it found an iPod in recovery mode.
    Otherwise follow varjak paw recommendation

  • I cannot get my new Ipad to be recognised in ITunes  so I can Sync my library... I have re-loaded Itunes 64bit but it still comes up with an error saying that I need to load Itunes 64 bit before this Ipad will cbe recognised... any ideas?

    I cannot get my new Ipad to be recognised in ITunes  so I can Sync my library... I have re-loaded Itunes 64bit but it still comes up with an error saying that I need to load Itunes 64 bit before this Ipad will be recognised... any ideas?
    I just found that I can't Sync my Iphone either and it gave the same error code.... it must be a ITunes problem.
    Message was edited by: stephenfromwandi

    chicx wrote:
    This is the third time of writing this on your Apple Support Communities!
    Not with your current user id.
    Far too much uneccesary information in your post, which only confuses things, a vast amount!
    Let's start with iTunes.
    Have you updated iTunes to 11.1.5, because the previous version did appear to have an issue about seeing iPods?
    With iTunes 11.1.5 installed, look in Edit/Preferences/Devices, (or use the ALT key, followed by the E key and then the F key) and make sure that the box named Prevent iPods, iPhones and iPads from syncing automatically does not have a tick in the box.
    Once you have doen those two things, check to see if the iPod is seen by iTunes.
    chicx wrote:
    By the way, what does IOS mean? (I thought IO stood for operating system, but am flummoxed by the S on the end.
    Really?
    OS stands for Operating System. (In computer speak, IO means Input/Output.)
    iOS originally stood for iPhone Operating System, but it now refers to the iPod Touch and iPhone. The iPod Classic, which you have listed in your profile as your iPod, does not use iOS.
    I assume that you have been listening to the Podcast in your iTunes on the computer as you cannot transfer it to your iPod. It's what I'd do.

  • I can't connect my mac to my TV, I have the right cables and have done it right but I still doesn't get the macscreen on the Tv, what should I do?

    I can't connect my mac to my TV, I have the right cables and have done it right but I still doesn't get the macscreen on the Tv, what should I do?

    What are you getting on the TV?  Are you getting a completely blank screen, or are you getting a message similar to 'no input detected'?  Or are you seeing the spiral galaxy desktop?  If you go into System Preferences -> Displays then do you have an 'Arrangements' tab?

  • How do i create "Save As" option to file menu in Numbers version 2.3 (554). I have done this previously but cant remember how its done. My OS is 10.9.3

    How do i create "Save As" option to file menu in Numbers version 2.3 (554). I have done this previously but cant remember how its done. My OS is 10.9.3

    You can follow the steps in this article on TUAW to change the five-key shortcut for Save As… to the old tthree-key shortcut.

  • My ipad automatically jumps from one app to other. it automatically types things randomly. i dont know what it wrong. Have shown it in a service center. they have done factory reset but problem still persist.

    my ipad automatically jumps from one app to other. it automatically types things randomly. i dont know what it wrong. Have shown it in a service center. they have done factory reset but problem still persist.

    Likley a defective touchscreen.

  • HT201364 I have a MacBook Pro 17" that meets all criteria on this list but it still won't let me upgrade... Help.

    I have a MacBook Pro 17" that meets all criteria on this list but it still won't let me upgrade... Help.
    To install Mavericks, you need one of these Macs:
    MacBook Pro (15-inch or 17-inch, Mid/Late 2007 or later)  **** Maybe my MacBook Pro is early 2007 ? How do I find that out? ****
    Your Mac also needs:
    OS X Mountain Lion, Lion, or Snow Leopard v10.6.8 already installed ***YES
    2 GB or more of memory ***YES
    8 GB or more of available space ***YES
    Last Modified: Nov 6, 2013

    Then your model cannot upgrade to Mountain Lion or Mavericks. That is why you could not download it. You can upgrade to Lion, however.
    Upgrading to Lion
    If your computer does not meet the requirements to install Mountain Lion, it may still meet the requirements to install Lion.
    You can purchase Lion by contacting Customer Service: Contacting Apple for support and service - this includes international calling numbers. The cost is $19.99 (as it was before) plus tax.  It's a download. You will get an email containing a redemption code that you then use at the Mac App Store to download Lion. Save a copy of that installer to your Downloads folder because the installer deletes itself at the end of the installation.
         Lion System Requirements
           1. Mac computer with an Intel Core 2 Duo, Core i3, Core i5, Core i7,
               or Xeon processor
           2. 2GB of memory
           3. OS X v10.6.6 or later (v10.6.8 recommended)
           4. 7GB of available space
           5. Some features require an Apple ID; terms apply.

Maybe you are looking for

  • Best way to code to retrieve a field that matches one value

    Hello, Thanks for reading this post! I have a data set where users can be part of workgroups. I want to exclude any user that is part of workgroup 2 and 7, and only retrieve users that are solely part of workgroup 2. There can be users that are part

  • Default to open photos

    Is there a way to set a default program to open photos if I double click them. Currently, they open with preview. I'd like for them to open with Photoshop. Thanks much!

  • Error in MDM Console - 5.5.32.65

    I get the following error messager EVERYTIME I duplicate a repository.  The duplication seems to work, but once I get this message the MDM Console fails.  Anyone have an idea about why? 'The instruction at"0x0060e921" referenced memory at "0x000bfff4

  • Hi When im opening raw files. They open in a small tile on the dest top. how can I change this please.

    When Im opening raw files in Photoshop They open as a small tile on the desktop. How can I change this?? please help its very frustrating!

  • Stuck in the snow :-(

    So I've been traveling for the last 10 days... spent New Year's with friends in Atlanta, then flew to Miami for my sister's wedding which was on Friday. Started the drive back up to my home in Tennessee yesterday morning, and decided to spend the nig