EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login

DB2 Describe Table

Secondary Sidebar
DB2 Tutorial
  • DB2 Tutorial
    • What is DB2?
    • DB2? current date
    • DB2 purescale
    • DB2 backup
    • DB2 restore
    • DB2 C Express
    • DB2 Version
    • DB2? Architecture
    • DB2? Data Types
    • DB2? load
    • DB2? order by
    • DB2 date
    • DB2 NVL
    • DB2? update
    • DB2 warehouse
    • DB2 grant
    • DB2 database
    • DB2 VARCHAR
    • DB2? INSERT
    • DB2 LISTAGG
    • DB2 LIKE
    • DB2 TRUNCATE TABLE
    • DB2 LIST TABLES
    • DB2 between
    • DB2? current timestamp
    • DB2? length
    • DB2? bind
    • DB2 limit rows
    • DB2? export
    • DB2 with
    • DB2 Create Table
    • DB2 case statement
    • DB2 CAST
    • DB2 Functions
    • DB2 Date Functions
    • DB2? row_number
    • DB2 trim
    • DB2? Translate
    • DB2 UNION
    • DB2 timestamp
    • DB2? TIMESTAMPDIFF
    • DB2? replace
    • DB2 merge
    • DB2 COALESCE
    • DB2 ISNULL
    • DB2? explain
    • DB2 Join
    • DB2 alter column
    • DB2 rename column
    • DB2? Describe Table
    • DB2? rename table
    • DB2 List Databases
    • DB2 LUW
    • DB2 Query
    • DB2 GROUP BY
    • DB2 TO_DATE
Home Data Science Data Science Tutorials DB2 Tutorial DB2 Describe Table

DB2 Describe Table

Introduction to DB2 Describe Table

DB2 provides the different types of commands to the user, the DB2 describe table is one of the commands that is provided by the DB2. Basically describe table command is used to fetch all details structure of a created table that means it displays the information about the columns, index of table or view as well as it is also used in select, call statement to display some basic information about the specified table.db2 describe table it is also useful in data partition of different tables and view. As per user requirements, we can use the describe table command to see the detailed structure of the user-defined table.

Syntax:

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

describe select * from the specified table name;

Explanation: In the above syntax we use describe table command with select clause, here specified table name means actual table name that is created by the user.

How to describe Table in DB2?

Now let’s see how to describe table works in DB2 as follows:

Basically, the table command shows the following output as follows.

  1. End result of select and Xquery statement.
  2. It also used to display the OUT and INOUT parameters.
  3. Different columns from the specified table and view.
  4. Specified index from the table and view

After that, the most important point is Authorization as follows.

All in One Data Science Bundle(360+ Courses, 50+ projects)
Python TutorialMachine LearningAWSArtificial Intelligence
TableauR ProgrammingPowerBIDeep Learning
Price
View Courses
360+ Online Courses | 50+ projects | 1500+ Hours | Verifiable Certificates | Lifetime Access
4.7 (85,938 ratings)

The approval required relies upon the kind of data you need to show utilizing the DESCRIBE command.

On the off chance that the SYSTOOLSTMPSPACE tablespace exists, one of the remote users is required to perform the describe table command, so we required the following table to as follows.

1. If we need to display the end result of the select and XQuery statement then we require any one of the following authorization as follows.

  • We required database access authority.
  • We also required explanatory authority.
  • We required the different privileges for select statements on each table and view.
  • We required a different privilege for select statements on a schema that contains the table and view.
  • Execute privilege.
  • Read privilege on global variables.

2. If we use OUT and INOUT parameters in a call statement at that time we require any one of the following authority as follows.

  • We required database access authority.
  • WE required EXECUTE privileges for the stored procedure.
  • WE required EXECUTE privileges for the stored procedure and schema.
  • We also required DATAACCESS authority for a schema that contained the store procedure.

