Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 simple question

Author  Topic 

ibanez_destroyer
Starting Member

3 Posts

Posted - 2004-02-17 : 21:49:14
Hi guys. I am new to this forum and i am a beginner in SQL. Today, i had encouter a command:

SELECT pname, pcredit, 'over limit'
FROM passenger

What's the meaning of the thing inside the '', which is 'over limit'?
Thank you

- hamlet -

simondeutsch
Aged Yak Warrior

547 Posts

Posted - 2004-02-17 : 22:17:57
Meaning in SQL: It's an expression, a value that does not change from row to row. Every row in the result will say Over Limit in that column regardless of pname or pcredit values. Expressions must be surrounded by single quotes in SQL Server.
Meaning in English: Person's credit has been overused. They have spent more than allowed, or haven't paid up.

Sarah Berger MCSD
Go to Top of Page

ibanez_destroyer
Starting Member

3 Posts

Posted - 2004-02-17 : 23:05:53
Thank you for your reply. Still about the same issue, what will the query return? Is it
pname, and pcredit of those people who's credit is over limit?

Thanks.

- hamlet -
Go to Top of Page

samrat
Yak Posting Veteran

94 Posts

Posted - 2004-02-17 : 23:14:44
G'dday,

Try and make it simpler for you...

Say you had 2 fields in your table PNAME, PCREDIT in your passenger table.

Sample Data
PNAME PCREDIT
ABC 1000
XYZ 2000
THY 500
IHY 4500

Your Query:
SELECT pname, pcredit, 'over limit'
FROM passenger

will return

PNAME PCREDIT
ABC 1000 Over limit
XYZ 2000 Over Limit
THY 500 Over Limit
IHY 4500 Over Limit


And hence as Sarah mentoined its a expression and its value wont change.

Now, If you need to filter the data you need to use the WHERE clause (refer to BOL) with familiarising yourself with basic SQL syntax.

HTH,



Samrat
Go to Top of Page

ibanez_destroyer
Starting Member

3 Posts

Posted - 2004-02-18 : 00:24:57
Wow.. thanks a lot, Sarah, Samrat. :) Good day.

- hamlet -
Go to Top of Page
   

- Advertisement -