Extracting differences between two columns dataset (SQL command)


 
Thread Tools Search this Thread
Top Forums Programming Extracting differences between two columns dataset (SQL command)
# 1  
Old 09-30-2008
Extracting differences between two columns dataset (SQL command)

Hi,

I have a table in my sqlite, here is an example (tab separated)

Code:
585     name1 chr1    +       1872    3533    3533    3533    6       1872,2041,2475,2837,3083,3315,  1920,2090,2560,2915,3237,3533,  name2

The 10th and 11th columns have information in a comma separated format (not tab).

Code:
1872,2041,2475,2837,3083,3315,  1920,2090,2560,2915,3237,3533,

.

I want to know if there's a sql command I can use to find the difference between the first value of column 10 and the first value in column 11, and the same for the second column, etc.?

for example
1920-1872
2090-2041
2560-2475
.
.
.
3533-3315

Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Selecting random columns from large dataset in UNIX

Dear folks I have a large data set which contains 400K columns. I decide to select 50K determined columns from the whole 400K columns. Is there any command in unix which could do this process for me? I need to also mention that I store all of the columns id in one file which may help to select... (5 Replies)
Discussion started by: sajmar
5 Replies

2. Shell Programming and Scripting

Need UNIX command to create a empty dataset

Hi all, Is Der any unix command which will create a empty dataset ..?(in .ds ).I know we can use orchadmin dump command to view dataset data.. but how to create a dataset..? like sampledataset.ds thanks in advance hemanthsaikumar (1 Reply)
Discussion started by: hemanthsaikumar
1 Replies

3. Shell Programming and Scripting

Request: How to Parse dynamic SQL query to pad extra columns to match the fixed number of columns

Hello All, I have a requirement in which i will be given a sql query as input in a file with dynamic number of columns. For example some times i will get 5 columns, some times 8 columns etc up to 20 columns. So my requirement is to generate a output query which will have 20 columns all the... (7 Replies)
Discussion started by: vikas_trl
7 Replies

4. UNIX for Dummies Questions & Answers

Extracting combined differences based on a single column

Dear All, I have two sets of files. File 1 can be any number between 1 and 20 followed by a frequency of that number in a give documents... the lines in the file will be dependent to the analysed document. e.g. file1 1,5 4,1 then I have file two which is basicall same numbers but with... (2 Replies)
Discussion started by: A-V
2 Replies

5. Shell Programming and Scripting

Extracting data from SQL using a variable from a file

Though, its not new, I am a newbie to shell scripting. Please help me with the below. There are two steps. First one is to read a table and create a file with the distinct values. I am able to get this done. Second step is to read the file (which has the single value, like a number) and... (1 Reply)
Discussion started by: singas1
1 Replies

6. Solaris

flarecreate for zfs root dataset and ignore multiple dataset

Hi All, I want to write a script to create flar images on multiple servers. In non zfs filesystem I am using -X option to refer a file to exclude mounts on different servers. but on ZFS -X option is not working. I want multiple mounts to be ignore on ZFS base system during flarecreate. I... (0 Replies)
Discussion started by: uxravi
0 Replies

7. Shell Programming and Scripting

Extracting only a few columns!!!?

Hi All, I have a text file which looks like below. ################################################ Name:xxxxxxx Version:1.0 Class: 2 City : Bangalore Component Part Action Nb New Part Naming Part Name 12345 default 12345.12345 Bad 23456 ... (6 Replies)
Discussion started by: smarty86
6 Replies

8. UNIX for Dummies Questions & Answers

Using 'sed' to delete or ignore columns in a dataset

Hi, I want to know if its possible to delete or ignore columns in a large dataset using 'sed'. For example, I have the following dataset: - 20060714,X.XX,1,043004,Q,T,24.0000,1,25.5000,4, 20060714,X.XX,1,081209,Q,T,24.0000,1,25.5000,5, As you can see, there are 10 columns here and the... (4 Replies)
Discussion started by: aarif
4 Replies

9. Shell Programming and Scripting

Need help in extracting columns

Hi , I have a file having around 8 columns spereated by space . Now that I need to extract columns from this. The problem is this functionality is needed in a script and the required columns are dynamic and can range from 2 columns to 8 columns at a time . What I tried without luck is ... (6 Replies)
Discussion started by: praveenbvarrier
6 Replies

10. UNIX for Dummies Questions & Answers

Using 'sed' to delete or ignore columns in a dataset

Hi, I've already posted elsewhere but am posting again here coz im a newbie. I hope you forgive me this time. I want to know if its possible to delete or ignore columns in a large dataset using 'sed'. For example, I have the following dataset: - ... (0 Replies)
Discussion started by: aarif
0 Replies
Login or Register to Ask a Question
isql(1) 						       UnixODBC manual pages							   isql(1)

NAME
isql, iusql - unixODBC command-line interactive SQL tool SYNOPSIS
isql DSN [USER [PASSWORD]] [options] DESCRIPTION
isql is a command line tool which allows the user to execute SQL in batch or interactively. It has some interesting options such as an option to generate output wrapped in an HTML table. iusql is the same tool with built-in Unicode support. ARGUMENTS
DSN The Data Source Name, which should be used to make connection to the database. The data source is looked for in the /etc/odbc.ini and $HOME/.odbc.ini files in that order, with the latter overwriting the former. USER Specifies the database user/role under which the connection should be made. PASSWORD Password for the specified USER. OPTIONS
-b Run isql in non-interactive batch mode. In this mode, the isql processes its standard input, expecting one SQL command per line. -dDELIMITER Delimits columns with delimiter. -xHEX Delimits columns with HEX, which is a hexadecimal code of the delimiting character in the format 0xNN - i.e. 0x09 for the TAB char- acter. -w Format the result as HTML table. -c Output the names of the columns on the first row. Has any effect only with the -d or -x options. -mNUM Limit the column display width to NUM characters. -lLOCALE Sets locale to LOCALE. -q Wrap the character fields in double quotes. -3 Use the ODBC 3 calls. -n Use the newline processing. -e Use the SQLExecDirect instead of Prepare. -k Use SQLDriverConnect. -v Turn on the verbose mode, where the errors are fully described. Useful for debugging. --version Prints the program version and exits. COMMANDS
This section briefly describes some isql runtime commands. help List all tables in the database. help table List all columns in the table. help help List all help options. EXAMPLES
$ isql WebDB MyID MyPWD -w -b < My.sql Connects to the WebDB as user MyID with password MyPWD, then execute the commands in the My.sql file and returns the results wrapped in HTML table. Each line in My.sql must contain exactly 1 SQL command, except for the last line, which must be blank (unless the -n option is specified). FILES
/etc/odbc.ini System-wide DSN definitions. See odbc.ini(5) for details. $HOME/.odbc.ini User-specific DSN definitions. See odbc.ini(5) for details. SEE ALSO
odbcinst(1), odbc.ini(5) AUTHORS
The authors of unixODBC are Peter Harvey <pharvey@codebydesign.com> and Nick Gorham <nick@easysoft.com>. For the full list of contributors see the AUTHORS file. COPYRIGHT
unixODBC is licensed under the GNU Lesser General Public License. For details about the license, see the COPYING file. version 2.3.1 Tue 25 Jun 2013 isql(1)