mysql

How to update a Single Character in a mysql table which contain number of Fields.

Hi all, I am having Maracaïbo as one of my fields. Now i need to update it into Maracaibo. In simple i need to update the ï only. how can i do it. Example: city Maracaïbo Mïrïda My O/P should be like this: (Please note the "i" section) city Maracaibo Mirida how can i able to update both the fields using mysql update query. How...

Get SQL tables only not views?

Hi Friends, SHOW TABLES This lists the view also. But I don't want the view in the list. How can I write the Query and get that? I am using Mysql 5 and MyIsAm is my DB engine. ...

mysql optimisation

Hi guys, I have a photo gallery with 1.5 million photos so we are talking a big database. We want to make it so that people once they have uploaded a photo can upload into several different areas of the site. Photos also have attributes and tags and we have a tables for that as well. here is the layout PHOTO TABLE photo_id image status...

Can I use MySql Create Select on two different servers with PHP?

Hi, I am trying to use PHP and MySQL's Create Table Select between two different MySQL servers. I am not sure this can be done like this with SQL. I get no errors but I get nothing done either: <?php $dbname = 'cms'; $dbmaster = 'cmsms'; $db1 = mysql_connect('localhost', 'root', 'secret'); if (!$db1) { echo 'Could not connect to ...

MySQL permissions -- can't create functions even with the 'CREATE ROUTINE' grant

When connecting to my server (from a different machine) I get Error Code: 1044 Access denied for user 'username'@'%' to database 'dbname' when I try to create a function. But when I look at my permissions SHOW GRANTS FOR CURRENT_USER; I get 'GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFER...

Very complex Group By / Unique / Limit by SQL-command

Hi there, I actually don't even know how to call this :P, but... I have one table, let's call it "uploads" id owner date ----------------------------- 0 foo 20100101120000 1 bar 20100101120300 2 foo 20100101120400 3 bar 20100101120600 .. .. .. 6 foo 20100101120800 Now, when ...

how to use em.merge() to insert OR update for jpa entities if primary key is generated by database?

I have an JPA entity like this: @Entity @Table(name = "category") public class Category implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "id") private Integer id; @Basic(optional = false...

Mysql procedure to modify limit and offset

Just a thought in my mind but would it not be possible to createa function in MySQL that can modify the LIMIT within a query The clause would be a simple calculation function that would work out the offset depending on the pageno * perpage Example SELECT * FROM items PAGE(4,20) this would be the same as SELECT * FROM items LIMIT 10...

How to get a row-by-row MySQL ResultSet in Jython

I'm migrating some code from Python to Jython, and it currently uses MySQLdb.cursors.SSCursor to fetch the rows one by one instead of loading them into memory in bulk. In Jython, I'm using zxJDBC to connect to the database, but I see no reference to SSCursor, and very few search results for zxJDBC and TYPE_FORWARD_ONLY, which is the Jav...

MYSQL import: port a big list of names into mysql table column. An easy way?

I have a txt file with tons of complex names I want to insert into my sql table named cred_insurances. The table is currently blank. Each line should be one record and the name should be in the column called ProviderName. My text file is like this: Alabama Medicaid Alaska Medicaid Arizona Medicaid (AHCCCS) Arkansas Medicaid California M...

Mysql -> what is the best dinamic column soulution for advertisement webpage?

I'm developing website in which will be categorized advertisements. In each category will be possible different fields of input (example: for car there will be motor size, for cat there will be a race). So I'm thinking how to build database to manage this (I will use MYSQL database). One way you can see in attached picture, I know that a...

mysql search exact word with $ in word

I've been trying to find EXACT words and my research isn't helping me. Solutions I've found: $query .= "WHERE text REGEXP '[[:<:]]($word)[[:>:]]'"; // OR $query .= "WHERE MATCH(text) AGAINST('$word') "; but neither are returning my matches. I'm searching for stock symbols in my db (eg $aapl). And using LIKE '%$word%' will return $ba...

MySQL FK syntax: insert column called practice into table cred_insurances that is FK to table practices

I need to insert a column called "practice" into table "cred_insurances" that is a FK referencing table "practices" PK "id" ...

how to get index keys from mysql index?

i have an innodb mysql table with a varchar(100) field called 'word'. i created a btree index on an that field. if i do a query like select * from table where word = 'non-linear', i get all variations of that word. so results would include (Non-linear, Non-Linear, non-Linear, etc...). it seems to me that that index doesnt care about ...

Prevent user from accessing admin page [php]

I have a php login page with session control. It routes a normal user to info.php and an admin user to info_admin.php. If I login with a "normal" user it goes to info.php, however, in the address bar, I can go to info_admin.php and it doesn't kick me out, gives me access. How can I control this or prevent the user from doing this manuall...

Database tables, one table referencing multiple unrelated tables

This question has come up a few times in various forums in my searching, but none have provided a concise resolution. If I have the following tables: User +- id +- username +- password Article +- id +- title +- content and I want to join them in order to determine who created what articles, I could simply add the column user_id to A...

Foreign key null - performance degradation

I have table folder where column parent_id references on id if that folder has parent, if not then parent_id is null. Is that ok solution or I need extra table for this connection or other solution? Can foreign key be null at all, and if can is this solution will has bigger time execution ? table folder( id int primary key, ...

MySQL STR_TO_DATE glitch?

I'm running into a problem with MySQL's STR_TO_DATE function. For example, this code: SELECT STR_TO_DATE("Saturday October 23 2010 11:00 AM", "%W %M %d %Y %h:%m %p"); outputs this: 2010-00-23 11:00:00 Why is everything correct except the month? Is this an error in my syntax? ...

MYSQL - Difference between IN and EXIST

MySql question: What is the difference between [NOT] IN and [NOT] EXIST when doing subqueries in MySql. ...

MySQL with ASP.net and Membership

Hello guys i have made it after 2 hours to bind MySQL to .NET and to create a Membershipprovider Database from ASP.Net. Know i have the tables like aspnet_users. I just added a new table with the name friendsTable. This one have a row calles friendsUserId. If i now try to make a relation between frendsUserId and id from aspnet_users wil...