I am going through a tutorial on how to use DB2 which is in a linux environment.
I am supposed to connect to a database, create a table, insert some data under db2 shell:
db2 connect to c3421m
db2
db2 => update command options using z ON Assignment_0.txt
db2 => update command options using v ON
db2 => CREATE TABLE BAND_2015 // gives error I got stuck here
// here is where I get stuck i am supposed to create a table and execute the follwing command under DB2 shell: CREATE TABLE BAND_2015
Code given:
create table band_2015 ( \
band_no integer not null primary key, \
band_name varchar(25) not null, \
band_home varchar(25) not null, \
band_type varchar(10) check (band_type in (‘concert’,’rock’,’jazz’,’military’)), \
b_start_date date not null, \
band_contact varchar(10) not null )
So how do I create this table? I was told to copy it to a text editor(do i save it as band_2015.sql ?). I am completely new to this but i have a lot of experience in other programming languages...
The problem is the terminating character. By default in the carriage return (enter). However, for your tutorial, you should type multi-line commands. For this case, you change the terminator character by defining another
For semi-colon
db2 -t
select *
from table;
For at sign or any other character.
db2 -td@
select *
from table @
For no character:
db2
select * from table
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With