Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sql query to compress a data field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
sumit agarwalla

New User


Joined: 13 Nov 2008
Posts: 17
Location: hyderabad

PostPosted: Tue Dec 30, 2008 9:53 am    Post subject: Sql query to compress a data field
Reply with quote

I have to create a table in which one of the fields is CITY of datatype CHAR(15).....and I have to use some sort of compressing the alphabetic field CITY ......how do I compress the field while creating it...please help me on this?
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Dec 30, 2008 11:39 pm    Post subject:
Reply with quote

Hello,

Quote:
I have to use some sort of compressing the alphabetic field CITY
You have received no replies because you have not posted anything for people to use to help you. . .

You need to define what you mean by "compress" and what the compression rules are for this requirement.

Post a variety of city names as they "are" and how you want them to be compressed.
Back to top
View user's profile Send private message
sumit agarwalla

New User


Joined: 13 Nov 2008
Posts: 17
Location: hyderabad

PostPosted: Wed Dec 31, 2008 11:55 am    Post subject:
Reply with quote

ok...i will explain what i require....
I need to create an employee table named "EMPLOYEEDET" with the following characteristics

Code:

COLUMNNAME       DATATYPE     LENGTH            REMARKS
dept_id              numeric       4         foreign key which refers the
                                                      corresponding column in the
                                                      parent table "DEPARTMENT"
emp_no               numeric       4         primary key
firstname            alphabetic    15
lastname             alphabetic    15
city                 alphabetic    15        use some sort of compressing the
                                                      alphabetic field city
gender               alphabetic    1         gender should be M or F.it should not
                                                     allow to enter any other character
                                                     other than M and F
age                  NUmeric        4
salary               numeric        integer:8
                                    decimal:2
doj                   date             10
now i just have to create the table with following remarks being followed but i am not able to understand the remark of the city field. what does it mean?
what i did next to go forward was first i created the table with city fields datatype as CHAR and later on altered the table by changing the datatype from CHAR TO VARCHAR which I think will occupy less space then CHAR.Suggest me if I am wrong.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Wed Dec 31, 2008 4:28 pm    Post subject:
Reply with quote

Sumit,

My suggestion can be, create a table called CITY containing city_code CHAR(4) & city_nameCHAR(30). In this table use city_code CHAR(4).

CHAR TO VARCHAR : Depends on the REQUIREMENT.

Sushanth
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Dec 31, 2008 10:25 pm    Post subject:
Reply with quote

Hello,

Quote:
use some sort of compressing the
alphabetic field city
Basically - nonsense. . . icon_confused.gif "Some sort of compressing" is incredibly poor direction.
Quote:
later on altered the table by changing the datatype from CHAR TO VARCHAR which I think will occupy less space then CHAR.
A small amount of space might be saved, but keep in mind it would be a small amount.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
This topic is locked: you cannot edit posts or make replies. MQ setup query mohitsaini Java & MQSeries 4 Sun Jan 08, 2017 1:53 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us