6
1. Connect to sample database Connect to sample 2. To list all tables LIST TABLES 3. Describe the structure of a table EMPLOYEE DESCRIBE TABLE employee 4. List all rows for table EMPLOYEE SELECT * FROM employee 5. List selected columns for EMPLOYEE 6. Create alias name for column.

Working on Sample Database

Embed Size (px)

DESCRIPTION

Simple codes for the predefined database for DB2

Citation preview

Page 1: Working on Sample Database

1. Connect to sample database

Connect to sample

2. To list all tables

LIST TABLES

3. Describe the structure of a table EMPLOYEE

DESCRIBE TABLE employee

4. List all rows for table EMPLOYEE

SELECT * FROM employee

5. List selected columns for EMPLOYEE

6. Create alias name for column.

Page 2: Working on Sample Database

7. Concatenate columns

8. List all rows with salary between 20,000 and 50,000 arranged in descending order.

Page 3: Working on Sample Database

9. List rows with salary greater than 50,000

10. List all rows hired between 1980 and 2000 in ascending order in terms of hiredate.

Page 4: Working on Sample Database

11. Sort Employee by last name. List empno, concatenated lastname and firstnme , and its dept

12. Sort Employee by workdept then by lastname.

Page 5: Working on Sample Database

13. List all employees with workdept equal to a00 OR workdept = E11

14. List all employees that belong to workdept C01, E01, E21.

Page 6: Working on Sample Database

15. List employee’s last name, salary and projected 10% increase in salary.