Welcome to Dream.In.Code
Become an Expert!

Join 149,578 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,744 people online right now. Registration is fast and FREE... Join Now!




Couple More Questions

2 Pages V  1 2 >  
Reply to this topicStart new topic

Couple More Questions

James Bond C++ Spy
16 Oct, 2007 - 01:50 PM
Post #1

D.I.C Head
**

Joined: 3 Oct, 2007
Posts: 81


My Contributions
Question 1

Based upon the contents of the PUBLISHER table, which of the following is not a valid SQL statement?
1)
SELECT name, phone
FROM publisher
2)
SELECT name, contract FROM publisher
3)
SELECT * FROM publisher;
4)
SELECT Phone, Pubid
FROM publisher;

Question 2

Which of the following queries will return all books that cost at least $25.00?
1)
SELECT * FROM books
WHERE cost > $25.00;
2)
SELECT * FROM books
WHERE cost >= 25.00;
3)
SELECT * FROM books
WHERE cost >= $25.00;
4)
none of the above

Question 3

Which of the following select statements will change the column heading of the lname Last Name field?
1)
SELECT * FROM lname
2)
SELECT Last Name from lname
3)
SELECT lname as [Last Name], fname FROM Names
4)
SELECT Names From lname as [Last Name]

Thanks for all the help

James Bond C++ Spy

This post has been edited by James Bond C++ Spy: 16 Oct, 2007 - 01:52 PM
User is offlineProfile CardPM
+Quote Post

skyhawk133
RE: Couple More Questions
16 Oct, 2007 - 01:55 PM
Post #2

Head DIC Head
Group Icon

Joined: 17 Mar, 2001
Posts: 15,262



Thanked: 61 times
Dream Kudos: 1650
Expert In: Web Development

My Contributions
Hmmm, not sure if this was supposed to be part of another thread where all of the pertinent information is... but this just looks like you pasted your homework assignment.

As the rules state, we will not do your homework for you. If you need help with one specific problem and can tell us where you're hung up, we'd be happy to help.
User is offlineProfile CardPM
+Quote Post

James Bond C++ Spy
RE: Couple More Questions
16 Oct, 2007 - 01:58 PM
Post #3

D.I.C Head
**

Joined: 3 Oct, 2007
Posts: 81


My Contributions
No, these are part of a take home test that I can't seen to find the answers to anywhere in the book or on the net so I thought I would check here to see if someone could help.

James Bond C++ Spy
User is offlineProfile CardPM
+Quote Post

skyhawk133
RE: Couple More Questions
16 Oct, 2007 - 02:01 PM
Post #4

Head DIC Head
Group Icon

Joined: 17 Mar, 2001
Posts: 15,262



Thanked: 61 times
Dream Kudos: 1650
Expert In: Web Development

My Contributions
Sorry, but we can't just do your homework for you.

What is the specific question you have... these are the most basic SQL statement there are so I'm not really sure what problem you're having. Are you confused by the question, do you not understand the wording.

Either way, you're going to have to tell us what exactly you don't understand before we can help. It's a site policy and is enforced quite strictly here.
User is offlineProfile CardPM
+Quote Post

aceofspades686
RE: Couple More Questions
16 Oct, 2007 - 02:02 PM
Post #5

D.I.C Regular
Group Icon

Joined: 8 Oct, 2007
Posts: 261


Dream Kudos: 100
My Contributions
W3Schools is your friend.
User is offlineProfile CardPM
+Quote Post

James Bond C++ Spy
RE: Couple More Questions
16 Oct, 2007 - 02:04 PM
Post #6

D.I.C Head
**

Joined: 3 Oct, 2007
Posts: 81


My Contributions
Questions 1 & 3 I don't understand the question.

Question 2 I don't know if you can use a decimal 25.00 or if it should just be 25

Looked on w3schools but they aren't specific enough.

Thanks for the help

James Bond C++ Spy ph34r.gif

This post has been edited by James Bond C++ Spy: 16 Oct, 2007 - 02:05 PM
User is offlineProfile CardPM
+Quote Post

skyhawk133
RE: Couple More Questions
16 Oct, 2007 - 02:09 PM
Post #7

Head DIC Head
Group Icon

Joined: 17 Mar, 2001
Posts: 15,262



Thanked: 61 times
Dream Kudos: 1650
Expert In: Web Development

My Contributions
QUOTE(James Bond C++ Spy @ 16 Oct, 2007 - 03:50 PM) *

