I am working with Transbase DB and stuck on selection of specific range of rows. In MySQL I can do it as folows:
SELECT * FROM table LIMIT 2,3;
I know about FIRST() in Transbase, but how about OFFSET?
Thank you very much in advance.
just delete offset and it'll work.
Related
I am not sure how to explain it in words but having a look at the table will make it clear.
screen shot of Data from excel
To auto count try-
=LET(x,UNIQUE(A1:A16),y,COUNTIF(A1:A16,x),CHOOSE({1,2},x,y))
For auto sum-
=LET(x,UNIQUE(A1:A16),y,SUMIF(A1:A16,x,B1:B16),CHOOSE({1,2},x,y))
This is my DB,
its got too many missing cases for me to do it manually, and I can not use flash fill in this case,
so I want to randomlly fill these case with a specific set of strings :"TCS", "TCLSH","TCEO", and "TCT"
how can I do it in excell please help and thanks a lot in advance
You can do this in a separate column using index with randbetween (per screenshot / this sheet) as follows:
=IF(B3="",INDEX($H$3:$H$6,RANDBETWEEN(1,COUNTA($H$3:$H$6))),B3)
I need some help. I rarely use IF statements in excel, I usually do Index Matches, VLookups etc. So when I came across this, I thought I could come here for some help.
I want to have an IF statement that returns 5 values.
In the picture attached, you'll see 5 levels.
If the value is less than or 0 then 5.
If the value is 0.01 - 5.99 then 4.
If the value is 6 - 12.99 then 3.
If the value is 13 - 29.99 then 2.
If the value is 30 or more then 1.
If anyone can help mem with this, that would be amazing!
Thank You!
It seems to me that this is what you need:
=IF(A8<=0,5,VLOOKUP(A8,$A$1:$B$4,2,TRUE))
I would just go with a vlookup like so:
=vlookup(D2,A4:B8,2,1)
If you are looking for a nested if formula and using the data set shown in the image of your question, then this will work:
=IF(A8=B1,A1,IF(OR(A8=B2,A8<=C2),A2,IF(OR(A8=B3,A8<=C3),A3,IF(OR(A8=B4,A8<=C4),A4,IF(A8=B5,A5,"Out of Range")))))
In this formula, I have used cell A8 as the reference value.
If you do not want to change the direction of your data, then using a nested if statement like the below should work:
If you do not want to use the lookup table, then will be easier to use the LOOKUP function with constants:
=LOOKUP(A1,{0,0.01,6,13,30},{5,4,3,2,1})
Please Help me to Get Matched Values From Table 1 to Table 2 based on formula's
The table to needs to be filled by ref values based on the associate marked attendance.
I have tried V lookup() and Match() Nothing worked out.
Sorry ! Guys ! Self Found an Answer Just Now. I used it earlier but forgot it.
Just Now Remembered again.
The Value can be Get Through Countif() Function. and It it's HD Then Countif()*.5
If anyone know's other methods please post here so that will get some
idea's in easier way
I am working on an app that involves evaluating modifications made to vehicles, and does some number crunching from figures stored in an Oracle 10g database. Unfortunately, I only have a text data in the database, yet I need to work with numbers and not text. I would like to know if anyone could help me with understanding how to perform string operations on VARCHAR2 column data in an Oracle 10g database with PLSQL:
For example: I need to take a VARCHAR2 column named TOP_SPEED in a table named CARS, parse the text data in its column to break it up into two new values, and insert these new values into two new NUMBER type columns in the CARS table, TOP_SPEED_KMH and TOP_SPEED_MPH.
The data in the TOP_SPEED column is as such: eg. "153 km/h (94.62 mph)"
I want to save the value of 153.00 into the TOP_SPEED_KMH column, and the 94.62 value into TOP_SPEED_MPH column.
I think what I have to do in a query/script is this:
select the text data in TOP_SPEED into a local text variable
modify the local text variable and save the new values into two number variables
write back the two number variables to the corresponding TOP_SPEED_KMH and TOP_SPEED_MPH columns
Could someone please confirm that I am on the right track? I would also really appreciate any example code if anyone has the time.
Cheers
I think it's a better idea to just have the top_speed_kmh column, and get rid of the mph one. As the number of kms in a mile never changes, you can simply multiply by 0.6 to convert to miles. So you can do the same update statement as N West suggested without the mph column:
UPDATE CARS SET TOP_SPEED_KMH = TO_NUMBER(SUBSTR(1, (INSTR(UPPER(TOP_SPEED), "KM/H") -1)));
And whenever you need the mph speed, just do
Select top_speed_kmh*0.6 as top_speed_mph from cars;
For the parsing bit, you would probably use either REGEXP_SUBSTR or INSTR with SUBSTR
Then use TO_NUMBER to convert to number
You can either create a PL/SQL function for each parsing, returning the number value, and run an UPDATE query on the fields, or you could create a PL/SQL procedure with a cursor looping over all the data that is to be updated.
Here are som links for some of the built-ins:
http://psoug.org/reference/substr_instr.html
http://download.oracle.com/docs/cd/B14117_01/server.101/b10759/functions116.htm
You probably don't even need to do this with PL/SQL at all.
As long as the data in the column is consistent "99.99 km/h (99.99 m/h)" you could do this directly with SQL:
UPDATE CARS
SET TOP_SPEED_KMH = TO_NUMBER(SUBSTR(1, (INSTR(UPPER(TOP_SPEED), "KM/H") - 1))),
TOP_SPEED_MPH = <similar substr/instr combination to pull the 99.99 mph out of code>;
Set-operations are typically much faster than procedural operations.
I am working on an app that involves
evaluating modifications made to
vehicles, and does some number
crunching from figures stored in an
Oracle 10g database. Unfortunately, I
only have a text data in the database,
yet I need to work with numbers and
not text
Sounds like you should have some number columns to store these parsed out values. Instead of always calling some parsing routine (be it regexp or substr or a custom function), pass through all the data in the table(s) ONCE and populate the new number fields. You should also modify the ETL process to populate the new number fields moving forward.
If you need numbers and can parse them out, do it once (hopefully in a staging area or off hours at least) and then have the numbers you want. Now you're free to do arithmetic and everything else you'd expect from real numbers ;)
with s as
(select '153 km/h (94.62 mph)' ts from dual)
select
ts,
to_number(substr(ts, 1, instr(ts, ' ') -1)) speed_km,
to_number(substr(regexp_substr(ts, '\([0-9]+'), 2)) speed_mph
from s
Thanks everyone, it was nice to be able to use everyone's input to get the answer below:
UPDATE CARS
SET
CAR_TOP_SPEED_KPH =
to_number(substr(CAR_TOP_SPEED, 1, instr(UPPER(CAR_TOP_SPEED), ' KM/H') -1)),
CAR_TOP_SPEED_MPH =
to_number(substr(regexp_substr(CAR_TOP_SPEED, '\([0-9]+'), 2));