SlideShare a Scribd company logo
1 of 26
www.srinimf.com
 to start type
db2start
 To stop
db2stop
 db2 => connect to sample
 db2 => bind sample.bnd
Help command:
Db2 => ?
Db2 => ? CATALOG DATABASE - It gives more
info on particular command
Quit Commnad:
Db2 => quit
db2 => db2start This takes some time (maybe 30 seconds)
DB20000I The DB2START command completed successfully.
db2 => ?
ACTIVATE DATABASE GET CONTACTGROUPS RECONCILE
ADD CONTACT GET CONTACTS RECOVER
ADD CONTACTGROUP GET/UPDATE DB CFG REDISTRIBUTE DB PARTITION
ADD DATALINKS MANAGER GET/UPDATE DBM CFG REFRESH LDAP
ADD DBPARTITIONNUM GET DBM MONITOR SWITCHES REGISTER LDAP
ADD XMLSCHEMA GET DESCRIPTION FOR HEALTH REGISTER XMLSCHEMA
ARCHIVE LOG GET NOTIFICATION LIST REGISTER XSROBJECT
ATTACH GET HEALTH SNAPSHOT REORG INDEXES/TABLE
AUTOCONFIGURE GET INSTANCE REORGCHK
BACKUP DATABASE GET MONITOR SWITCHES RESET ADMIN CFG
BIND GET RECOMMENDATIONS RESET ALERT CFG
CATALOG APPC NODE GET ROUTINE RESET DB CFG
CATALOG APPN NODE GET SNAPSHOT RESET DBM CFG
CATALOG DATABASE HELP RESET MONITOR
CATALOG DCS DATABASE HISTORY RESTART DATABASE
CATALOG LDAP DATABASE IMPORT RESTORE DATABASE
CATALOG LDAP NODE INITIALIZE TAPE REWIND TAPE
CATALOG LOCAL NODE INSPECT ROLLFORWARD DATABASE
CATALOG NPIPE NODE LIST ACTIVE DATABASES RUNCMD
CATALOG NETBIOS NODE LIST APPLICATIONS RUNSTATS
CATALOG ODBC DATA SOURCE LIST COMMAND OPTIONS SET CLIENT
CATALOG TCPIP NODE LIST DATABASE DIRECTORY SET RUNTIME DEGREE
CHANGE DATABASE COMMENT LIST DB PARTITION GROUPS SET TABLESPACE CONTAINERS
CHANGE ISOLATION LEVEL LIST DATALINKS MANAGERS SET TAPE POSITION
COMPLETE XMLSCHEMA LIST DBPARTITIONNUMS SET UTIL_IMPACT_PRIORITY
CREATE DATABASE LIST DCS APPLICATIONS SET WRITE
 CREATE TOOLS CATALOG LIST DCS DIRECTORY START DATABASE MANAGER
 DEACTIVATE DATABASE LIST DRDA INDOUBT START HADR
 DECOMPOSE XML DOCUMENT LIST HISTORY STOP DATABASE MANAGER
 DECOMPOSE XML DOCUMENTS LIST INDOUBT TRANSACTIONS STOP HADR
 DEREGISTER LIST NODE DIRECTORY TAKEOVER HADR
 DESCRIBE LIST ODBC DATA SOURCES TERMINATE
 DETACH LIST PACKAGES/TABLES UNCATALOG DATABASE
 DROP CONTACT LIST TABLESPACE CONTAINERS UNCATALOG DCS DATABASE
 DROP CONTACTGROUP LIST TABLESPACES UNCATALOG LDAP DATABASE
 DROP DATABASE LIST UTILITIES UNCATALOG LDAP NODE
 DROP DATALINKS MANAGER LOAD UNCATALOG NODE
 DROP DBPARTITIONNUM LOAD QUERY UNCATALOG ODBC DATA
 DROP TOOLS CATALOG MIGRATE DATABASE UNQUIESCE DATABASE
 ECHO PING UNQUIESCE INSTANCE
 EDIT PREP/PRECOMPILE UPDATE ALERT CFG
 EXPORT PRUNE HISTORY/LOGFILE UPDATE COMMAND OPTIONS
 FORCE APPLICATION PUT ROUTINE UPDATE CONTACT
 GET/UPDATE ADMIN CFG QUERY CLIENT UPDATE CONTACTGROUP
 GET ALERT CFG QUIESCE DATABASE UPDATE NOTIFICATION LIST
 GET AUTHORIZATIONS QUIESCE INSTANCE UPDATE HISTORY
 GET/UPDATE CLI CFG QUIESCE TABLESPACES UPDATE LDAP NODE
 GET CONNECTION STATE QUIT UPDATE MONITOR SWITCHES
 GET CONTACTGROUP REBIND XQUERY
 Note: Some commands are operating system specific and may not be available.
 For further help:
 ? db2-command - help for specified command
 ? OPTIONS - help for all command options
 ? HELP - help for reading help screens
 The preceding three options can be run as db2 <option> from an OS prompt.
 !db2ic - DB2 Information Center (Windows only)
 This command can also be run as db2ic from an OS prompt.
 db2 => create database slo
 DB20000I The CREATE DATABASE command
completed successfully.
 db2 => connect to slo
 Database Connection Information
 Database server = DB2/SUN64
9.7.0
 SQL authorization ID = DB90 <-
my db2 account
 Local database alias = SLO
