Find the first record starting with the largest capacity
HelloThis question might have been asked before, but I don't know how to describe it in the search field.
There are 3 drives with 2 fields (id, name). These recordings are:
1, Amsterdam
2, Amster
3, am
I want to find the folder that holds the most possible information:
Research of Amsterdam must return 1; the Amsterdamned search should return 1; the search of America should return 3; the search of the United States should return 0 (or null).
So the logic is to search for the entire string, and returns the id when it is recognized. If not found remove most characters right and search until you find or has empty string.
Since this logic must be part of SQL, I wonder if there is a clever (without write a PL/SQL function) way to solve this problem?
I'm curious.
Geert.
See the report below...
SELECT t2.place_id
FROM (SELECT t.*,
Decode(( Instr(Lower('&value'), Lower(t.place_name), 1,
1) ), 1, Length(t.place_name),
0) AS len
FROM actual_places t
ORDER BY len DESC) t2
WHERE t2.len != 0
AND rownum = 1;
AmsteRdamX - 1
Amsterdam - 1
AmsterX - 2
Amster - 2
aMs - 3
am - 3
Am --3
test - NULL
Tags: Database
Similar Questions
-
Consecutive date grouping and find the largest number of consecutive group
Hi all
I have given dates and I want to find the largest number of consecutive dates
WIN_DATE_DATA
2015-09-22
2015-09-23
2015-09-27
2015-09-28
2015-09-29
2015-09-30
2015-10-1
In this example, there are 2 group of consecutive dates
Group 1
2015-09-22
2015-09-23
Group 2
2015-09-27
2015-09-28
2015-09-29
2015-09-30
2015-10-1
The OUTPUT should 5 which is the largest grouping of consecutive number.
Thanks in advance for the help!
Please take a look at the Community document: 101 PL/SQL: grouping sequence ranges (method Tabibitosan)
will allow you to do.
-
DECLARE
Num_tab_ty TYPE TABLE IS NUMBER;
num_tab num_tab_ty: = num_tab_ty (6,4,8,7);
BEGIN
-How to find the largest and the lowest number in a collection
END;
DECLARE
Num_tab_ty TYPE TABLE IS NUMBER;
num_tab num_tab_ty: = num_tab_ty (6,4,8,7);
number of l_greatest_value;
BEGIN
Select max (column_value)
in l_greatest_value
table (num_tab);
END;
/
HTH
-
How to find the largest contiguous free space in windows xp
Hi, I have two machines, one running Win7, XP running. I know how my highest contiguous free space is great under w7, using "defrag c: - one" in a prompt "administrator-started":
C:\Windows\System32>defrag c: - one
Microsoft Disk Defragmenter
Copyright (c) 2007 Microsoft Corp.Citing analysis on OS (C :)...)
The operation completed successfully.
Post report of defragmentation:
Volume information:
Volume size = 283,40 GB
Space free = 60.49 GB
Fragmented space total = 0%
More large size of free space = 46,29 GBBut, by using the same command in XP does not have the same statistics (I tried 'defrag c: - a - v' for a detailed report, but it does not always give this stat.) Anyone know how to find out what is the largest contiguous amount of free space on a XP computer?
TIA
K
Hey man follow my link http://us.generation-nt.com/answer/how-find-largest-contiguous-block-free-memory-help-27343152.html , and it explains how to find this information. so, this should be your answer
-
PDF, Javascript to find the largest number among the given numbers
I have the form in which there are 28 areas in which numbers will be filled, and more among the 28 number must appear in field 29.
As if the fields are filled with
1
5
6
7
9
5
10
50
68
15
15
60
485
58
68
695
58
94
28
38
76
46
86
248
Then the field should show the largest number among these i.e 695
If you have named fields from 0 to 27, you can not run your loop from 0 to 28 - unless you have an exception handler. You must limit the loop occur from 0 to 27. There is another problem with your code, which I did not see the last time: you initialize it 'fake' maxValid, but then you test for 'true' inside your loop (and position it to "false" if it were true). You do not have a valid value still on the first iteration, so you must check for 'false' and set the variable to "true" inside the "if" block
-
Find the largest tables (disk space) in a database
Our problem: customers who have problems that we cannot recreate are asked to export their data as a dmp and then we download the dmp to investigate to import locally and to implement were the problem is.
Some customer data sets are too large to download (3-4 GB - I know that this shouldn't be a problem but some customers have very slow connection speeds and it would take a lifetime).
To work around this, they put on a DVD and send (which takes a few days).
The thing is, that these data sets are probably around 400 MB with a table showing the rest with blobs (and this table is probably not the cause of the problem). So indeed, we can it exclude from the export.
What we want to achieve:
There are potentially some of these tables that could be large so we would like to produce a script to determine which tables are the largest disk space. We then (if the problem that the customer experiences is nothing to do with these tables) will not include these export on the DMP. Which means we can get their faster data and subsequently solve their problem in a shorter time.
Where to start any help will be much appreciated. We use db 10gYou can query s/n | WHERE user_segments, ordered by decreasing bytes.
http://download.Oracle.com/docs/CD/B19306_01/server.102/b14237/statviews_4097.htm#REFRN23243
Something like:select segment_name , segment_type , bytes from ( select segment_name , segment_type , bytes from dba_segments where owner = user order by bytes desc ) where rownum <= 10
For the 10 largest segments.
-
How can I find the largest table in a schema?
Is there a query to determine the largest table in a schema?
select table_name, num_rows from user_tables where num_rows = (select max(num_rows) from user_tables)
To get accurate information, table statistics need to be updated
-
I bought my XP Home Edition in 2006. I use it as a second laptop, so it is great for any e-mail, internet and a desk job.
As the C drive is too full here have already deleted more programs and files, but it is always full.
Especially with Microdoft security updates.
Is it possible to remove those between e year after installation and last year?
And how? Because, under the program, check and delete programs, these updates cannot not be asupprimer.
Thank you and best regards!
Robert
You can create more free space in C by
carrying one of the measures suggested below.
The default allocation for the restoration of the system is 12% on your C partition
What is more generous. I have them would be reduced by 700 MB. Click right on your my
Icon on the desktop and select System Restore. Place the cursor
on your C drive, go to settings, but this time find the slider and drag
it to the left until it reads 700 MB and output. When you arrive at the
Settings screen, click on apply and OK and leave.
A parameter that might be useless by default is that for temporary internet
files, especially if you keep no copies on the disk offline. The
default allocation is 3% of the walk. Depending on your attitude offline
you could bring this to 1% or 2% of the copies. In Internet Explorer, select
Tools, Internet Options, general, temporary Internet files, settings for
make the change. At the same time, look at the number of days is the story
held.
The default allocation for the basket is 10% of the disk. Implement
5%, which should be sufficient. In Windows Explorer, move the cursor
on your Recycle Bin, right click and select Properties, Global and
Move the slider from 10% to 5%. However, try to avoid leaving to
too full as if it is full and you delete a file by mistake, it will be
bypass the Recycle Bin and have gone forever.
If your drive is formatted as NTFS another potential gain arises with
your operating system on your C drive. In the Windows directory of
your C partition you'll have some uninstall files in your windows
folder in general: $NtServicePackUninstall$ and $NtUninstallKB282010$
etc. These files can be compressed or not compressed. If compressed
the text of the name of the folder appears in blue. If it isn't
compressed, you can compress them. Right-click on each file and
Select properties, general, advanced, and check the box before you compress
contents to save disk space. On the general tab, you can see the amount
acquired by deducting the size on disk size. Folder
compression is only an option on an NTFS formatted disk partition / partition.
Select Start, all programs, accessories, System Tools
Information, tools, Dr. Watson and make sure that the check box in front of "Append to."
existing log"is NOT checked. In other words, the next time the newspaper is
writing it will overwrite rather than adding to the existing file.
The setting of maximum size by default for Event Viewer logs is too big.
Reset the maximum value for each log from 512 KB to 128 KB and assign
crush.
http://support.Microsoft.com/kb/308427/en-us>
Select Start, all programs, accessories, System Tools, disk cleanup for
Empty your trash and delete temporary Internet files. Also
Select Start, all programs, accessories, System Tools, disk cleanup.
More Options, System Restore and delete all but the last system
Restore point. Run Disk Defragmenter.
--
I hope this helps.
I quote Gerry C J Cornell - a regular contributor here
UTC/GMT is 21:33 Tuesday, April 17, 2012
-
REG EXP to find if a field starts with a letter
Hello
I have a code to clean some phone numbers, and now I want to add a condition to leave the field only if it begins with a letter.
-------------------------------------------------
Select
SR_SERVICE_ID,
case
When SR_SERVICE_ID like "% @% ' -does not INCLUDE YEAR ' @' SYMBOL
then
SR_SERVICE_ID,
case
When SR_SERVICE_ID ' ^ [a-zA-Z] "-STARTS WITH a LETTER (NOT the BODY)"
then
SR_SERVICE_IDon the other
'0' || regexp_replace ({SR_SERVICE_ID, ' \D|^0{1} "")-ADD A '0' FOR THE START OF THE FIELD AND GARNISHend CLEANSED
Of
TABLE_1;--------------------------------------------
The "SR_SERVICE_ID" field contains email addresses, phone numbers and MOBILE numbers in the format '0400123456'
I want the script to check if the value of the field begins with a letter or contains a ' @' & ignore them and then go to add a '0' in the field at the start.
Everything works except the below;
------------------
case
When SR_SERVICE_ID ' ^ [a-zA-Z] "-STARTS WITH a LETTER (NOT the BODY)"
then
SR_SERVICE_ID
------------------
The problem is that it does not accept the part of the instruction box on the field starting with a letter?
Can anyone comment why it won't explain all the parts of the Reg Expression they add so I can learn more?
Thank you
Hello
woof777 wrote:
Thanks again,
Can you explain what you mean by "then you must only change this WHEN this CASE expression clause.
I tried everything I can think of, use the instructions box separately & everything is OK, once I add the second back, "Missing Keyword" error.
I don't see what went wrong the syntax below is just an example, it is not supposed to be correct, just display synatx method.
------------
"case when (expression) then foo .
-case when (expression) then Do_Something_More
Else (expression)
END New_Field_Name ".
--------------
Miss me a rule simple syntax here, everything suggests?
It seemed all you had to do was change a WHEN clause, but unless you post some examples of data in a form usable (for example, CREATE TABLE and INSERT statements) I can't say for sure.
CASE expressions don't 'do something', or 'do something' in a CASE expression. What comes after each key word IS a noun, not a verb. Like all expressions, a CASE expression is something that generates a unique value in a SQL data types; in this case, a VARCHAR2. After each THEN or ELSE keyword, there must be an expression of the same type.
After the key words WHEN you have conditions (i.e. operations that result in TRUE, FALSE, or UNKNOWN), not expressions.
Thus a better model of a CASE expression
CASE WHEN condition_1 THEN expression_1 WHEN condition_1 THEN expression_2 ELSE expression_3 END
If (but only if) the CASE expression is the last part of a column in a SELECT clause, then it can be followed by an alias, such as New_Field_Name. The alias is the part of the syntax of the SELECT clause; It's completely outside of and independent of the syntax of the CASE expression.
-
The first two lines of my toolbar disappeared. I find myself with most visited but the lines above, containing the button refresh, bookmarks, and search bar and above the one containing the links to the files, etc are passed, how do em back?
== I was juggling the different bars and must have clicked smth, that I should not have.
ALT V
T
MDon't forget to do this in a new empty tab.
-
How to find the largest number of text file
I use the "Read from the text file" block to read the data in my .txt file in labview. It is now in the string format. I have a lot of numbers in the file.
For example:
0.45
0.35
0.12
1,354
1.56
2.89
5.89
0.56
That's what might look like a text file. I want to find out which of these numbers is larger and do calculations with this number. I have problems with channels/number/berries formats, etc. Thank you
Try to read that the file with File.vi reading worksheet with transposes the True value. Then use the table Max & Min to get the biggest number in the table.
Lynn
-
Hello
I have a query that returns the data in this way:
number of topic seq_num
----------------------------------
1 abc 30
1 xyz 1
2 abc 40
2 xyz 50
How can I get data like this:
number of topic seq_num
-----------------------------------
1 abc 30
2 xyz 50
Thanks in advance
Hello
Do you want the output to contain 1 row by seq_num, the line with the highest NTC?
This is called a Query Top - N, and this is a way to do it:
WITH got_r_num AS
(
SELECT seq_num, subject, cnt - COUNT is not a column name good
Rank () OVER (PARTITION BY seq_num
NTC to ORDER BY DESC
) AS r_num
FROM table_x
)
SELECT seq_num, subject_cnt
OF got_r_num
WHERE r_num = 1
;
In this issue, you can also use the aggregate LAST function, but I recommend this technique for learning first: it will be useful in situations more in the future.
I hope that answers your question.
If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
Report when the above query is the production of incorrect results and explain, using specific examples, how to get the correct results of data provided in these places. If you change the query, post your revised version of it.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).See the FAQ forum: https://forums.oracle.com/message/9362002
-
How to find the largest files on my drive
My drive becomes full, and I want to delete some of the bigger files. How can I find them without going through each folder?
Hi llk5,
You can use Details view in windows Explorer to check the size of the files in the folders. You can identify the file that more large sizes depending on the size of the column and then delete them as needed. You can refer to the link below to set the details view in Explorer windows and check -
http://Windows.Microsoft.com/en-us/Windows-Vista/change-folder-views-and-behavior
I hope this helps.
-
Hi all
I need support for readers to replace Perc 4/Di (we need more free space!)
OS: Windows Server 2003
Actually: Raid 1-> 2 x 146 GB drives
Next: Raid 1-> 2 x 300 GB drives
Volume C: (System Partition)
Volume D: (data)
The system partition is on the table. I'm running out of space, so I intend to replace the 146 GB drives with 300 GB drives.
My question is, how do I replace the array to use all the space on the 300 GB drives without having to reinstall the system? And once I have the table showing 300 GB, what is the best way to extend the system partition and your data?
Tanks in advance.
-
What is the largest HARD drive compatible with my 2008 Macbook soon?
What is the largest capacity disk HARD compatible with my 2008 MacBook internal early?
I believe that the largest capacity 2.5 "drives are 2 TB https://eshop.macsales.com/shop/hard-drives/2.5-Notebook/
Maybe you are looking for
-
I have spice fireone that runs on v1.3 when can I expect the updates?
It shows v 1.3on the internet I got to know that 1.4 is already a stable version. until when can I hope to upgrade to it?Spice fireone mifx1
-
disable the library access iCloud music on Apple TV 4
So I brought a brand new apple TV (4th generation). And I'm a little disappointed by some of the limitation. Why can't disable the library iCloud music on my apple TV? I still care for my family to have access to iTunes radio. But my library of music
-
U940-11N SATELLITE - cannot get into the BIOS or Boot Menu
Hello I am currently in the processing you want to perform an update of the operating system on my laptop. When I bought the laptop in a well known department store, it came loaded with Windows 7, despite the operating system preloaded in Windows 8 w
-
Cannot install an accounting program, error: encountered a problem and needs to close
Title of the debtor: need help. I am trying to install a disc of accounts on my computer, it goes through the process and when he should finish I get a message "he has encountered a problem and needs to close" and then I got a message you need to NET
-
Try to download explore 8 error message: make sure the cryptographic service is running on your computer. Have done this - but I still cannot download. Any help would be greatly appreciated. Thank you!