mysql

Any good relational database tutorials?

I am looking for how to build a relational mysql database, and I would like to follow a tutorial. I need one that shows how to make multiple tables, and link those together using an id. Which I can later use to grab relational data from the different tables. This is probably easy stuff, but I am just learning about databases. Thank...

SELECT query slow when flag column is a constraint

I have a fairly simple table called widgets. Each row holds an id, a description, and an is_visible flag: CREATE TABLE `widgets` ( `id` int auto_increment primary key, `description` varchar(255), `is_visible` tinyint(1) default 1 ); I'd like to issue a query that selects the descriptions of a subset of visible widgets. The f...

Can mysql 4.0.23 be used for multi-language data storage?

I developed my PHP program with MySql5 (utf8) and have to ouput data to a server running MySql 4.0.23. Unfortunately I found the non-English characters shown in PHP pages (still readable when viewed in phpMyAdmin) are all become non-meaningful words! If my data just contain Chinese, just simply set system charset to BIG5 will solved the...

Ordering by the difference between two averages

I have a single table called orders. It has 3 fields I care about: price, type, and bid. Bid is an int with either 0 or 1 depending on if the order is to buy or sell something. 1 is buy, 0 is sell. orders |typeID |price |bid| |1 |10 |0| |2 |20 |0| |3 |30 |0| |4 |50 |0| |1 |80 |0| |2 |...

How to you insert into MySQL database and returns its id in PHP PDO?

Is there a way to insert into MySQL database using PHP PDO and return its id? Or I will just have to search fot its id after insertion? ...

Defining Column Datatypes in MySQL Views

In an Access app, I've linked to MySQL tables. I have also linked to a View. A couple of the View columns have been mapped by Access as Memo, and one as OLE Object(!). They should be Text(255). Is there any way that I can define the columns in a View? MTIA ...

MySql cache problems... some questions

First of all, I am using PhpMyAdmin, is this okay or not? Because when I have cache disabled, and do two queries after eachother, the second query always is faster, so I am thinking maybe there is an internal cache on PhpMyAdmin? Secondly, is there any way to get the time of how long a query takes, into php, and echo it onto the browser...

query_cache_min_res_unit; What is it and what does it do?

I am setting up cache in MySQL. Could someone please explain query_cache_min_res_unit? What does it do etc? I have read the manual and it doesn't explain so good. Details are appreciated... Or examples... Thanks ...

how to insert records in 2 mysql tables

I'm trying to insert records on multiple mysql tables with similar entities(a normalized table) I tried to do this but I get an error. I've also seen joins but it seems to work only when retrieving data. insert into t1(pnum, hospnum) values('117', '656') insert into t2(TELNUM, HOSPNUM) values('9981235', '676') ...

PHP Mysqli inserting a row to a table with auto_increment column

Im working on a table that has 4 columns and the first one is an auto incrementing integer called id. If im going to insert into this table using mysqli prepared statements I keep having trouble inserting a query that works. Using PHPmyAdmin It tells me to give it NULL. Ive tried this: $query = "INSERT INTO tbl (id, col2, col3, col4) V...

How can I improve my MySQL server variables for my configuration?

I am new to database management. My application is very database intensive so I've tried really hard to make sure the application and the MySQL database are working as efficiently as possible together. Currently I'm tuning the MySQL query cache on a 6 gb RAM, quadcore processor computer. My current MySQL is configured as follows: qu...

How can I dump a MySQL database from mysql c library.

I want to archive my database of mysql. Kindly give me some guide lines how I can make it possible, I am using mysql c library for insertion and selection etc. I dont know how to use dump command. ...

is there any limit on the number of rows one can select in MySQL ?

Hi, There are 1652487 rows in my table in MYSQL. I want to copy all the values corresponding to one field into a file. I wrote a java program in netbeans using jdbc driver for this. I'm unable to do this at one go. Is there a way out ? < Is there any limit on the number of rows one can select > [ EDIT ] my code : action performed when...

can i return a custom result after reviewing a stored procedures' result?

I want to return custom values as the values of the rows in case when no rows are fetched by executing the stored procedure - is there a way to do that? ...

SQL query to show most ordered product

I have this table structure Product product_id (PK) name Order_Detail order_detail_id product_id quantity Example data Product : 1 product1 2 product2 3 product3 4 product4 5 product5 Order_Detail : 1 3 2 2 3 1 3 3 1 4 2 1 5 2 1 6 1 1 7 4 1 8 5 1 9 1 1 10 2 1 11 3 1 Please help me to get top 3 ordered product based on how m...

Defined patern for mysql table primary key

Hi, is there anyway to create lets say pattern for primary key i.e. for table products such pattern would by p-1,p-2... p-n etc. Thanks ...

MySQL match against - IN BOOLEAN MODE?

Hi there, I'm using PDO to execute a MATCH AGAINST query. The following returns nothing: SELECT title, author, isbn, MATCH(title, isbn) AGAINST (:term) AS score FROM books WHERE MATCH(title, isbn) AGAINST (:term) ORDER BY score DESC LIMIT 0,10 Where as this returns perfectly: SELECT title, author, isbn, MATCH(title, isbn) AGAINST ...

What's the best database structure to keep multilingual data?

Here's an example: [ products ] id (INT) name-en_us (VARCHAR) name-es_es (VARCHAR) name-pt_br (VARCHAR) description-en_us (VARCHAR) description-es_es (VARCHAR) description-pt_br (VARCHAR) price (DECIMAL) The problem: every new language will need modify the table structure. Here's another example: [ products-en_us ] id (INT) name (VA...

how can i pass xml format data from flex to python

Hi i want to pass xml format data into python from flex.i know how to pass from flex but my question is how can i get the passed data in python and then the data should be inserted into mysql.and aslo i want to retrieve the mysql data to the python(cgi),the python should convert all the data into xml format,and pass all the data to the f...

Possible to 'Show MySQL Variables' with PHP code onto the browser?

Is this possible: mysql_query("SHOW VARIABLES LIKE 'query%'"); in php? If so how can I display the variables onto the browser? If it is not possible, which mysql command tool is easiest and free to download? Thanks ...