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.
| Author |
Topic |
|
Duran
Starting Member
9 Posts |
Posted - 2006-07-17 : 07:46:46
|
| Hi, I am a total novice at t-sql so please forgive me if this is a silly question.Im currently woring through a pretty good book, but I am confused as to knowing what is available when typing in statements. By that I mean, if I am asked to find the name, last name and date of birth of someone, I understand SELECT and WHERE etc but I never know what to type in regarding say 'customerID' and how do I know to type customerid rather than just 'customer', and have the query work?Another example is when I need to find the price of something, I tried typing in 'price' but then found I'm supposed to type in 'unitprice'. Is this standard? How can I know what to type in to define a certain something.Thanks for any help.D.Yes, we have no banana's. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-07-17 : 07:54:49
|
"how do I know to type customerid rather than just 'customer'"You have to specify the column name of the table.There are many ways to find out what is the column name of a table.The easiest way is select * from table_name This will lists all the records in the table with the column name. KH |
 |
|
|
RyanRandall
Master Smack Fu Yak Hacker
1074 Posts |
Posted - 2006-07-17 : 07:57:51
|
| It's all about the structure of your tables, and the columns that they have.> how do I know to type customerid rather than just 'customer'If your table has a customerid column, you can type (i.e. use) it.If your table has a customer column, you can type (i.e. use) it.> I tried typing in 'price' but then found I'm supposed to type in 'unitprice'.In this case your table clearly didn't have a price column, but had a unitprice column.> Is this standard?No, the structure of a table (including column names) is defined by whoever created it, and can therefore be (pretty much) anything.> How can I know what to type in to define a certain something?It sounds to me like you're really asking 'How do I know what columns my table has?'If you highlight the table name in query analyzer and do 'Alt+F1', you will get information about that table.You can also do 'select top 100 * from YourTable' to see the columns and some sample data.Also, I think you should take a look at these...http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp If you still have problems, try asking specific questions about specific situations you have.Ryan Randallwww.monsoonmalabar.com London-based IT consultancy Solutions are easy. Understanding the problem, now, that's the hard part. |
 |
|
|
Duran
Starting Member
9 Posts |
Posted - 2006-07-17 : 10:18:30
|
| Hey there,Thanks very much for your quick responses, I will look at the URLs you provided, but that basically answers my questions, thanks very much to the both of you.Regards,D.Yes, we have no banana's. |
 |
|
|
RyanRandall
Master Smack Fu Yak Hacker
1074 Posts |
Posted - 2006-07-17 : 10:28:05
|
No worries Duran. Glad we could help By the way - re your signature: "Yes, we have no banana's.".Is the apostrophe a deliberate mistake? Ryan Randallwww.monsoonmalabar.com London-based IT consultancy Solutions are easy. Understanding the problem, now, that's the hard part. |
 |
|
|
|
|
|
|
|