Hi
I new in database design.
I have a question with my own few solution, what do you think?
Which tables should be created for all the kinds files that stored in my online store (images, attached email files, text files for store email body, etc.) ?
option 1: use seperate table for files types
files{
id
files_types_id FK
file_path
f...
My application is using a search function, sometimes the search may return a result set with thousands of items, therefore I am using lazy loading and only retrieving the primary keys.
The problem is that my application is localized, and I need to sort this primary keys alphabetically using another column in the table that has a name t...
Hello there. Please, give me advice, how to construct select query. I have table table with fields type and obj_id. I want to select all records in concordance with next array:
$arr = array(
0 => array('type' => 1, 'obj_id' => 5),
1 => array('type' => 3, 'obj_id' => 15),
2 => array('type' => 4, 'obj_id' => 14),
3 => array('type' => 12, ...
The table's schema is pretty simple. I have a child table that stores a customer's information like address and phone number. The columns are user_id, fieldname, fieldvalue and fieldname. So each row will hold one item like phone number, address or email. This is to allow an unlimited number of each type of information for each customer....
I want to use a JOIN to return a boolean result. Here's an example of the data...
t1
id | data
-----------
1 | abcd
2 | 2425
3 | xyz
t2
id | data | t1_id |
-------------------------
1 | 75 | 2 |
2 | 79 | 2 |
3 | 45 | 3 |
So with these two tables I want to select all the...
In the next few weeks I'll be taking my site from the localhost (WAMP) and puting it on a new server. This will be the first site, on my first server, so basically...i'm a noob!
This must be an important moment for any independent web developer / small business so i'd love to hear about some experiences, mistakes and system default sec...
here's what the statement looks like:
DELETE FROM videoswatched vw2
WHERE vw2.userID IN ( SELECT vw.userID
FROM videoswatched vw
JOIN users u ON vw.userID=u.userID
WHERE u.companyID = 1000
GROUP BY userID )
that looks decent to me, and th...
I have a table with over 4 million rows, I want to split this table in more tables, i.e one table with 50k rows.
I also need to perform a search on these tables, whats the best way to do it? with JOIN, or? do you have some better ideas?
Best Regards,
QUERY
$do = $this->select()
->where('branche LIKE ?',''.mys...
I would like to construct a query that fetches results that occurred between NOW and 15 minutes ago, im getting a mysql error when I try the following , can you help me? thanks
SELECT *
WHERE user_id = '000'
AND date_time < now( )
AND date_time > DATE_SUB( now( ) , INTERVAL 15 MINUTE)
Error message:
You have an error in yo...
Hellow guys.
I am trying to update mysql data by letting users submit a form.
The user could update the result of the game and the winning team get +1 win in mysql. The user can always see the game form and update/change the game.
My question is how to prevent second or third time +1 win to the existing winning team when the users...
i want to add dynamic columns in a mysql table.
but i dont know exactly how.
i want to let the user add some columns (fields) in a thread.
eg. let him add a integer field and a value (eg. price: 199) or a string field and a value (eg. name: teddybear).
the user can add as many field/value-pairs as he wants.
i thought i could create ...
I have a myisam table with 2.5M rows, I use an union all to get my results as following:
(SELECT t.id FROM t WHERE type=1 LIMIT 10)
UNION ALL
(SELECT t.id FROM t WHERE type=2 LIMIT 10)
...
UNION ALL
(SELECT t.id FROM t WHERE type=25 LIMIT 10)
the time to opening the table t is about 6ms.
With a single request:
SELECT t.id FROM t WHE...
In this script, it gets the followers of a user and the people the user is following.
Is there a better relationship/database structure to get a user's followers and who they are following? All I have right now is 2 columns to determine their relationship. I feel this is "too simple"?
(MYSQL)
USER | FRIEND
avian gary
cend...
Hello. I am using a SWFupload script and I can't make a request from flash with mod_rewrite, I don't know why... I just need to point the Flash request to that file directly. This file runs an upload script that works ok but now I need to save some info to the database and I would like to know what should I write to have access from that...
What is a command line I can use to back up a MySql database every single week into a file name with the date (so that it doesn't collide with previous backups)?
Also, is this a reasonable backup strategy? My database is relatively small (a complete export is only 3.2 megs right now). The churn rate is relatively low. I need to be ab...
I have the following query which is takin 3 seconds on a table of 1500 rows, does someone know how to simplify it?
SELECT dealers.name, dealers.companyName, dealer_accounts.balance
FROM dealers
INNER JOIN dealer_accounts
ON dealers.id = dealer_accounts.dealer_id
WHERE dealer_accounts.id = (
SELECT id
FROM dealer_accounts
WHER...
Here's what I have but nothing is output to the screen. :\
<html>
<head>
</head>
<body>
<?
mysql_connect(localhost, "sergio", "123");
@mysql_select_db("multas") or die( "Unable to select database");
$query="SELECT * FROM usuario";
$result=mysql_query($query);
$num=mysql_numrows($result);
$i=0;
$username=GET["u"];
$password=GET["p"];...
I find myself working in an environment where all I have access to is Tomcat + MySQL. No Apache, no PHP. I'm looking for a web interface to MySQL that will run under Tomcat (can't be a desktop interface, as the mysql port is not accessible).
I'm tried jMyAdmin and javaMyAdmin. I can't get either to work, and both lack documentation and ...
Hello,
few times ago, i asked how to do to display datas per month, i must told a bad explanation because i just figured out that it's not what i want :
Here's what I got :
$req1 = ...
AND v.date > (DATE_SUB(CURDATE(), INTERVAL 2 MONTH))
AND v.date < (DATE_SUB(CURDATE(), INTERVAL 1 MONTH))
$req2= ...
AND v.date > (DATE_SUB(CURDATE()...
I am working on a project that involves gps data collection from many users (say 1000) every second (while they move). I am planning on using a dedicated database instance on EC2 with the mysql persistent block storage and run a ruby on rails application with nginx frontend.
I haven't worked on such data collection application before. A...