Very often, I want to run a query on one of my users where I want a row stored and associated with that user, in a 1-to-1 relationship. So let's say (this is just an arbitrary example), that I have a table that keeps track of a user's car, along with some info about the car. Each user can have either 0 or 1 cars. If the user has no ca...
http://i61.photobucket.com/albums/h79/hc_reborn/Pic1.jpg
http://i61.photobucket.com/albums/h79/hc_reborn/Pic2.jpg
http://i61.photobucket.com/albums/h79/hc_reborn/Pic3.jpg
http://i61.photobucket.com/albums/h79/hc_reborn/Pic4.jpg
Did you know how to setting this?
...
Hi,
I am trying to optimize my MySQL queries and I need some help. Here is my current query :
SELECT *,
(SELECT name FROM stores WHERE id = products.store_id) AS store_name,
(SELECT username FROM stores WHERE id = products.store_id) AS store_username,
(SELECT region_id FROM stores WHERE id = products.store_id) AS re...
DECLARE @ID INT ;
This statement parses fine with MS SQL Server, but gives me
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 'DECLARE @ID INT' at line 1
Does anyone have any idea about the reason?
...
We are running a stats site for a bunch of games, but after the log has tipped over 100 megs, things are starting to slow down, so we need to optimize our queries.
However, we've found out that what we thought was a simple query, takes about 1.5 secs:
SELECT handle,
(
SELECT COUNT(*)
FROM kills
WHERE killer=p.handle
AN...
I'm an experienced MS SQL Server developer
But with my first MySQL project I got problems with very simple issues
So can anyone suggest good resources helping me transfer my MS SQL Server knowledge into MySQL
I'm not looking for a complete reference guide for MySQL
I'm looking for something targeted for experienced SQL developers
EDI...
I tried to do this tutorial
http://www.linglom.com/2007/12/05/accessing-mysql-on-netbeans-using-jdbc-part-i-create-a-connection/
but it gives me an error. I searched to understand what the error means, but i don't know.
the error said :
Class Not Found Exception: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
I think t...
I'm working on a MySQL database which will create a "Today at" list and send it to subscribers. I'm wondering if it's better to use the DATETIME data type on the start and end fields, or two have two columns, startDate and startTime (with the appropriate data types). My first thought was to use DATETIME, but that makes subsequent use of ...
I've asked this question before, here, however that solution didn't fix it when I looked closely. This is the problem.
For some reason, my mysql table is converting single and double quotes into strange characters. E.g
"aha"
is changed into:
“ahaâ€
How can I fix this, or detect this in PHP and decode everything??
Previously i ...
A mysql database table has a column whose datatype is time ( http://dev.mysql.com/doc/refman/5.0/en/time.html ). When the table data is accessed, Python returns the value of this column as a datetime.timedelta object. How do I extract the time out of this? (I didn't really understand what timedelta is for from the python manuals).
E.g. ...
I have a TEXT column in a MySQL DB. The app is like a blog and the col contains the body of the "posts." I will be doing a lot of complex boolean searches on this column.
The MySQL docs say you need to set the index length for TEXT columns with a max length of 767 bytes for InnoDB tables.
Should I just set it to the maximum length? Is ...
Note: These are not homework problems. I am studying dbms on my own, hence these
homework-like questions.
Two tables :
Teachers (teacher_id, teacher_name)
Courses (teacher_id,course_id, course_name)
In order to select teacher names who are not teaching any courses, there are
two queries I can think of :
mysql> explain select teach...
Hello,
I have a local server where I do all my testing and work. Once I am done, I simply upload the db schema along with the relevant code. However the problem arises when I make some changes to the schema. I have to manually type the "alter table" query on my live server.
Is there a way to get the incremental changes that took place...
I have two tables :
teachers (teacher_id,teacher_name)
courses (teacher_id,course_id)
And I need to display names of the teachers, teaching maximum number of courses :
mysql> select teachers.teacher_name,tmp1.teacher_id,tmp1.cnt from (select max(tm
p.cnt) as tmpMax from (select teacher_id,count(teacher_id) as cnt from courses g
rou...
Hi! I want to retrieve these info for a mysql table using c#
1) Complete column definitions including name, size and data type, and extra info like null/not null, unsigned,auto increament, default values, if data type is enum, the accepted values
2) All constraints - Primary/Foreign/Check/Unique
3) All indexes
I can get column relat...
Hi,
I'm building a website that fetches text from another page and insert it into the database.
The problem is that all the special characters are saved in the database using the HTML encoding so then I need to convert the output using:
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
I mean, what I have rig...
In MySQL, how can I order my query by character count?
...
Hello,
Am not sure if this question makes sense. But I know all the basic CRUD commands of mysql. Probably a bit more here and there (foreign keys etc). But there are so many books written on mysql/dbms. I can write decent queries and get all my results as I want them. Maybe they aren't the most efficient but it worksforme. Thats becaus...
Is there a performance advantage to using enum in situations where there are only 5-10 different possible values for a field? if not what is the advantage?
...
I'm currently displaying a random row from all the entries and that works fine.
SELECT * FROM $db_table where live = 1 order by rand() limit 1
now, i'd like to limit it to the last 100 entries in the db.
every row in the db has an ID and a timestamp.
it's a small database, so overhead-minimization is not a priority.
thanks!
EDIT:...