- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a DB2 table TAB1 with 4 columns, Student ID, Enrollment ID, Name and Age?
A table is a logical structure of a data in a DB2. A table consists of a column which represents the attribute and rows represents the entity. Below command can be issued in order to create a new DB2 table.
CREATE TABLE DBSET1.TAB1 (STUDENT_ID CHAR(10) NOT NULL, ENROLLMENT_ID CHAR(20) NOT NULL, NAME VARCHAR(50), AGE SMALLINT PRIMARY KEY (STUDENT_ID));
The CREATE TABLE reserved words are followed by the name of the table which we have to create in the format <DATABASENAME.TABLENAME>. Here DBSET1 is the database and TAB1 is the table.
The name of the column has to be mentioned followed by data type for each of the columns like CHAR for character data, VARCHAR for variable character (used for indeterminate length) and SMALLINT for small integer value which occupies 2 bytes.
The PRIMARY KEY parameter defines the primary key of the table which has to be unique throughout the rows present in the table.
- Update a MongoDB document with Student Id and Name
- How to add a unique index on the above table TAB1 for column Enrollment ID (ascending)?
- How to use three conditions in a single MySQL query with id, name and age of students to fetch record of a student?
- How to delete a DB2 table TAB1?
- How to create a view on table TAB1 for column Name, age, enrollmentId & age > 10 years. >
- How to create an ALIAS TAB2 for DB2 table TAB1?
- How to add a row compression to a DB2 table TAB1?
- How to find the primary key of a DB2 table TAB1?
- Purpose and usage of ROW-ID and SEQUENCE in a DB2
- How to create a table TAB2 having same attributes & columns as for table TAB1
- How to get the list of all COBOL-DB2 programs using a DB2 table TAB1?
- How to image copy the entire DB2 table TAB1 into a dataset?
- How to find all the foreign keys of a DB2 table TAB1?
- How to find out all the indexes for a DB2 table TAB1?
- How to select from table where conditions are set for id and name in MySQL?