Question 1

Based upon the contents of the PUBLISHER table, which of the following is not a valid SQL statement?
1)
SELECT name, phone
FROM publisher
2)
SELECT name, contract FROM publisher
3)
SELECT * FROM publisher;
4)
SELECT Phone, Pubid
FROM publisher;


Depending on the contents of the publisher table any number of things could be wrong with the statement. In 1) check to see if name and phone are actually column names in the table, in 2) check to see if name and contract are valid column names... also check to see if the missing ; at the end is a typo on your part, if it's not, then 2) might not be valid, in 3) as long as the name of the table is in fact publisher, it should be fine, in 4) as long as Phone and Pubid are valid column names you should be fine.

QUOTE

Question 2

Which of the following queries will return all books that cost at least $25.00?
1)
SELECT * FROM books
WHERE cost > $25.00;
2)
SELECT * FROM books
WHERE cost >= 25.00;
3)
SELECT * FROM books
WHERE cost >= $25.00;
4)
none of the above


Is cost a integer field or a float? If it's an integer, I don't think you can use decimal points in the where clause, the $ is almost definitely a no go, and the >= should be correct for "at least $25.00"

QUOTE

Question 3

Which of the following select statements will change the column heading of the lname Last Name field?
1)
SELECT * FROM lname
2)
SELECT Last Name from lname
3)
SELECT lname as [Last Name], fname FROM Names
4)
SELECT Names From lname as [Last Name]

Thanks for all the help

James Bond C++ Spy


Look up the correct syntax for "AS" which is how you change a column heading. Then, depending on the field names pick the correct one.
User is offlineProfile CardPM
+Quote Post

James Bond C++ Spy
RE: Couple More Questions
16 Oct, 2007 - 02:18 PM
Post #8

D.I.C Head
**

Joined: 3 Oct, 2007
Posts: 81


My Contributions
Thanks for the help
question 1 I have no database to check so it's potluck here blink.gif
question 2 I didn't think you could use decimals but wasn't sure and didn't know if it was a integer field or a float.
question 3 I thought AS was a keyword but there again I didn't have a database to check.

Anyway thanks for the help and just couldn't find the answers anywhere. But I was close 2 out of 3 biggrin.gif

James Bond C++ Spy
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Couple More Questions
16 Oct, 2007 - 02:36 PM
Post #9

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,482



Thanked: 161 times
Dream Kudos: 9050
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
If this is Microsoft SQL Server then the AS is correct and the ; will cause an error, so given that in question #1 3 and 4 aren't valid (unless the ; is a typo on your part). Question #2 query 2 will return the desired results, Question #3 Id have to say query 3 but in all my years of programming (MSSQL for 10 years now) I've never seen it done with [ ] before, and you cant use a ; in MSSQL last time I checked.

So, what database is this?
User is offlineProfile CardPM
+Quote Post

James Bond C++ Spy
RE: Couple More Questions
16 Oct, 2007 - 02:39 PM
Post #10

D.I.C Head
**

Joined: 3 Oct, 2007
Posts: 81


My Contributions
SQL for SQL Server

I have submitted the test and will post the correct answers to these questions as soon as I know. Thanks for all the help. I have a pretty good handle on this material but these questions confused me. (with no database query)

Thanks

James Bond C++ Spy

This post has been edited by James Bond C++ Spy: 16 Oct, 2007 - 02:45 PM
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Couple More Questions
16 Oct, 2007 - 02:45 PM
Post #11

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,482



Thanked: 161 times
Dream Kudos: 9050
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
That must mean Microsoft SQL Server. Well, like I said before, Ive been using MSSQL for over 10 years now, way back when before they had a decent GUI to use, and Ive never seen a semi-colon at the end of a query (;), and Ive never seen an AS statement used that way. We've always done it like SELECT SomeColumn AS 'Your Column' FROM SomeTable so the [ ] is, well its new to me smile.gif
User is offlineProfile CardPM
+Quote Post

James Bond C++ Spy
RE: Couple More Questions
16 Oct, 2007 - 02:48 PM
Post #12

D.I.C Head
**

Joined: 3 Oct, 2007
Posts: 81


My Contributions
Yes it is Microsoft. I had another question using the as and the [ ] is what confused me aswell. In the other question I used ' ' and it worked perfectly. Weird questions. Thanks so much for the replies and help.

James Bond C++ Spy
User is offlineProfile CardPM
+Quote Post

2 Pages V  1 2 >
Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 10:36PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month