3. Column of the table or view at that time we required any one of the following authority as follows.

  • We need select privileges.
  • We also required selection privileges.
  • We required database access authority.

4. Command-line Parameter as follows.

OUTPUT: This is used to display the output statement and it is an optional part of this syntax.

TABLE table-name: It is used to specify the table or view that we need to describe. The completely qualified name in the structure schema.table-name should be utilized. An alias for the table can’t be utilized instead of the real table. Data about certainly covered up sections is returned, yet SHOW DETAIL should be utilized to demonstrate which segments are verifiably covered up.

The DESCRIBE TABLE command contains the accompanying data about every section as follows.

  1. Column name
  2. Type of schema.
  3. Type name.
  4. Length
  5. Scale

5. Index for specified table name:

Determines the table or view for which records should be portrayed. You can utilize the completely qualified name in the structure schema.table-name or you can simply determine the table-name and default outline will be utilized consequently. A nom de plume for the table can’t be utilized instead of the real table.

The DESCRIBE INDEXES FOR TABLE order records the accompanying data about each list of the table or view:

  1. Record pattern(index pattern)
  2. Record name(index name)
  3. Record type that means index type

On the off chance that the DESCRIBE INDEXES FOR TABLE command is determined with the SHOW DETAIL choice, the record name is shortened when the file name is more noteworthy than 18 bytes. On the off chance that no record type choice is indicated, data for all list types are recorded: social information file, file over XML information, and Text Search file. The yield incorporates the accompanying extra data:

List ID for a social information file, a XML way record, a XML districts file, or a list over XML information

  1. Information Type for a list over XML information
  2. Hashed for a list over XML information
  3. Max VARCHAR Length for a list over XML information

It also utilizes the following parameter as follows.

  1. Relational Data.
  2. XML Data.
  3. TEXT Search.
  4. Data Partitions for the specified table name.
  5. Show details.

Examples of DB2 Describe Table

Now let’s see the different examples of db2 describe table command as follows.

First, we need to create a new table by using the create table statement as follows.

Command:

create table emp (emp_id int not null, emp_first_name varchar(60), emp_last_name varchar(60), emp_email varchar(40), emp_verification Boolean, PRIMARY KEY(emp_id));

Explanation: In the above example we use a create table statement to create a new table name as emp with different attributes and different data types as shown in the above statement. The end result of the above statement we illustrate by using the following screenshot as follows.

DB2 Describe Table Example 1

Now use the select statement to see the records from the emp table as follows.

Command:

select * from emp;

Explanation: The emp table does not contain any record. The end result of the above statement we illustrate by using the following screenshot as follows.

DB2 Describe Table Example 2

Now use the describe command to see metadata about the emp table.

Command:

describe table emp;

Explanation: The end result of the above statement we illustrate by using the following screenshot as follows.

DB2 Describe Table Example 3

Command:

describe SELECT * FROM emp;

Explanation: By using the above statement we can also describe the table. The end result of the above statement we illustrate by using the following screenshot as follows.

DB2 Describe Table Example 4

We can also describe table commands with index, call statement, schema.

Conclusion

We hope from this article you have understood about the DB2 describe table. From the above article, we have learned the basic syntax of describing the table and we also see different examples of describe table. From this article, we learned how and when we use the DB2 to describe a table.

Recommended Articles

This is a guide to DB2 Describe Table. Here we discuss the basic concept, syntax, and How to describe the Table in DB2 along with Commands and its examples. You can also go through our other suggested articles to learn more –

  1. DB2 Translate
  2. DB2 Version
  3. DB2 Create Table
  4. DB2 Data Types
Popular Course in this category
SQL Training Program (7 Courses, 8+ Projects)
  7 Online Courses |  8 Hands-on Projects |  73+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course
0 Shares
Share
Tweet
Share
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Data Science Course

SPSS, Data visualization with Python, Matplotlib Library, Seaborn Package

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

Special Offer - SQL Training Program (7 Courses, 8+ Projects) Learn More