Page 1 of 2 12 LastLast
Results 1 to 20 of 24

Thread: Query to find structure of a table

  1. #1
    Geek_Guest
    Guest

    Query to find structure of a table

    Please give me the query.. How to findout the structure of a table?

    Question asked by visitor Mahesh.Mk


  2. #2
    Junior Member
    Join Date
    Apr 2007
    Answers
    2

    Thumbs up Re: Query to find structure of a table

    desc tablename


  3. #3
    Junior Member
    Join Date
    Apr 2007
    Answers
    1

    Re: Query to find structure of a table

    DESC TABLE_NAME;

    eg:

    DESC EMP;

    EMP is name of table.


  4. #4
    Moderator
    Join Date
    Sep 2006
    Answers
    920

    Re: Query to find structure of a table

    yes Desc Table_name is the query.

    Desc stands for describe.

    Regards,
    Brijesh Jain
    ---------------------------------------------------------
    Connect with me on Skype: jainbrijesh
    Google Plus : jainbrijeshji

  5. #5
    Expert Member
    Join Date
    Nov 2006
    Answers
    518

    Re: Query to find structure of a table

    All the answers given above are correct. But, as far as I know,

    DESC /tablename/

    is not a query. It is an SQL-Plus command.

    Because only SELECT statements can be called as a query.

    Lack of WILL POWER has caused more failure than
    lack of INTELLIGENCE or ABILITY.

    -sutnarcha-

  6. #6
    Contributing Member
    Join Date
    Mar 2007
    Answers
    42

    Re: Query to find structure of a table

    Good one from sutnarcha !!!
    Yes !!! its not a query - Which retrieves some data from the databse :-)


  7. #7
    Junior Member
    Join Date
    Apr 2007
    Answers
    1

    Re: Query to find structure of a table

    Quote Originally Posted by Geek_Guest View Post
    Please give me the query.. How to findout the structure of a table?

    Question asked by visitor Mahesh.Mk
    desc Table Name;


  8. #8
    Junior Member
    Join Date
    Dec 2006
    Answers
    1

    Re: Query to find structure of a table

    SQL> desc table_name
    eg
    SQL> desc emp

    or
    SQL> describe table_name


  9. #9

    Thumbs up Re: Query to find structure of a table

    desc


  10. #10

    Re: Query to find structure of a table

    desc object_name.


  11. #11
    Contributing Member
    Join Date
    Aug 2007
    Answers
    59

    Re: Query to find structure of a table

    Desc tablename i think its also a query anything getting information is query i quess!!!


  12. #12
    Junior Member
    Join Date
    Sep 2008
    Answers
    1

    Re: Query to find structure of a table

    select COLUMN_NAME, DATA_TYPE
    from USER_TAB_COLUMNS
    where TABLE _NAME = 'your table name'; .....(Like 'emp')


  13. #13
    Expert Member
    Join Date
    Jun 2007
    Answers
    260

    Re: Query to find structure of a table

    hi,

    agree with sutnarcha

    Thanks
    Sushma


  14. #14
    Junior Member
    Join Date
    Jan 2009
    Answers
    1

    Re: Query to find structure of a table

    SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'name of the table';


  15. #15
    Expert Member
    Join Date
    Nov 2008
    Answers
    300

    Re: Query to find structure of a table

    You can either describe the table using DESC command or you can use data dictionary views "ALL TABLE and ALL TABLE COLUMNS" to look at the list of columns of the table and its structure. If you are using TOAD, then just type the table name in the sql editor of TOAD and click on F4, that will open up a window to show the constraints, table struvture, indexes etc of that particular table


  16. #16
    Junior Member
    Join Date
    Oct 2008
    Answers
    1

    Re: Query to find structure of a table

    Query 1:

    select column_name, data_type, data_length,
    2 data_precision, data_scale from ALL_TAB_COLUMNS
    3 where table_name = 'EMP';

    Query 2:

    SQL> set long 100000
    SQL> set pages 0
    SQL> select dbms_metadata.get_ddl('TABLE','EMP') from dual;

    i think this should work out !!!

    These queries would answer your query !!


  17. #17

    Re: Query to find structure of a table

    i work on putty and here we use the following for getting the structure of the table

    describe output select * from table_name


  18. #18
    Junior Member
    Join Date
    Mar 2012
    Answers
    2

    Re: Query to find structure of a table

    sp_help table_name


  19. #19
    Junior Member
    Join Date
    Oct 2008
    Answers
    28

    Re: Query to find structure of a table

    DESC

    EX : DESC EMPDETAILS


  20. #20
    Junior Member
    Join Date
    Mar 2012
    Answers
    2

    Re: Query to find structure of a table

    Desc command not working in sql 2008..


  21. Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •  
    About us
    Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
    Interact