Looking for a collection of data with no clear pattern [closed] - sql

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I am trying to run a query to search for a collection of data with no clear pattern, in fact it conflicts with an existing pattern.
The solution I have in mind is to run the query with an AND for all the data that does have a pattern(let's assume every other record follows pattern, except for what i am looking for, so it's basically scattered with no clear way of putting it together) and them what's left over, can be retrieved and displayed.

The solution I have in mind is to run the query with an AND for all
the data that does have a pattern
Well, if you want to find everything that doesn't follow any pattern just enclose all the patterns within brackets and combine with boolean AND.
Then just put a NOT outside the brackets.
Example:
select * from data where
NOT (CONDITION1 AND CONDITION2 AND...AND CONDITION_N)
I imagine your conditions are statements such as string comparisons using like (and wildcards) in addition to arithmetic comparisons.

Related

SQL does replace and CAST on select affect the Database? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am creating a view and I was asked to do a 'replace' and a 'cast', so as an example:
SELECT CAST(qtyshipped AS INT) AS 'QTYShipped', REPLACE(itemval,'.','')
FROM Database
Within the view, should not actually change the information in the database but just in the query correct? (It works perfectly in my sandbox server but i just want to confirm)
Not a dumb question at all. And the answer is yes, it only changes the result of the query, the underlying data will remain the same.
That is already a good query. But I need to tell some points with you.
REPLACE function is case-sensitive. Although I've seen in your code that you are only replacing period.
Why is your column qtyshipped is not in numeric type? You should have change that into numeric. So you won't need casting which may lower the performance.
It will not affect your database since your are only executing SELECT not UPDATE.

RoR - How To Count & Display Comments [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I'm looking to have a count of the number of comments left under an article and display it on the index page beside that particular article - like the example here in red circles. Any suggestions as to how I might do this?
The picture is an example of what I'm trying to do, its not my site.
This sounds like a good candidate for Rails.cache. Every time you create a new comment simply increment that cache counter using the post id.
If the cache entry does not exist, do a simple article.comments.count (depends on your domain model of course) query and re-cache it.
Storing it in a cache is one idea, yes.
But storing it in a counter_cache column is probably a better idea. That way even if your server was restarted somehow you wouldn't loose the cached values. See http://guides.rubyonrails.org/association_basics.html, section 4.1.2.4.

How to do Normalization? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
Hi i am new to this concept and i need your suggestion. i have an excel spreadsheet having about 35 columns and i have to create tables out of it. i have to draw an ER diagram but i dont know which should be the main table having foreign keys of all other tables or is there going to be one main table or multiple main tables?
Normalization is a database concept - it is all about removing redundancies from your data.
There are several different normalization forms, each building on top of the previous.
First normal form - each column in a table should only hold one value, so things like a comma separated list is a no no.
To be honest, the subject matter can get very complex - see this article on how to apply normalization to a table.

Create query in sparql using jena without hard coding the query? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Can any one tell me how to create a sparql query for dbpedia using jena program without hard coding the query.. I dont want to just store the query in string and to execute it... I have no idead how to make it as i am new to sparql... Could any one plz help me..
Thanks in advance
Can you add more detail on what you want to do i.e. is there a general template to your queries or particular types of queries you want to make?
Jena does have some support for substituting variables into prepared queries so you can hard code a template and then substitute values as desired based on your inputs. But whether this is applicable depends on what queries you want to make.
As a very simple solution you can just build your querystring by string concatenation based on your inputs and then use Jena to send that to DBpedia.
Edit
See Ian's answer to your other question which shows how to do substitution of values into prepared queries using Jena

Which one is "better" code snippet? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 13 years ago.
Which code snippet is better? and How? ['Better' on the basis of, readability, debug, code standards etc...,]
Dim Name As String = Employee.Name
or
Dim Name As String
Name = Employee.Name
Combining declaration and assignement is generally thought to be the best approach (your first example)
Well as they are both equivalent and both very simple I would expect the compiler to reduce them to the same thing so neither is really better.
Personally I feel the second has its advantages in that you can create several variables of one type in one line of code and then initialise them one after the other which for readable code is my preference. But if you only have one variable to initialise then the first is nice and concise as well.
As long as there is no null / empty or content checking between declaration and assignment, I prefer option number 1. Easier to read and less clutter.