User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 401,950 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,307 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Views: 1096 | Replies: 0
Reply
Join Date: Feb 2006
Posts: 43
Reputation: butterflyTee is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
butterflyTee butterflyTee is offline Offline
Light Poster

Help Question 9 is the only one correct, rest of them coming up syntax errors..help me

  #1  
Oct 4th, 2006
USING:ORACLE 9i

For each of the following tasks, determine (a) the SQL statement needed to perform the stated task using the traditional approach and (b) the SQL statement needed to perform the stated task the JOIN keyword.

A list that displays the title of each book & the name and phone number of the person at the publisher's office whom you would need to contact to record each book.

SELECT title, name, customer
FROM books NATURAL JOIN publisher
WHERE books.pubid = publisher.pubid
AND c.books = record

Determine which orders have not yet shipped & the name of the customer that placed each order. Sort results by dates on the orders was placed.

SELECT lastname, firstname, order#
FROM customers c, JOIN orders, o
WHERE c.customer# = o.customer#(+)
ORDER BY c.customer#;

List the customer number & names of all individuals have purchased books in the Fitness Category.

SELECT title, firstname, lastname 
FROM customers,JOIN orders, orderitems, books 
WHERE customers.customer#=orders.customer# 
AND orders.order#=orderitems.order# 
AND orderitems.isbn=books.isbn 
ORDER BY title = (‘Fitness’) 

Determine book Jake Lucas has purchased.

SELECT lastname, firstname, order# 
FROM customers c OUTER JOIN orders o
WHERE lastname = 'Lucas' and firstname = 'Jake' 
ON c.customer# = o.customers# 
ORDER BY c.customers# = (‘Jake Lucas’) 



Determine profit of each book sold to Jake Lucas. Sort results by date of order. If more than 1 book was ordered, have results sorted by profit amount in descending order.

SELECT lastname, firstname, order# 
FROM customers, JOIN orders, orderitems, books 
WHERE "Profit" 
COUNT() and GROUP BY 
ORDER BY "Profit" desc; 



Which book was written by an author with the last name Adams ?

SELECT title, authorid 
FROM books, JOIN bookauthor 
WHERE author upper(bookauthor.lastname) = ' ADAMS ' 


What gift will a customer who orders the book Shortest Poems receive?

SELECT title, customer, gift 
FROM books, JOIN promotion ('Shortest Poem') 
ON retail BETWEEN minretail AND maxretail 



Identify the author(s) of books ordered by Becca Nelson


SELECT lastname, firstname, title, customers authorid 
FROM books,JOIN customers, bookauthor 
WHERE customers
ORDER BY ('Becca Nelson') 



Display list of all books in BOOKS table. If a book has been ordered by a customer, also list the corresponding order number(s) & state which the customer resides.

SELECT title, o.order#, state
FROM books b LEFT JOIN orderitems i 
ON b.isbn=i.isbn
left JOIN orders o 
ON o.order#=i.order# 
left JOIN customers c 
ON o.customer#=c.customer#
ORDER BY title;



Produce a list of all customers live in the state of Florida & ordered books about computers.

SELECT lastname, firstname, state, books, order# 
FROM state s,JOIN customers c, orders o (' Florida ') 
WHERE c. customer# AND s. customer# = o. customer#
ON o.customer#=c.customer#
ORDER BY ('Computers') 


:mad:
Last edited by butterflyTee : Oct 4th, 2006 at 1:34 pm.
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MS SQL Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the MS SQL Forum

All times are GMT -4. The time now is 5:29 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC