Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: newbie-desc command

Re: newbie-desc command

From: Me <me_at_privacy.net>
Date: Tue, 20 May 2003 23:01:14 +0530
Message-ID: <tfpkcvsm3vmj19qkk03hmsoncr9tu6e46c@4ax.com>


On Tue, 20 May 2003 15:35:11 +0000, andrewst wrote:

>
>Originally posted by Sybrand Bakker
>> "Me" wrote in message
>> news:b1vccvgbffv5ro9n7qso72n8ilrhjfjdrm_at_4ax.com"]news:b1vccvgbf-
>> fv5ro9n7qso72n8ilrhjfjdrm_at_4ax.com[/url]...
>> > In Oracle SQL* Plus desc command give the information of a table
>> but
>> > how does one know which is the primary key?
>> > I am sorry if this has been already asked and answered
>> here.
>> > Thanks in advance.
>>
>>
>> By querying
>> select constraint_name from user_constraints where table_name = '' and
>> constraint_type = 'P'
>>
>> There is a reference manual with a full break down of all the
>> dictionary
>> views. Please use it, before you come boring and will be ignored.
>>
>>
>> --
>> Sybrand Bakker
>> Senior Oracle DBA
>>
>> to reply remove '-verwijderdit' from my e-mail address
>>
>I fully endorse the idea that people should read the manuals and they
>will learn a lot. However, we should remember that sometimes these
>people are "newbies" as "Me" claims to be. How is a total newbie
>expected to know that the way to find out the primary key of a table is
>not via the DESC command (which shows SOME information about a table),
>but by selecting from a set of views documented in the Oracle Database
>Reference manual (not in the SQL reference manual for example?)
>Sometimes people need a gentle nudge in the right direction!

Infact I had asked this question to one of my friends who had learnt SQL else where in an institution and to my teacher. Both said that there is no way of finding it out. They said all you will see is that the column is marked Not Null.

"Then how would I cofirm a primary key?" No answer.
"Is the only way to find this by looking it up via the 8i navigator?" May be.

Most of the times what happens is students/teachers tend to look into the book such as the one I am using (prescribed) and never bother to check if it is really possible to create such a table etc (the one I posted).



They (and even the syllabus) tend to focus more on the theory and ER diagrams etc. and less on actually implementing it in a real language such as SQL.
Are they right, in a way?

Take a look at the table of contents for a brief idea: http://www.aw.com/catalog/academic/product/0,4096,0321122267-TOC,00.html

http://www.aw.com/info/database/elmasri.html#toc (Just incase one link breaks; both give the same info)

Thanks. Received on Tue May 20 2003 - 12:31:14 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US