How do you describe a table structure in Db2?
How do you describe a table structure in Db2?
In DB2, enter on db2 command prompt. Also the following command works: describe SELECT * FROM table_name; Where the select statement can be replaced with any other select statement, which is quite useful for complex inserts with select for example.
What is primary key and foreign key in Db2?
A foreign key is a set of columns in a table which are required to match at least one primary key of a row in another table. It is a referential constraint or referential integrity constraint. It is a logical rule about values in multiple columns in one or more tables. For this table, the primary key is “sid”.
What is the difference between primary key and unique index in Db2?
Primary key will not accept NULL values whereas Unique key can accept NULL values. A table can have only one primary key whereas there can be multiple unique key on a table. A Clustered index automatically created when a primary key is defined whereas Unique key generates the non-clustered index.
What will you face Sqlcode 911?
At the time of deadlock or timeout you will face SQLCODE -911. 32.
What are tablespaces in DB2?
A DB2® table space is a set of volumes on disks that hold the data sets in which tables are actually stored. Every table is stored in table space. A table space consists of a number of VSAM linear data sets (LDSs). You can also explicitly define table spaces by issuing CREATE TABLESPACE statements.
What is Cascade in DB2?
CASCADE deletes the row in the parent table and all related rows in the child table. SET NULL deletes the row in the parent table and updates values in the foreign key columns in the child table to NULL only if these columns are not nullable columns.
What is cursor in DB2?
Db2 has a mechanism called a cursor . In Db2, an application program uses a cursor to point to one or more rows in a set of rows that are retrieved from a table. You can also use a cursor to retrieve rows from a result set that is returned by a stored procedure.