Do you know which table srtucture is better :
table user
id INT pk autoincrement
name VARCHAR(255)
email VARCHAR(255)
statut TINYINT(4)
The statut can only hold 2 states : 1/2
OR
table user
id INT pk autoincrement
name VARCHAR(255)
email VARCHAR(255)
statut VARCHAR(45)
The statut can only hold 2 states : ac...
I have a table where there is composite key of id and emp_no.
I want to show record of all tids against one emp_no like this (not using any aggregate functions because no need to show any thing like that):
emp_no tid
tid
tid
emp_no2 tid
tid
tid
Thanks in advance
...
How can I get the row number in the returned mysql query , (i.e) if my query is returning some 5 rows as a result for ex... I wan to know that is 1st,2nd, 3rd ...etc
thaks in advance
...
Hi..,
I have read the topic Mysql query: retrieve current date query ., but my question is how can i select the row in a particular given time span.
i.e if my date field is having the entry as 2010:10:27 10:30:00 then that row should be selected when the current time reaches 2010:10:27 10:00 and until the current time reaches the 2010...
Is it possible that, using only query statements in my code (and not using select lock) I still get tables locked for some time because of the way MySQL does the processing?
(for example, MySQL can lock while ordering the table, or something like that)
Is this possible or selects just don't lock?
...
I've got a require file that I use to display random products. On the home page it gets used twice, once in the main content section and then again in the sidebar.
The problem I'm having is the second require doesn't overwrite the first sql results, it adds to them? The results I'm actually getting for the 2nd set of results are the 1st...
Does MySql has the Interval datatype as PostgreSQL (or like TimeSpan in .net) does?
...
On click of a button in asp.net c# i defined the following method to insert the data into the database.
Is my insert query correct for mysql??I am not able to insert the data into the database. browser also is not throwing any errors.
Can anyone help me to sort out the problem in my code?
protected void Button2_Click(object sender, E...
Hi,
I've been trying to query an email address using the following statement, however after hours of trying to escape the string successfully I've accepted defeat.
The query I am using is: SELECT id, email FROM user WHERE email = '$email'
That gives me an error:
MySQL Error: You have an error in your SQL syntax; check the manual ...
I have entires, equipments, brands, times and seasons.
entries:
id
time
equipment_1
equipment_2
equipments:
id
id_brand
brands:
id
name
times:
id
id_season
seasons:
id
name
My actual SQL query is:
SELECT entries.*, times.id_season AS id_season
FROM entries, seasons
WHERE entries.time = times.id
But in the final qu...
I have a little complex Database model on which i am not able to make a proper find
user(id, name...)
1 Harsha
2 Jasmine
modules (id, name )
1 Users
2 Restaurants
3 Dishes
restaurant (id, name.... )
1 KFC
2 Pizza Hut
dishes (id, name, restaurant_id .. )
1 Cheese Pizza 2
items (id, module_id, item_id)
1 1 1 (refers to U...
Hi everyone.
I noticed that a script of mine became very slow, then I narrowed down to the problem: it was an Update query. The weird thing is that the SELECT query is very fast. The table has about 600,000 entries. And yes, id is UNIQUE PRIMARY KEY. Here are some examples:
SELECT * FROM `tmp_pages_data` WHERE id = 19080 LIMIT 0 , 30
...
Dear all,
I need your help....I'm working on a little Time Management Sytem for my compagny.
I have several tables, including this two tables :
Pointage
Id_check | id_user | week | time | …….
Users
Id_user | first_name | last_name | ………
I would like find a means to construct a report which give me all people who didn't check 5 day...
Hi,
I've got a signup/login system on my site, and I've made it so that if someone tries to sign up with a username that is already in use, it posts an error underneath the form. However, instead of posting the error message that I created, it returns a MySQL error "Error: Query was empty". Here is the code that I am trying to use to do...
Hi
I'm very very new at MySQL and was wondering if anyone could help me out.
I'm trying to build a procedure for my database and am using the following code.
CREATE PROCEDURE `createuser`(username VARCHAR(100), password VARCHAR(100), email VARCHAR(100)) BEGIN
DECLare returnValue int;
IF EXISTS(SELECT 'True' FROM User_Table WHERE(User...
I'm trying to add seconds to a date based on certain events that occur. Often times, if these events occur at the same time, too many seconds get added on. Here's how I am currently doing it in PHP and MySQL
$time_add_on = 15 - $seconds_left;
DATE_ADD(STR_TO_DATE(end_dt,'%Y-%m-%d %H:%i:%s'), INTERVAL '".$time_add_on."' SECOND
What t...
Why does the following query work within a Drupal Block, but not when part of a "custom content" in a pane within a Panels Page? It gives an error saying to check the syntax of the query near "AND node.type in....". Also, if I put it in a Block then display that Block inside a Panels Page, it works just fine. So while I've got this worki...
Hello,
I'm dealing with sql and my sql is not as good as my ruby, so I hope you can help me out.
I have da table that looks like this:
messages:
id INTEGER PRIMARY KEY AUTO_INCREMENT
to VARCHAR(255)
text text
shown DATETIME
For now my script generates this part depending on the number of online players.
"to = 'STEAM_0:0:xxx' OR to =...
Hi,
I wonder if it is possible to assign temporary/ virtual IDs for a query result?
For instance, I have this as my query,
SELECT
pg_id AS ID,
pg_url AS URL,
pg_title AS Title,
pg_content_1 AS Content
FROM root_pages
ORDER BY pg_created DESC
output:
ID URL Title Content
53 a A xxx
40 b B xxx
...
select count(distinct id) from svn where name='ant' and type='Bug'
and
select count(distinct id) from svn where name='ant' and type='Feature'
Is it possible to combine them into a single query that might reduce the execution time compared to running them individually?
Thanks for answering.
...