mysql

differences between procedure and function and routine?

in mysql database context, what is the difference among these 3 terms? stored procedure,stored routine,stored function. p.s. build-in functions like those date time functions, (weekday()) are considered as what? thanks in advance! ...

trigger problem in mySql database

I have this code (mySql 5.1.36) CREATE TRIGGER problem_description AFTER INSERT ON problem_description FOR EACH ROW BEGIN INSERT INTO log SET Id=NEW.Id,user_name=NEW.user_name; END; and have this error: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax...

Migrate a Django project from MySQL to Oracle

Hi, I have a Django1.1 project that works with a legacy MySQL db. I'm trying to migrate this project to Oracle (xe and 11g). We have two options for the migration: - Use SQL developer to create a migration sql script. - Use Django fixtures. The schema created with the sql script from sql developer doesn't match the schema created from ...

CakePHP Form Helper Database Interaction

Currently I am developing a CakePHP that will list various businesses. In the database, there is a table for businesses that lists them like so: id | name | address | city | state | state_id | zip | url The state column are abbreviations of states (for listing purposes) CA, AK, FL, etc and the state_id matches up with the id...

PDO and SQL IN statements

Im using a sequel for search like this using PDOs $states = "'SC','SD'"; $sql = "select * from mytable where states in (:states)"; $params = array(':states'=>$states); and I use my function $result = $this->selectArrayAssoc($sql, $params); where my selectArrayAssoc function as following public function selectArrayAssoc($sql, $params...

i want to fire atrigger after data has been inserted in a tablein mysql

dear all, i want to fire a trigger after my table has been filled woth reords ,i dont want to fire a rowwise trigger.please tell how can we do that in mysql. ...

SQL Count Query with Grouping by multiple Columns

I have a table with three filled columns named "Name", "City" and "Occupation". I want to create a new column in the same table that contains the number of people who have the same occupation. "Name" | "City" | "Occupation" ------------------------------ Amy | Berlin | Plumber Bob | Berlin | Plumber Carol | Berlin | Lawyer David ...

while Reseting auto increment for a particular table, query is taking long time to update in MYSQL

"ALTER TABLE tablename AUTO_INCREMENT = 10000000 " taking long time to update. why? i need to get optimize this query. Please help ...

NHibernate MySQL Mapping Set Column Type

In my MySQL database, I have the following column type. Field | Type | Null | ---------------------------------- Column_priv | set('Select','Insert','Update','References') | No | And I cannot figure out what to map this to. Can anyone tell me how I can map this to something? ...

Decimal VS Int in MySQL?

Are there any performance difference between decimal(10,0) unsigned type and int(10) unsigned type? ...

MDB2, Pear, Mysql error

Hi Guys, I have PEAR, MDB2 and Mysql Driver installed however I keep getting: Fatal error: Call to undefined function: MDB2_Driver_mysql::_isNewLinkSet(). in /home/**/PEAR/MDB2.php on line 1937. The Server is CentOS I am stuck, any help would be appriciated. Thanks :) ...

multiple updation using single mysql query

I need to update multiple rows with different values.Is it possible to do in mysql? ie,some thing like this UPDATE landing_page SET (rotation_slot_begin='0',rotation_slot_end='0.333333333333' where landing_pageid=265),(rotation_slot_begin='0.333333333333',rotation_slot_end='0.666666666667' where landing_pageid=267),(rotation_slot_begin=...

Need to find current connections in mysql media server log table.

Hi, I have a media server logging to a mysql database and it records a seperate row for each connect, play, stop, disconnect event. What I would like to do is find connect events that do not have a related disconnect event or play events that do not have a related stop event. date time category event clientId ...

Best way to list online users with PHP but without MySQL?

Hi, I want to make a script that will list online users when they enter a page. Simple way is record newly entered users into MySQL and list them for example every second. But I don't think it's a good idea with tons of users like in a facebook app come in and out of the page. There would be a way with Flash and PHP sockets but I really ...

Is there a way to listen for changes in an MySQL database table using Java and JDBC?

I have a number of users which are logged in at a time in my desktop application. They are working on the same table (create, read, update, delete data) so I have to update their views, to reflect changes, every few seconds - currently I am thinking to use a different thread to do that. I am using the MySQL database engine. Is there ...

disparity in query results

hey, i downloaded two databases off the mysql site (classicmodels and sakila). after running a few queries, i'm puzzled. the table orderdetails in classicmodels db has rougly 3k rows. when i search for one row (using different columns, i get these results): primary key:0.0027s other columns:0.0042s and 0.0054s the table rental in t...

How to design this simple database?

I have 2 tables - one storing user information (id, username, password) and the second one storing information about events (id, name, description, date, username(represents the user who created the event)). I would like to implement 'favourite events' functionality. This would allow the user to store his favourite events and later displ...

Locating current mysql my.cnf

Hi All, I'm trying to determine which my.cnf mysql is using. Is there a command or something for mysql or mysqladmin that shows which one is being loaded? ...

Why isn't my query using any indices when I use a subquery?

I have the following tables (removed columns that aren't used for my examples): CREATE TABLE `person` ( `id` int(11) NOT NULL, `name` varchar(1024) NOT NULL, `sortname` varchar(1024) NOT NULL, PRIMARY KEY (`id`), KEY `sortname` (`sortname`(255)), KEY `name` (`name`(255)) ); CREATE TABLE `personalias` ( `id` int(11) NOT NU...

Get Stored Proc Schema name in mysql

I would like to get the schema name string of a stored proc inside the stored proc itself. I don't know if it's possible because I didn't find any information about it. Exemple : DELIMITER $$ DROP PROCEDURE IF EXISTS `exemple` $$ CREATE DEFINER=`root`@`%` PROCEDURE `exemple`() BEGIN DECLARE schema_name VARCHAR(100) DEFAULT NULL; S...