Db2 survival guide DB Survival Guide DB Environment Basics Creating a Database and Tables v v Topic Create a Database Description Using Command Line Processor to Create a Database o Start Programs IBM DB Command Line Processor o db create database Ex crea
DB Survival Guide DB Environment Basics Creating a Database and Tables v v Topic Create a Database Description Using Command Line Processor to Create a Database o Start Programs IBM DB Command Line Processor o db create database Ex create database test o db quit Using Command Center to Create a Database o Start Programs IBM DB Command Center o Click on the Interactive tab o type create database LS o Click on the Gears icon Wait for the message CREATE DATABASE command completed successfully Using Control Center to Create a Database o Start Program Files DB for Win NT Control Center o Now that you are in Control Center click down the tree by choosing Instances DB Databases o Right click then click on Create Database using Smart Guide You can choose the defaults from there o Some ?elds you'll need to ?ll out ? New Database Name only characters ? Alias can leave blank ? Comment - anything you want ? Other Screens ? You can accept all of the defaults by just clicking on Next or Finish Create a Table in a Database Create a system user which will be used to logon to the database it's tables Now login as that user Now when you create the TABLE it will assign the user name as the SCHEMA name If you don't specify the schema DB will use the name of the user as the SCHEMA pre ?x to the table name Ex THOMASMA TEST - Using Command Line Processor to Create a Table o create table test rest of SQL code Using Control Center to Create a Database o Start Program Files DB for Win NT Control Center o Now that you are in Control Center click down the tree by Cchoosing Instances DB Databases Then click on the Database name o Right click and choose Create using Wizard You can choose the defaults from there o Some ?elds you'll need to ?ll out ? Table schema leave blank to default to the UserID you are logged in as ? Table name characters ? Next create the ?elds primary key etc o SQL example ? connect to SAMPLE ? create table TEST USERID character not null FIRST character LAST character primary key USERID ? Example SQL Code drop table test create table TEST USERID character not null FIRST character LAST character primary key USERID insert into Test userid ?rst last values ' ' 'Michael' 'Thomas' insert into Test userid ?rst last values ' ' 'Adam' 'Thomas' insert into Test userid ?rst last values ' ' 'Stephen' 'Thomas' insert into Test userid ?rst last values ' ' 'Jane' 'Doe' insert into Test userid ?rst last values ' ' 'John' 'Doe' select userid ?rst last concat ?rst concat ' ' last from Test with UR drop view vtest CREATE VIEW vtest userid ?rst last fullname AS select userid ?rst last concat ?rst concat ' ' last from Test CUsing DB Command Center Launch Start Programs IBM DB Command
Documents similaires










-
30
-
0
-
0
Licence et utilisation
Gratuit pour un usage personnel Aucune attribution requise- Détails
- Publié le Dec 23, 2021
- Catégorie Industry / Industr...
- Langue French
- Taille du fichier 67.9kB