Maybe it's a little dumb, but i'm just not sure what is better.
If i have to check about 30k rows in db for existanse, what i'd do?
#1 - one query
select id from table1 where name in (smth1,smth2...{till 30k})
#2 - many queries
select id from table1 where name=smth1
Though, perfomance is not the goal, i don't want to go down with mysql either ;)
Maybe, any other solutions will be more suitable...
Thanks.
How can I get ALL the data from a table of my DB (mySQL) using hibernate, and store the output into List of Objects?
I'll use this List, to populate a JTable.
Hi there ,
i always asked myself. Why are there so many DB management systems?
I am not an DB expert and i never thought about using another DB than mysql.
Programming languages offer different paradigms, so there it makes sense to choose a specific language for your purpose.
What are factors to choose a specific DB management system ?
We have a main mysql database which all of the applications within our organization need the data within this database. How can I config my java web application to use this database with it's specific database when I use Spring and Hibernate within my application? How can I config JPA annotations for example between CONTRACT table within my database and COUNTRY table within our main database? what's the best practice to do this?
When using a SQL join, is it possible to keep only rows that have a single row for the left table?
For example:
select * from A, B where A.id = B.a_id;
a1 b1
a2 b1
a2 b2
In this case, I want to remove all except the first row, where a single row from A matched exactly 1 row from B.
I'm using MySQL.
Hello there,
I have a website where documents are saved in xml documents, all with the same structure.
I need a search engine where I am able to choose documents with the highest relevance according to the key words given by a searching user.
I thought it could (?) be a good idea to have one using XQuery rather than having the information stored twice (in XML docs + mysql database) and querying the mysql database for relevance searches.
Is XQuery any good for this, and how, and what speed can I expect on +1000 documents of about 7kb each.
Thank you for your time.
Kind regards
I am trying to extract unix timestamp from mysql and convert it to ISO8601 timestamp. I need it in order to format date into facebook-like(or stack-overflow-like:) '30 minutes ago' instead of displaying the exact date and time. Has anyone dealt with it?
Is there a function for MySQL that will count the number of times a string occurs in another string or column? Basically I want:
SELECT
SUB_COUNT('my word', `my_column`) AS `match_count`
FROM `table`
Thanks!
Hi,
I have an SQL table like this : sales(product,timestamp)
I want to display a chart using Open Flash Chart but i don't know how to get the total sales per hour within the last 12 hours. ( the timestamp column is the sale date )
By example i will end up with an array like this : array(12,5,8,6,10,35,7,23,4,5,2,16) every number is the total sales in each hour.
Note: i want to use php or only mysql for this.
Thanks
I am using CakePHP for a price-comparison website.
I have a table products with fields: id, pride_regular, price_action.
I would like to combine the fields price_regular and price_action into a dynamic field: price. The lowest value of these two fields should be the value of the new price field. Also I want to order on it Ascending.
Should I use a custom MySQL-query?
Hi,
I want an open source/free tool which can test the schema, data, user defined functions, views and stored procedures between two different databases or two different versions of the databases. I am using MySQL database.
Currently I am using DB Solo which is a 30 day trail version.
Thanks in advance.
Hi
in mysql how to write a sql like this, to get the amount of X 20 and <20
select date, numberOfXMoreThan20,numberOfXLessThan20, otherValues
from table
group by (date, X20 and X<20)
thanks
hey, i want to format a date in mysql using
DATE_FORMAT(tblnews.datead, '%M %e, %Y, %l:%i%p')
i cant seem to get the quotes right , so i keep getting errors. how would you put this in a query?
following the answer here, altho it solved my problem, it displays a blank table. .something like this. the data does get inserted in the mysql but the table displays nothing.
the codes are posted on the above link.
your help would be appreciated. thanks!
I have read many strong views (both for and against) SPs or DS.
I am writing a query engine in C++ (mySQL backend for now, though I may decide to go with a C++ ORM). I cant decide whether to write a SP, or to dynamically creat the SQL and send the query to the db engine.#
Any tips on how to decide?
I know that with an InnoDB table, transactions are autocommit, however I understand that to mean for a single statement? For example, I want to check if a user exists in a table, and then if it doesn't, create it. However there lies a race condition. I believe using a transaction prior to doing the select, will ensure that the table remains untouched until the subsequent insert, and the transaction is committed. How can you do this with MySQLdb and Python?
$extension = “SUBSTRING_INDEX(domain_name, ‘.’, -1)”;
$this->db->order_by($extension, “asc”);
It says:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘asc LIMIT 50’ at line 44
But its working when I didn’t used the $this-db-order_by Active Record Class
such as this one:
$this-db-query(“SELECT * FROM domain ORDER BY SUBSTRING_INDEX(domain_name, ‘.’, -1)”);
Anyone please help me. Thanks.
I'm working in NetBeans 6.8 and I'm trying to create new connection using MySQL to an existing database. Does the .mdb file need to be in a specific location? It tells me that it cannot establish the connection.
I am currently working with User objects -- each of which have many Goal objects. The Goal objects are not User specific, that is, Users can share the same Goal. I am attempting to fashion a way to calculate a "similarity percentage" between two Users... (i.e., taking into account how many Goals they share as well as how many Goals they do not share) Does anyone have experience with this type of situation? I am using Grails with Mysql if that is helpful.
Thanks
Hello,
I my software I need the client to install a database server (MySQL in my case). I'm deploying the setup and making user install it like a pre-requisite.
After installing the DBMS server. I need to setup databases (that I created) on the client machine. How to do this automatically (as part of installation.)?
I have a email address like [email protected] and [email protected][email protected] ... etc
I want a Mysql select query so that it would trim user names and .com an returns output as
gmail,ymail,hotmail etc
Hi, I have a mysql table that I need to only contain 20 newest records before adding additional records.
New rows are added daily so I would like it first delete any records that are greater than the 20 allowed starting with the earliest.
The table contains an auto increment "id" column so I can easily determine which is the earliest records.
Thanks for any help.
I have test_scores table with following fields:
Table schema:
id (number)
score1 (number)
score2 (number)
score3 (number)
score4 (number)
Sample data:
id score1 score2 score3 score4
1 10 05 30 50
2 05 15 10 00
3 25 10 05 15
Expected result set:
id col_name col_value
1 score4 50
2 score2 15
3 score1 25
What is a good SQL for this?(I am using MySQL.)
Right now on my (beta) site i have a table called user data which stores name, hash(password), ipaddr, sessionkey, email and message number. Now i would like the user to have a profile description, signature, location (optional) and maybe other things. Should i have this in a separate mysql table? or should i share the table? and why?