db2 => create table EMPLOYEE 
db2 (cont.) => (SSN varchar(9) not
null, 
db2 (cont.) => LastNam
db2 (cont.) => e varchar(20), 
db2 (cont.) => Firs
db2 (cont.) => tName varchar(10), 
db2 (cont.) => Sex varchar(1), 
db2 (cont.) => DeptNo char(3), 
db2 (cont.) => primary key(SSN))
DB20000I The SQL command completed
successfully.
 db2 => insert into DEPARTMENT
values('SG7','Safety
Department','Springy')
DB20000I The SQL command
completed successfully.
 db2 => select LastName, DeptName from
Employee as e, Department as d 
db2 (cont.) => where e.deptno = d.deptno
LASTNAME DEPTNAME
-------------------- --------------------
Simpson Safety Department
Green Safety Department
Bing Accounting
Flanders Personnel
Geller Personnel
5 record(s) selected.
db2 => select Lastname, projectname 
db2 (cont.) => from employee e, department d, project p 
db2 (cont.) => where e.deptno = d.deptno and d.deptno =
p.deptno
LASTNAME PROJECTNAME
-------------------- --------------------
Simpson New Pay
Green New Pay
Flanders GetThings
Geller GetThings
Simpson Alpha
Green Alpha
Simpson Omega
Green Omega
Bing Delta
Simpson Pi
Green Pi
11 record(s) selected.
db2 => select lastname from employee as e, department as d 
db2 (cont.) => where e.deptno = d.deptno and deptname = 'Safety
Department' (line wrapped by powerpoint)
LASTNAME
--------------------
Simpson
Green
2 record(s) selected.
db2 => select lastname from employee where deptno in 
db2 (cont.) => (select deptno from department 
db2 (cont.) => where deptname = 'Safety Department')
LASTNAME
--------------------
Simpson
Green
2 record(s) selected.
db2 => select * from employee, department
SSN LASTNAME FIRSTNAME SEX DEPTNO DEPTNO DEPTNAME LOCATION
--------- -------------------- ---------- --- ------ ------ -------------------- ----------
245 Simpson Homer M SG7 SG7 Safety Department Springy
245 Simpson Homer M SG7 S8P Accounting London
245 Simpson Homer M SG7 G6H Personnel London
245 Simpson Homer M SG7 K9J InfoTech Toronto
34 Flanders Ned M G6H SG7 Safety Department Springy
34 Flanders Ned M G6H S8P Accounting London
34 Flanders Ned M G6H G6H Personnel London
34 Flanders Ned M G6H K9J InfoTech Toronto
222 Green Rachel F SG7 SG7 Safety Department Springy
222 Green Rachel F SG7 S8P Accounting London
222 Green Rachel F SG7 G6H Personnel London
222 Green Rachel F SG7 K9J InfoTech Toronto
333 Bing Changler M S8P SG7 Safety Department Springy
333 Bing Changler M S8P S8P Accounting London
333 Bing Changler M S8P G6H Personnel London
333 Bing Changler M S8P K9J InfoTech Toronto
111 Geller Monica F G6H SG7 Safety Department Springy
111 Geller Monica F G6H S8P Accounting London
111 Geller Monica F G6H G6H Personnel London
111 Geller Monica F G6H K9J InfoTech Toronto
20 record(s) selected.
db2 => select location from department
union 
db2 (cont.) => (select projectlocation
from project)
1
----------
Hong Kong
London
Springy
Toronto
4 record(s) selected.
db2 => create view deptlocations as
select distinct location from
department
DB20000I The SQL command completed
successfully.
db2 => select * from deptlocations
LOCATION
----------
London
Springy
Toronto
3 record(s) selected.
db2 => select * from projlocations except (select * from
deptlocations)
1
----------
Hong Kong
1 record(s) selected.
db2 => select * from projlocations union select * from
deptlocations
1
----------
Hong Kong
London
Springy
Toronto
4 record(s) selected.
db2 => select SSN as SIN from
employee
SIN
---------
111
222
245
333
34
5 record(s) selected.
db2 => select * from projlocations intersect
select * from deptlocations
1
----------
London
Springy
Toronto
3 record(s) selected.
db2 => select * from employee where firstname like
'N%'
SSN LASTNAME FIRSTNAME SEX DEPTNO
--------- -------------------- ---------- --- ------
34 Flanders Ned M G6H
1 record(s) selected.
db2 => select count(*) from projemp
1
-----------
6
1 record(s) selected.
db2 => select count(*) as numberpergroup,
projectid from projemp group by projectid
NUMBERPERGROUP PROJECTID
-------------- ---------
2 P13
3 P35
1 P43
3 record(s) selected.
db2 => update employee set firstname = 'Bozo' where
firstname = 'Ned'
DB20000I The SQL command completed successfully.
db2 => select * from employee
SSN LASTNAME FIRSTNAME SEX DEPTNO
--------- -------------------- ---------- --- ------
245 Simpson Homer M SG7
34 Flanders Bozo M G6H
222 Green Rachel F SG7
333 Bing Changler M S8P
111 Geller Monica F G6H
5 record(s) selected.
db2 => delete from employee where lastname like 'G%'
DB20000I The SQL command completed successfully.
db2 => select * from employee
SSN LASTNAME FIRSTNAME SEX DEPTNO
--------- -------------------- ---------- --- ------
245 Simpson Homer M SG7
34 Flanders Bozo M G6H
333 Bing Changler M S8P
3 record(s) selected.
db2 => create table junk (firstattr integer,
secondattr decimal(10,2))
DB20000I The SQL command completed successfully.
db2 => select * from junk
FIRSTATTR SECONDATTR
----------- ------------
0 record(s) selected.
db2 => alter table junk add third varchar(20)
DB20000I The SQL command completed successfully.
db2 => select * from junk
FIRSTATTR SECONDATTR THIRD
----------- ------------ --------------------
0 record(s) selected.
db2 => list tables
Table/View Schema Type Creation time
------------------------------- --------------- ----- --------------------------
DEPARTMENT SYLVIA T 2004-06-21-15.38.51.804343
DEPTLOCATIONS SYLVIA V 2004-06-21-16.05.12.051085
EMPLOYEE SYLVIA T 2004-06-21-15.38.35.567546
JUNK SYLVIA T 2004-06-21-16.26.20.210302
PROJECT SYLVIA T 2004-06-21-15.39.42.940604
PROJEMP SYLVIA T 2004-06-21-15.40.05.233869
PROJLOCATIONS SYLVIA V 2004-06-21-16.06.37.274142
7 record(s) selected.
db2 => drop table junk
DB20000I The SQL command completed successfully.
db2 => list tables
Table/View Schema Type Creation time
------------------------------- --------------- ----- --------------------------
DEPARTMENT SYLVIA T 2004-06-21-15.38.51.804343
DEPTLOCATIONS SYLVIA V 2004-06-21-16.05.12.051085
EMPLOYEE SYLVIA T 2004-06-21-15.38.35.567546
PROJECT SYLVIA T 2004-06-21-15.39.42.940604
PROJEMP SYLVIA T 2004-06-21-15.40.05.233869
PROJLOCATIONS SYLVIA V 2004-06-21-16.06.37.274142
6 record(s) selected.
db2 => terminate
DB20000I The TERMINATE command completed
successfully.
obelix[33]% db2stop
10/01/2009 14:16:06 0 0 SQL1064N
DB2STOP processing was successful.
SQL1064N DB2STOP processing was successful.
ThankYou
www.srinimf.com

More Related Content

What's hot

DB2 for z/OS Architecture in Nutshell
DB2 for z/OS Architecture in NutshellDB2 for z/OS Architecture in Nutshell
DB2 for z/OS Architecture in NutshellCuneyt Goksu
 
DB2 LUW - Backup and Recovery
DB2 LUW - Backup and RecoveryDB2 LUW - Backup and Recovery
DB2 LUW - Backup and Recoveryimranasayed
 
Z OS IBM Utilities
Z OS IBM UtilitiesZ OS IBM Utilities
Z OS IBM Utilitieskapa rohit
 
IBM DB2 LUW UDB DBA Online Training by Etraining.guru
IBM DB2 LUW UDB DBA Online Training by Etraining.guruIBM DB2 LUW UDB DBA Online Training by Etraining.guru
IBM DB2 LUW UDB DBA Online Training by Etraining.guruRavikumar Nandigam
 
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OSPractical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OSCuneyt Goksu
 
DB2 for z/OS and DASD-based Disaster Recovery - Blowing away the myths
DB2 for z/OS and DASD-based Disaster Recovery - Blowing away the mythsDB2 for z/OS and DASD-based Disaster Recovery - Blowing away the myths
DB2 for z/OS and DASD-based Disaster Recovery - Blowing away the mythsFlorence Dubois
 
Oracle RDBMS architecture
Oracle RDBMS architectureOracle RDBMS architecture
Oracle RDBMS architectureMartin Berger
 
JCL MAINFRAMES
JCL MAINFRAMESJCL MAINFRAMES
JCL MAINFRAMESkamaljune
 
Db2 recovery IDUG EMEA 2013
Db2 recovery IDUG EMEA 2013Db2 recovery IDUG EMEA 2013
Db2 recovery IDUG EMEA 2013Dale McInnis
 
DB2 10 & 11 for z/OS System Performance Monitoring and Optimisation
DB2 10 & 11 for z/OS System Performance Monitoring and OptimisationDB2 10 & 11 for z/OS System Performance Monitoring and Optimisation
DB2 10 & 11 for z/OS System Performance Monitoring and OptimisationJohn Campbell
 
Job Control Language
Job Control LanguageJob Control Language
Job Control Languagekapa rohit
 
Presentation db2 best practices for optimal performance
Presentation   db2 best practices for optimal performancePresentation   db2 best practices for optimal performance
Presentation db2 best practices for optimal performancesolarisyougood
 

What's hot (20)

DB2 for z/OS Architecture in Nutshell
DB2 for z/OS Architecture in NutshellDB2 for z/OS Architecture in Nutshell
DB2 for z/OS Architecture in Nutshell
 
DB2 LUW - Backup and Recovery
DB2 LUW - Backup and RecoveryDB2 LUW - Backup and Recovery
DB2 LUW - Backup and Recovery
 
Z OS IBM Utilities
Z OS IBM UtilitiesZ OS IBM Utilities
Z OS IBM Utilities
 
Mainframe interview
Mainframe interviewMainframe interview
Mainframe interview
 
IBM DB2 LUW UDB DBA Online Training by Etraining.guru
IBM DB2 LUW UDB DBA Online Training by Etraining.guruIBM DB2 LUW UDB DBA Online Training by Etraining.guru
IBM DB2 LUW UDB DBA Online Training by Etraining.guru
 
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OSPractical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
 
DB2 on Mainframe
DB2 on MainframeDB2 on Mainframe
DB2 on Mainframe
 
DB2 for z/OS and DASD-based Disaster Recovery - Blowing away the myths
DB2 for z/OS and DASD-based Disaster Recovery - Blowing away the mythsDB2 for z/OS and DASD-based Disaster Recovery - Blowing away the myths
DB2 for z/OS and DASD-based Disaster Recovery - Blowing away the myths
 
DB2UDB_the_Basics
DB2UDB_the_BasicsDB2UDB_the_Basics
DB2UDB_the_Basics
 
Oracle RDBMS architecture
Oracle RDBMS architectureOracle RDBMS architecture
Oracle RDBMS architecture
 
SKILLWISE-DB2 DBA
SKILLWISE-DB2 DBASKILLWISE-DB2 DBA
SKILLWISE-DB2 DBA
 
Tso and ispf
Tso and ispfTso and ispf
Tso and ispf
 
JCL MAINFRAMES
JCL MAINFRAMESJCL MAINFRAMES
JCL MAINFRAMES
 
Db2
Db2Db2
Db2
 
Db2 recovery IDUG EMEA 2013
Db2 recovery IDUG EMEA 2013Db2 recovery IDUG EMEA 2013
Db2 recovery IDUG EMEA 2013
 
DB2 10 & 11 for z/OS System Performance Monitoring and Optimisation
DB2 10 & 11 for z/OS System Performance Monitoring and OptimisationDB2 10 & 11 for z/OS System Performance Monitoring and Optimisation
DB2 10 & 11 for z/OS System Performance Monitoring and Optimisation
 
Job Control Language
Job Control LanguageJob Control Language
Job Control Language
 
Presentation db2 best practices for optimal performance
Presentation   db2 best practices for optimal performancePresentation   db2 best practices for optimal performance
Presentation db2 best practices for optimal performance
 
MVS ABEND CODES
MVS ABEND CODESMVS ABEND CODES
MVS ABEND CODES
 
2 db2 instance creation
2 db2 instance creation2 db2 instance creation
2 db2 instance creation
 

Similar to DB2 Basic Commands - UDB

Database Management System
Database Management SystemDatabase Management System
Database Management SystemHitesh Mohapatra
 
Pontos para criar_instancia_data guard_11g
Pontos para criar_instancia_data guard_11gPontos para criar_instancia_data guard_11g
Pontos para criar_instancia_data guard_11gLeandro Santos
 
OpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developersOpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developersConnor McDonald
 
How to create a pluggable database by cloning an existing local pdb
How to create a pluggable database by cloning an existing local pdbHow to create a pluggable database by cloning an existing local pdb
How to create a pluggable database by cloning an existing local pdbMarco Vigelini
 
Distributed Queries in IDS: New features.
Distributed Queries in IDS: New features.Distributed Queries in IDS: New features.
Distributed Queries in IDS: New features.Keshav Murthy
 
Oracle data guard configuration in 12c
Oracle data guard configuration in 12cOracle data guard configuration in 12c
Oracle data guard configuration in 12cuzzal basak
 
IBM Informix dynamic server 11 10 Cheetah Sql Features
IBM Informix dynamic server 11 10 Cheetah Sql FeaturesIBM Informix dynamic server 11 10 Cheetah Sql Features
IBM Informix dynamic server 11 10 Cheetah Sql FeaturesKeshav Murthy
 
11thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp0111thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp01Karam Abuataya
 
11 Things About11g
11 Things About11g11 Things About11g
11 Things About11gfcamachob
 
SQL WORKSHOP::Lecture 9
SQL WORKSHOP::Lecture 9SQL WORKSHOP::Lecture 9
SQL WORKSHOP::Lecture 9Umair Amjad
 
12c for Developers - Feb 2014
12c for Developers - Feb 201412c for Developers - Feb 2014
12c for Developers - Feb 2014Connor McDonald
 
MDI Training DB2 Course
MDI Training DB2 CourseMDI Training DB2 Course
MDI Training DB2 CourseMarcus Davage
 
UKOUG - 25 years of hints and tips
UKOUG - 25 years of hints and tipsUKOUG - 25 years of hints and tips
UKOUG - 25 years of hints and tipsConnor McDonald
 
Les 11 Fb Queries
Les 11 Fb QueriesLes 11 Fb Queries
Les 11 Fb Queriesvivaankumar
 
Percona xtra db cluster(pxc) non blocking operations, what you need to know t...
Percona xtra db cluster(pxc) non blocking operations, what you need to know t...Percona xtra db cluster(pxc) non blocking operations, what you need to know t...
Percona xtra db cluster(pxc) non blocking operations, what you need to know t...Marco Tusa
 
Connor McDonald 11g for developers
Connor McDonald 11g for developersConnor McDonald 11g for developers
Connor McDonald 11g for developersInSync Conference
 

Similar to DB2 Basic Commands - UDB (20)

Database Management System
Database Management SystemDatabase Management System
Database Management System
 
Pontos para criar_instancia_data guard_11g
Pontos para criar_instancia_data guard_11gPontos para criar_instancia_data guard_11g
Pontos para criar_instancia_data guard_11g
 
Data Purge Algorithm
Data Purge AlgorithmData Purge Algorithm
Data Purge Algorithm
 
OpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developersOpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developers
 
How to create a pluggable database by cloning an existing local pdb
How to create a pluggable database by cloning an existing local pdbHow to create a pluggable database by cloning an existing local pdb
How to create a pluggable database by cloning an existing local pdb
 
Flashback ITOUG
Flashback ITOUGFlashback ITOUG
Flashback ITOUG
 
Distributed Queries in IDS: New features.
Distributed Queries in IDS: New features.Distributed Queries in IDS: New features.
Distributed Queries in IDS: New features.
 
Oracle data guard configuration in 12c
Oracle data guard configuration in 12cOracle data guard configuration in 12c
Oracle data guard configuration in 12c
 
IBM Informix dynamic server 11 10 Cheetah Sql Features
IBM Informix dynamic server 11 10 Cheetah Sql FeaturesIBM Informix dynamic server 11 10 Cheetah Sql Features
IBM Informix dynamic server 11 10 Cheetah Sql Features
 
11thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp0111thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp01
 
11 Things About11g
11 Things About11g11 Things About11g
11 Things About11g
 
SQL WORKSHOP::Lecture 9
SQL WORKSHOP::Lecture 9SQL WORKSHOP::Lecture 9
SQL WORKSHOP::Lecture 9
 
12c for Developers - Feb 2014
12c for Developers - Feb 201412c for Developers - Feb 2014
12c for Developers - Feb 2014
 
MDI Training DB2 Course
MDI Training DB2 CourseMDI Training DB2 Course
MDI Training DB2 Course
 
Dbmsmanual
DbmsmanualDbmsmanual
Dbmsmanual
 
Les09 Manipulating Data
Les09 Manipulating DataLes09 Manipulating Data
Les09 Manipulating Data
 
UKOUG - 25 years of hints and tips
UKOUG - 25 years of hints and tipsUKOUG - 25 years of hints and tips
UKOUG - 25 years of hints and tips
 
Les 11 Fb Queries
Les 11 Fb QueriesLes 11 Fb Queries
Les 11 Fb Queries
 
Percona xtra db cluster(pxc) non blocking operations, what you need to know t...
Percona xtra db cluster(pxc) non blocking operations, what you need to know t...Percona xtra db cluster(pxc) non blocking operations, what you need to know t...
Percona xtra db cluster(pxc) non blocking operations, what you need to know t...
 
Connor McDonald 11g for developers
Connor McDonald 11g for developersConnor McDonald 11g for developers
Connor McDonald 11g for developers
 

More from Srinimf-Slides

software-life-cycle.pptx
software-life-cycle.pptxsoftware-life-cycle.pptx
software-life-cycle.pptxSrinimf-Slides
 
Python Tutorial Questions part-1
Python Tutorial Questions part-1Python Tutorial Questions part-1
Python Tutorial Questions part-1Srinimf-Slides
 
Cics testing and debugging-session 7
Cics testing and debugging-session 7Cics testing and debugging-session 7
Cics testing and debugging-session 7Srinimf-Slides
 
CICS error and exception handling-recovery and restart-session 6
CICS error and exception handling-recovery and restart-session 6CICS error and exception handling-recovery and restart-session 6
CICS error and exception handling-recovery and restart-session 6Srinimf-Slides
 
Cics program, interval and task control commands-session 5
Cics program, interval and task control commands-session 5Cics program, interval and task control commands-session 5
Cics program, interval and task control commands-session 5Srinimf-Slides
 
Cics data access-session 4
Cics data access-session 4Cics data access-session 4
Cics data access-session 4Srinimf-Slides
 
CICS basic mapping support - session 3
CICS basic mapping support - session 3CICS basic mapping support - session 3
CICS basic mapping support - session 3Srinimf-Slides
 
Cics application programming - session 2
Cics   application programming - session 2Cics   application programming - session 2
Cics application programming - session 2Srinimf-Slides
 
CICS basics overview session-1
CICS basics overview session-1CICS basics overview session-1
CICS basics overview session-1Srinimf-Slides
 
The best Teradata RDBMS introduction a quick refresher
The best Teradata RDBMS introduction a quick refresherThe best Teradata RDBMS introduction a quick refresher
The best Teradata RDBMS introduction a quick refresherSrinimf-Slides
 
The best ETL questions in a nut shell
The best ETL questions in a nut shellThe best ETL questions in a nut shell
The best ETL questions in a nut shellSrinimf-Slides
 
IMS DC Self Study Complete Tutorial
IMS DC Self Study Complete TutorialIMS DC Self Study Complete Tutorial
IMS DC Self Study Complete TutorialSrinimf-Slides
 
How To Master PACBASE For Mainframe In Only Seven Days
How To Master PACBASE For Mainframe In Only Seven DaysHow To Master PACBASE For Mainframe In Only Seven Days
How To Master PACBASE For Mainframe In Only Seven DaysSrinimf-Slides
 
Assembler Language Tutorial for Mainframe Programmers
Assembler Language Tutorial for Mainframe ProgrammersAssembler Language Tutorial for Mainframe Programmers
Assembler Language Tutorial for Mainframe ProgrammersSrinimf-Slides
 
The Easytrieve Presention by Srinimf
The Easytrieve Presention by SrinimfThe Easytrieve Presention by Srinimf
The Easytrieve Presention by SrinimfSrinimf-Slides
 
Writing command macro in stratus cobol
Writing command macro in stratus cobolWriting command macro in stratus cobol
Writing command macro in stratus cobolSrinimf-Slides
 
PLI Presentation for Mainframe Programmers
PLI Presentation for Mainframe ProgrammersPLI Presentation for Mainframe Programmers
PLI Presentation for Mainframe ProgrammersSrinimf-Slides
 
PL/SQL Interview Questions
PL/SQL Interview QuestionsPL/SQL Interview Questions
PL/SQL Interview QuestionsSrinimf-Slides
 

More from Srinimf-Slides (20)

software-life-cycle.pptx
software-life-cycle.pptxsoftware-life-cycle.pptx
software-life-cycle.pptx
 
Python Tutorial Questions part-1
Python Tutorial Questions part-1Python Tutorial Questions part-1
Python Tutorial Questions part-1
 
Cics testing and debugging-session 7
Cics testing and debugging-session 7Cics testing and debugging-session 7
Cics testing and debugging-session 7
 
CICS error and exception handling-recovery and restart-session 6
CICS error and exception handling-recovery and restart-session 6CICS error and exception handling-recovery and restart-session 6
CICS error and exception handling-recovery and restart-session 6
 
Cics program, interval and task control commands-session 5
Cics program, interval and task control commands-session 5Cics program, interval and task control commands-session 5
Cics program, interval and task control commands-session 5
 
Cics data access-session 4
Cics data access-session 4Cics data access-session 4
Cics data access-session 4
 
CICS basic mapping support - session 3
CICS basic mapping support - session 3CICS basic mapping support - session 3
CICS basic mapping support - session 3
 
Cics application programming - session 2
Cics   application programming - session 2Cics   application programming - session 2
Cics application programming - session 2
 
CICS basics overview session-1
CICS basics overview session-1CICS basics overview session-1
CICS basics overview session-1
 
100 sql queries
100 sql queries100 sql queries
100 sql queries
 
The best Teradata RDBMS introduction a quick refresher
The best Teradata RDBMS introduction a quick refresherThe best Teradata RDBMS introduction a quick refresher
The best Teradata RDBMS introduction a quick refresher
 
The best ETL questions in a nut shell
The best ETL questions in a nut shellThe best ETL questions in a nut shell
The best ETL questions in a nut shell
 
IMS DC Self Study Complete Tutorial
IMS DC Self Study Complete TutorialIMS DC Self Study Complete Tutorial
IMS DC Self Study Complete Tutorial
 
How To Master PACBASE For Mainframe In Only Seven Days
How To Master PACBASE For Mainframe In Only Seven DaysHow To Master PACBASE For Mainframe In Only Seven Days
How To Master PACBASE For Mainframe In Only Seven Days
 
Assembler Language Tutorial for Mainframe Programmers
Assembler Language Tutorial for Mainframe ProgrammersAssembler Language Tutorial for Mainframe Programmers
Assembler Language Tutorial for Mainframe Programmers
 
The Easytrieve Presention by Srinimf
The Easytrieve Presention by SrinimfThe Easytrieve Presention by Srinimf
The Easytrieve Presention by Srinimf
 
Writing command macro in stratus cobol
Writing command macro in stratus cobolWriting command macro in stratus cobol
Writing command macro in stratus cobol
 
PLI Presentation for Mainframe Programmers
PLI Presentation for Mainframe ProgrammersPLI Presentation for Mainframe Programmers
PLI Presentation for Mainframe Programmers
 
PL/SQL Interview Questions
PL/SQL Interview QuestionsPL/SQL Interview Questions
PL/SQL Interview Questions
 
Macro teradata
Macro teradataMacro teradata
Macro teradata
 

Recently uploaded

Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 

Recently uploaded (20)

Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 

DB2 Basic Commands - UDB

  • 2.  to start type db2start  To stop db2stop
  • 3.  db2 => connect to sample  db2 => bind sample.bnd Help command: Db2 => ? Db2 => ? CATALOG DATABASE - It gives more info on particular command Quit Commnad: Db2 => quit
  • 4. db2 => db2start This takes some time (maybe 30 seconds) DB20000I The DB2START command completed successfully. db2 => ? ACTIVATE DATABASE GET CONTACTGROUPS RECONCILE ADD CONTACT GET CONTACTS RECOVER ADD CONTACTGROUP GET/UPDATE DB CFG REDISTRIBUTE DB PARTITION ADD DATALINKS MANAGER GET/UPDATE DBM CFG REFRESH LDAP ADD DBPARTITIONNUM GET DBM MONITOR SWITCHES REGISTER LDAP ADD XMLSCHEMA GET DESCRIPTION FOR HEALTH REGISTER XMLSCHEMA ARCHIVE LOG GET NOTIFICATION LIST REGISTER XSROBJECT ATTACH GET HEALTH SNAPSHOT REORG INDEXES/TABLE AUTOCONFIGURE GET INSTANCE REORGCHK BACKUP DATABASE GET MONITOR SWITCHES RESET ADMIN CFG BIND GET RECOMMENDATIONS RESET ALERT CFG CATALOG APPC NODE GET ROUTINE RESET DB CFG CATALOG APPN NODE GET SNAPSHOT RESET DBM CFG CATALOG DATABASE HELP RESET MONITOR CATALOG DCS DATABASE HISTORY RESTART DATABASE CATALOG LDAP DATABASE IMPORT RESTORE DATABASE CATALOG LDAP NODE INITIALIZE TAPE REWIND TAPE CATALOG LOCAL NODE INSPECT ROLLFORWARD DATABASE CATALOG NPIPE NODE LIST ACTIVE DATABASES RUNCMD CATALOG NETBIOS NODE LIST APPLICATIONS RUNSTATS CATALOG ODBC DATA SOURCE LIST COMMAND OPTIONS SET CLIENT CATALOG TCPIP NODE LIST DATABASE DIRECTORY SET RUNTIME DEGREE CHANGE DATABASE COMMENT LIST DB PARTITION GROUPS SET TABLESPACE CONTAINERS CHANGE ISOLATION LEVEL LIST DATALINKS MANAGERS SET TAPE POSITION COMPLETE XMLSCHEMA LIST DBPARTITIONNUMS SET UTIL_IMPACT_PRIORITY CREATE DATABASE LIST DCS APPLICATIONS SET WRITE
  • 5.  CREATE TOOLS CATALOG LIST DCS DIRECTORY START DATABASE MANAGER  DEACTIVATE DATABASE LIST DRDA INDOUBT START HADR  DECOMPOSE XML DOCUMENT LIST HISTORY STOP DATABASE MANAGER  DECOMPOSE XML DOCUMENTS LIST INDOUBT TRANSACTIONS STOP HADR  DEREGISTER LIST NODE DIRECTORY TAKEOVER HADR  DESCRIBE LIST ODBC DATA SOURCES TERMINATE  DETACH LIST PACKAGES/TABLES UNCATALOG DATABASE  DROP CONTACT LIST TABLESPACE CONTAINERS UNCATALOG DCS DATABASE  DROP CONTACTGROUP LIST TABLESPACES UNCATALOG LDAP DATABASE  DROP DATABASE LIST UTILITIES UNCATALOG LDAP NODE  DROP DATALINKS MANAGER LOAD UNCATALOG NODE  DROP DBPARTITIONNUM LOAD QUERY UNCATALOG ODBC DATA  DROP TOOLS CATALOG MIGRATE DATABASE UNQUIESCE DATABASE  ECHO PING UNQUIESCE INSTANCE  EDIT PREP/PRECOMPILE UPDATE ALERT CFG  EXPORT PRUNE HISTORY/LOGFILE UPDATE COMMAND OPTIONS  FORCE APPLICATION PUT ROUTINE UPDATE CONTACT  GET/UPDATE ADMIN CFG QUERY CLIENT UPDATE CONTACTGROUP  GET ALERT CFG QUIESCE DATABASE UPDATE NOTIFICATION LIST  GET AUTHORIZATIONS QUIESCE INSTANCE UPDATE HISTORY  GET/UPDATE CLI CFG QUIESCE TABLESPACES UPDATE LDAP NODE  GET CONNECTION STATE QUIT UPDATE MONITOR SWITCHES  GET CONTACTGROUP REBIND XQUERY  Note: Some commands are operating system specific and may not be available.  For further help:  ? db2-command - help for specified command  ? OPTIONS - help for all command options  ? HELP - help for reading help screens  The preceding three options can be run as db2 <option> from an OS prompt.  !db2ic - DB2 Information Center (Windows only)  This command can also be run as db2ic from an OS prompt.
  • 6.  db2 => create database slo  DB20000I The CREATE DATABASE command completed successfully.  db2 => connect to slo  Database Connection Information  Database server = DB2/SUN64 9.7.0  SQL authorization ID = DB90 <- my db2 account  Local database alias = SLO
  • 7. db2 => create table EMPLOYEE db2 (cont.) => (SSN varchar(9) not null, db2 (cont.) => LastNam db2 (cont.) => e varchar(20), db2 (cont.) => Firs db2 (cont.) => tName varchar(10), db2 (cont.) => Sex varchar(1), db2 (cont.) => DeptNo char(3), db2 (cont.) => primary key(SSN)) DB20000I The SQL command completed successfully.
  • 8.  db2 => insert into DEPARTMENT values('SG7','Safety Department','Springy') DB20000I The SQL command completed successfully.
  • 9.  db2 => select LastName, DeptName from Employee as e, Department as d db2 (cont.) => where e.deptno = d.deptno LASTNAME DEPTNAME -------------------- -------------------- Simpson Safety Department Green Safety Department Bing Accounting Flanders Personnel Geller Personnel 5 record(s) selected.
  • 10. db2 => select Lastname, projectname db2 (cont.) => from employee e, department d, project p db2 (cont.) => where e.deptno = d.deptno and d.deptno = p.deptno LASTNAME PROJECTNAME -------------------- -------------------- Simpson New Pay Green New Pay Flanders GetThings Geller GetThings Simpson Alpha Green Alpha Simpson Omega Green Omega Bing Delta Simpson Pi Green Pi 11 record(s) selected.
  • 11. db2 => select lastname from employee as e, department as d db2 (cont.) => where e.deptno = d.deptno and deptname = 'Safety Department' (line wrapped by powerpoint) LASTNAME -------------------- Simpson Green 2 record(s) selected. db2 => select lastname from employee where deptno in db2 (cont.) => (select deptno from department db2 (cont.) => where deptname = 'Safety Department') LASTNAME -------------------- Simpson Green 2 record(s) selected.
  • 12. db2 => select * from employee, department SSN LASTNAME FIRSTNAME SEX DEPTNO DEPTNO DEPTNAME LOCATION --------- -------------------- ---------- --- ------ ------ -------------------- ---------- 245 Simpson Homer M SG7 SG7 Safety Department Springy 245 Simpson Homer M SG7 S8P Accounting London 245 Simpson Homer M SG7 G6H Personnel London 245 Simpson Homer M SG7 K9J InfoTech Toronto 34 Flanders Ned M G6H SG7 Safety Department Springy 34 Flanders Ned M G6H S8P Accounting London 34 Flanders Ned M G6H G6H Personnel London 34 Flanders Ned M G6H K9J InfoTech Toronto 222 Green Rachel F SG7 SG7 Safety Department Springy 222 Green Rachel F SG7 S8P Accounting London 222 Green Rachel F SG7 G6H Personnel London 222 Green Rachel F SG7 K9J InfoTech Toronto 333 Bing Changler M S8P SG7 Safety Department Springy 333 Bing Changler M S8P S8P Accounting London 333 Bing Changler M S8P G6H Personnel London 333 Bing Changler M S8P K9J InfoTech Toronto 111 Geller Monica F G6H SG7 Safety Department Springy 111 Geller Monica F G6H S8P Accounting London 111 Geller Monica F G6H G6H Personnel London 111 Geller Monica F G6H K9J InfoTech Toronto 20 record(s) selected.
  • 13. db2 => select location from department union db2 (cont.) => (select projectlocation from project) 1 ---------- Hong Kong London Springy Toronto 4 record(s) selected.
  • 14. db2 => create view deptlocations as select distinct location from department DB20000I The SQL command completed successfully. db2 => select * from deptlocations LOCATION ---------- London Springy Toronto 3 record(s) selected.
  • 15. db2 => select * from projlocations except (select * from deptlocations) 1 ---------- Hong Kong 1 record(s) selected. db2 => select * from projlocations union select * from deptlocations 1 ---------- Hong Kong London Springy Toronto 4 record(s) selected.
  • 16. db2 => select SSN as SIN from employee SIN --------- 111 222 245 333 34 5 record(s) selected.
  • 17. db2 => select * from projlocations intersect select * from deptlocations 1 ---------- London Springy Toronto 3 record(s) selected.
  • 18. db2 => select * from employee where firstname like 'N%' SSN LASTNAME FIRSTNAME SEX DEPTNO --------- -------------------- ---------- --- ------ 34 Flanders Ned M G6H 1 record(s) selected.
  • 19. db2 => select count(*) from projemp 1 ----------- 6 1 record(s) selected.
  • 20. db2 => select count(*) as numberpergroup, projectid from projemp group by projectid NUMBERPERGROUP PROJECTID -------------- --------- 2 P13 3 P35 1 P43 3 record(s) selected.
  • 21. db2 => update employee set firstname = 'Bozo' where firstname = 'Ned' DB20000I The SQL command completed successfully. db2 => select * from employee SSN LASTNAME FIRSTNAME SEX DEPTNO --------- -------------------- ---------- --- ------ 245 Simpson Homer M SG7 34 Flanders Bozo M G6H 222 Green Rachel F SG7 333 Bing Changler M S8P 111 Geller Monica F G6H 5 record(s) selected.
  • 22. db2 => delete from employee where lastname like 'G%' DB20000I The SQL command completed successfully. db2 => select * from employee SSN LASTNAME FIRSTNAME SEX DEPTNO --------- -------------------- ---------- --- ------ 245 Simpson Homer M SG7 34 Flanders Bozo M G6H 333 Bing Changler M S8P 3 record(s) selected.
  • 23. db2 => create table junk (firstattr integer, secondattr decimal(10,2)) DB20000I The SQL command completed successfully. db2 => select * from junk FIRSTATTR SECONDATTR ----------- ------------ 0 record(s) selected. db2 => alter table junk add third varchar(20) DB20000I The SQL command completed successfully. db2 => select * from junk FIRSTATTR SECONDATTR THIRD ----------- ------------ -------------------- 0 record(s) selected.
  • 24. db2 => list tables Table/View Schema Type Creation time ------------------------------- --------------- ----- -------------------------- DEPARTMENT SYLVIA T 2004-06-21-15.38.51.804343 DEPTLOCATIONS SYLVIA V 2004-06-21-16.05.12.051085 EMPLOYEE SYLVIA T 2004-06-21-15.38.35.567546 JUNK SYLVIA T 2004-06-21-16.26.20.210302 PROJECT SYLVIA T 2004-06-21-15.39.42.940604 PROJEMP SYLVIA T 2004-06-21-15.40.05.233869 PROJLOCATIONS SYLVIA V 2004-06-21-16.06.37.274142 7 record(s) selected. db2 => drop table junk DB20000I The SQL command completed successfully. db2 => list tables Table/View Schema Type Creation time ------------------------------- --------------- ----- -------------------------- DEPARTMENT SYLVIA T 2004-06-21-15.38.51.804343 DEPTLOCATIONS SYLVIA V 2004-06-21-16.05.12.051085 EMPLOYEE SYLVIA T 2004-06-21-15.38.35.567546 PROJECT SYLVIA T 2004-06-21-15.39.42.940604 PROJEMP SYLVIA T 2004-06-21-15.40.05.233869 PROJLOCATIONS SYLVIA V 2004-06-21-16.06.37.274142 6 record(s) selected.
  • 25. db2 => terminate DB20000I The TERMINATE command completed successfully. obelix[33]% db2stop 10/01/2009 14:16:06 0 0 SQL1064N DB2STOP processing was successful. SQL1064N DB2STOP processing was successful.