Search technique in Mysql using only sql not pl/sql - string

Here i want to search from one table's column to another table's column.
so if the string is "Introduction To Php" so this string will compare to another table all data for particular column but the new things is order of words may be different in table.
i.e : it can be like "Php introduction to" , "to indtroduction php" and so on... means combination of different words and there place in the string should be compare with
If you have any idea related this , please answer for this question.
Thanks a lot in advance..

You may be interested in full-text search functions in MySQL http://dev.mysql.com/doc/refman/5.0/en/fulltext-natural-language.html

Related

GCP Data Catalog - search columns containing a dot in the column name

Take the public github dataset as an example
SELECT
*
FROM
`bigquery-public-data.github_repos.commits`
LIMIT
2
There are column names like
difference.old_mode
via search:
column:difference.old_mode
will show no results
So, in this case the period isn't actually the column name, its an indication that you're dealing with a complex type (there's a record/struct column of name difference, and within that exists a column named old_mode.
Per search reference there's no special syntax for complex schemas documented.
A suggestion might be to leverage a logical AND operator like column:(difference,old_mode). It's not as precise as specifying the column relationship, but it should return the results you're interested in receiving.

Can we specifiy order of columns to search in solr?

Can we specify order of columns to be searched in solr?
For example my search string is : "Test"
Then my result should contain all rows matching column1 and then all rows matching column 2... Similar to union query in SQL.
I tried with custom search handler which will fire multiple requests to solr and then append to get final result.
But is there any other way to get this type of search using SOLR?
I am using solr-5.4.1.
Thanks
You could use eDismax and match on both fields (I assume you mean columns by that). Then, use boosting to prioritize the matches in the first field to rank higher.
As an easy example, you would search against field1^10 field2, where ^10 is the boost factor. If that works but is not perfect, you can look into the documentation for other methods to apply boost.

ms sql search by nvarchar field

I am using MS SQl 2012 and have simple table
id (int) - primary key
fullname (nvarchar(500)
age (int)
…
In table over 15 millions records and I need make simple search like
select * from Customers where full name like '%sometext%'
Details:
1. It can have few words
2. There are used many languages
3. that fullname doesn't have any indexes yet
What the best way make search like that? Which indexes I should add? Can I use full text search if there are not only english words?
Sargable The above query does not meet the requirements therefore no index on your full name column is going to help. You will need to restructure your data or filter on something sargable first (age = 30) and then scan full name.
The other option is to pull in a text searching technology as #afrancis indicated.

Find position from row and tag with another table?

I have table where one of my field is 40 char long and the values are coming like this
00A000GB000C000000000F000000D0000000000E
now I need to find out the position for each character populated and join with another table, another table has field call position. For Example
from the field above, A is 3rd position, G is 7th position, B is 8
so I have to find the position for the fields populated(<>0) and then join with another table.
Please let me know how can I resolve this.
I think the community will need some more information to help with this question.
A couple questions I have when looking at this is:
What type of database are you using?
Are you looking to actually JOIN a table with another or are you talking about populating another table with data? If it is a join what type of data are you using to link the 2 tables?
Are you wanting to do this with SQL?
What programming language are you working with?
It sounds to me like you are going to need to do some programming to handle this one. Not knowing the answers to the above questions I am taking a stab at things and would recommend extracting the data from the database, processing the data to find the position, then select from the second table based on your processed data.

How can I delete records from a table that have certain criteria

Rookie question I know.
I have a table with about 10 fields, one of the fields is a category field. I need this field to exist because of the multiple types of categories. However, one category in this field is wrong and is duplicating results.
So can I delete all records in the table that have "Type320" in the CatDescription field, and how? I want to keep eveerything else as it is in this table; just need to get rid of the records that have that that in that one field
Thanks very much!
EDIT: Thanks for the answer, I did not know how to do this so this is very helpful
However, this is more complicated than I thought. The raw data that I am supplied carries these duplicate records (only duplicate in certain circumstances but they are easy to isolate). This raw data is given to me on a monthly basis in several spreadsheet forms.
It all relates to these ID numbers, and has like 10 fields (xls columns). As I said before one of these is the Category Description field (sorry, this is not a lookup) In certain places this records automatically duplicates itself on output because in the database this comes from, it has to have this sub category for one particular "type"
So....every time there is a duplication, every single bit of information in all fields are exactly the same, with the exception of this CatDescription (one is Type320, and the duplicated record type is "Type321"). However, there are some instances where Type321 is valid on it's own (in which case there is no matching data row with a Type320 catdescription). By matching I mean all data in all fields of a particular record.
A very clear absolute of this is if all fields (data within) of a record with Type320 CatDescription, matches all fields (data within) a record with Type321 CatDescription, then I can delete that record containing Type321 CatDescription. This is true because this is the only situation where this duplication occurs, normally not all of this should match.
This allows all unique records with Type320 and Type321 data (that does not match exactly) to stay; just a it should. This makes sense to me (and hopefully you too :/) but can it be done, and how?
thanks because this is way over my head. I would rather know how to do it in access, but an xls solution is equally as appreciate. heck i would do it in ppt if it would get the job done! :)
I would try with one of these two querys:
DELETE FROM table WHERE CatDescription LIKE '%Type320%';
DELETE FROM table WHERE CatDescription LIKE '*Type320*';
That because the Access database engine could be using * (ANSI-89 Query Mode e.g. DAO) instead of % (ANSI-92 Query Mode e.g. OLE DB/ADO) for the wildcards.
Alternatively, this regardless of ANSI Query Mode:
DELETE FROM table WHERE CatDescription ALIKE '%Type320%';
Note the Access database engine's ALIKE keyword is not officially supported.
Does the CatDescription field look to another table? Is it a a query of those tables that creates what you call duplicate results?
If so, be careful about blaming the table that has CatDescription. Check the look-up table to see if Type320 is found there in duplicate.
If you don't have the problem isolated correctly, then you're likely to delete good records while not fixing the problem.

Resources