sql

SQL count returning one value (and not the total).

Hi all. I need to get the nid "alone" in this query. SELECT count(nid) as total,nid FROM bird_countries b group by nid order by total asc` Basically I need this to do something like update table set field=1 where id in (the other query); Right now, I'm getting the total of nid's and the nid, but can't find how to just get the nid ...

What deficiencies, limitations or flaws do you feel exist with SQL and what would you change or add to it?

Have you encountered deficiencies, limitations or flaws while using SQL? I can think of several examples: Complicated queries/updates, SQL injection, etc. € Could you accomplish the same task easily with a different DML or programming language? Can you provide me with case examples of problems you have encountered or cases where for ex...

android sqlight invoked from calss

I am using Gamelogic class which implements no one (just object to be honest ) and i want from him to set a data base where the game screen ask the logic questions and the last ask the sql question without all the Context usage , just to keep it simple . is it possible ? if not what is the alternative , can someone show me little examp...

Scalability of Using MySQL as a Key/Value Database

I am interested to know the performance impacts of using MySQL as a key-value database vs. say Redis/MongoDB/CouchDB. I have used both Redis and CouchDB in the past so I'm very familiar with their use cases, and know that it's better to store key/value pairs in say NoSQL vs. MySQL. But here's the situation: the bulk of our applicatio...

Sql server convert/cast int to varchar independent of db language/collation

I would like to convert/cast some int or bigint to varchar (in tsql). But I would like it to be in English regardless of database language, collation, etc. (I need to parse it back on the client side) Basically I am looking for tsql equivalent of this C# code 1234.ToString(CultureInfo.InvariantCulture) What should I do? Is this lan...

Would a built-in multi-threading capability for SQL be desireable?

For example: Being able to start displaying or manipulating rows as they are being returned by a query while the query has not finished searching the table?.. and I don't mean using the FIRST ROWS directive to hint the engine, I mean transparently, without having to add addtional logic. A feature like this would be useful for queries whi...

Is ROWID internally indexed unique by an SQL server?

It's my understanding that the quickest way to access a particular row is by its ROWID. In INFORMIX-SE 7.3, when I do a 'SELECT ROWID FROM table;' I notice that its values are type SERIAL[INT]. In oracle, they are SERIAL[HEX]. Has anyone ever used ROWID for any practical use?.. If I wanted to locate the most recent row added to a table, ...

In T-SQL, how to insert a new row with all values set by default?

Hi, In Microsoft SQL database, I have a table where every column have default values (either fixed values or stuff like identity or getdate()). I am trying to write an SQL statement which will insert a new row in which every cell will have a default value. Neither insert into MySchema.MyTable nor insert into MySchema.MyTable () va...

SQL Server - Select AS temp_name FROM table WHERE temp_name = something?

You know how you can assign a temporary column name to a return value in a SQL statement like this? SELECT something+this+that AS myvalue FROM mytable Is it possible to use the temporary name myvalue as a conditional? SELECT something+this+that AS myvalue FROM mytable WHERE myvalue = 10 I can't seem to figure out the syntax to do t...

How to find least non-null column in one particular row in SQL?

I am trying to find the lowest number in two columns of a row in the same table, with the caveat that one of the columns may be null in a particular row. If one of the columns is null, I want the value in the other column returned for that row, as that is the lowest non-null column in this case. If I use the least() function in MySQL 5.1...

Testing phrases to see if they match each other

I have a large number of phrases (~ several million), each less than six or seven words and the large majority less than five, and I would like to see if they "phrase match" each other. This is a search engine marketing term - essentially, A phrase matches B if A is contained in B. Right now, they are stored in a db (postgres), and I a...

How can i get Created date of a column in SQL server Table ?

I use the following query to get information about columns of a SQL Table : SELECT * from information_schema.columns WHERE table_name = 'userpersonalinformation' but I can't find any data about creation date for each column ... Is there any way to get creation date of a column in a table ? ...

How to avoid cursor in sql server? also want to avoid while loop

Hi All, I have two tables in my database, 1st one contains a couple of sentences, like 'I like apples and bananas', 2nd one contains key word, like 'apple' & 'orange'. I want to create a sql statements or usp to list all the colomns in the 1st table with the keywords in the 2nd one. How can I achieve that without using cursors? Would a...

Can you shorten the following query?

Possible Duplicate: Multiple OR Clauses in MySQL Can you think of a shorter way to write this query: SELECT * FROM table WHERE id = 1 OR id = 2 OR id = 5 OR (etc...) ...

Insert Only: ActiveRecord or Queries?

All that I will do is insert records into the database. However, I would definitly like the database-independence that Ruby/ActiveRecord can offer me. What would be the reccommended choice? Using simple insert queries, and rewriting them, and also maintaining my own database class for things as batch insertions; Using the power of Act...

The C# using statement, SQL, and SqlConnection

Is this possible using a using statement C# SQL? private static void CreateCommand(string queryString, string connectionString) { using (SqlConnection connection = new SqlConnection( connectionString)) { SqlCommand command = new SqlCommand(queryString, connection); command.Connection.Open(); ...

XPath query on node-set working like a SQL where in

Hi, a sample of xml document: <xml> <list> <item refid="1" /> <item refid="3" /> </list> <catalogue> <model id="1"><details /></model> <model id="2"><details /></model> <model id="3"><details /></model> </catalogue> </xml> I'd like to query something like //model[ @id = (//item/@refid...

How to convet mutliple SQL left joins to Linq-To-SQL

I have a user table, a user_items table, a user_to_group table and a group table. How would I convert the following SQL query to the correct Linq-to-sql query? select user.username, user.email, user_items.item_number, item_types.desc, [group].name from user left join user_items on user.user_id = user_items.user_id left join item_types ...

How to select a row for certain (or give preference in the selection) in mysql?

Need your help guys in forming a query. Example. Company - Car Rental Table - Cars ID NAME STATUS 1 Mercedes Showroom 2 Mercedes On-Road Now, how do I select only one entry from this table which satisfies the below conditions? If Mercedes is available in Showroom, then fetch only that row. (i.e. row 1 in above examp...

SQL Server export, back-up without to stop the server

Can anyone tell me how can I make back-up to a database to to export it to a different database (SQL Server or mysql) without to stop the server ? thank you in advance for any help ! ...