mysql

operator precedence in mysql

Which operator: / or * will have the higher priority in MySQL? ...

How to store "wishlist" in database?

I am thinking of creating a "wishlist". Each user will be able to purchase wishes in a shop. How do I store the wishlist? I am thinking of creating an user table and a wishlist table. The structure of user table: Columns: id, username, password etc Columns: id, wish, price, quantity etc user id is the primary key for user table and i...

webservice: error in code or connection

Hi, I have a problem in my code or connection I think... I tried to connect to a MySQL database and web service, but when I run the program, it gives me the following error: @WebService() public class LostNumWebService { /** * Web service operation */ @WebMethod(operationName = "getCategory") public List getCategory(@WebPar...

MYSQL: Can you pull results that match like 3 out of 4 expressions?

Say I have a query like this: SELECT * FROM my_table WHERE name = "john doe" AND phone = "8183321234" AND email = "[email protected]" AND address = "330 some lane"; But say I only need 3 out of the 4 to match, I know I can write a very long query with several ORs but I was wondering if there was a feature for this? Thanks. ...

Optimal Way to Store/Retrieve Array in Table

I currently have a table in MySQL that stores values normally, but I want to add a field to that table that stores an array of values, such as cities. Should I simply store that array as a CSV? Each row will need it's own array, so I feel uneasy about making a new table and inserting 2-5 rows for each row inserted in the previous table. ...

What resources exist for Database performance-tuning?

What good resources exist for understanding database tuning on the major engines and advancing your knowledge in that area? The idea of this question is to collect the shed load of resources that invariably exist, so that people can have a "one stop" knowledge shop of the good, peer approved resources. General SQL Book: SQL Perform...

Company vs Employee ID dilema

I have two tables in my SQL database: Company: - ID (autoincrement) - name - address - ... Employees: - ID (autoincrement) - Company_id - internal_id - name - lastname The problem is that I would like to have a employee id (internal_id) that is relative to the company they belong to. I got this dilema since I'm really been se...

Storing ascii and binary data with in a single tab-delimited file

I've fallen into a situation where it would be advantageous to store both ascii and binary data within a tab-delimited file. My initial attempts were horrendous. Is this even worth pursuing? Any advice? I'll need to be able to cleanly parse the resulting tab-delimited file easily. Down stream, this data is going into a MySQLdb. And it wo...

Are MySQL Triggers Asynchronous

When an AFTER UPDATE or AFTER INSERT trigger is fired is it a synchronous or asynchronous event? In other words does it hold up the total execution time of the query that tripped the trigger? ...

MySql query, combine tables

I have two MySql tables, one containing food and one containing recipes (groups of foods). The recipe-table have a title and then has a item-table containing all food in that recipe. That table is linked to the food-table. Now I need to combine these tables and list them togheter. Food-table: foodid | title | calories 1 banana...

I want to save the contenes of a web page content(php)

I have a site which has a page that shows the user a set of workout sessions in each table. The exercises in the sessions are href links and cannot be sent to the database as variables. The links are displayed in tables on the page which is another reason why I can't send them to the database. How can I save the state of the web page, (...

How to get the sum of a column from combined tables in mySQL?

I've been trying to write a mySQL-statement for the scenario below, but I just can't get it to work as intended. I would be very grateful if you guys could help me get it right! I have two tables in a mySQL-database, event and route: event: id | date | destination | drivers | passengers | description | executed route: name ...

Defining a table with sqlalchemy with a mysql unix timestamp

Background, there are several ways to store dates in MySQ. As a string e.g. "09/09/2009". As integer using the function UNIX_TIMESTAMP() this is supposedly the traditional unix time representation (you know seconds since the epoch plus/minus leap seconds). As a MySQL TIMESTAMP, a mysql specific data type not the same than unix timestam...

MySql: Selecting from multiple tables

Hello guys, i dont know how to go about this but i need urgent assistance from you guys. I have two tables namely States, Package_Details. Below are the details of the table. States state_id state_name Package_Details id sender_state //Stores state with state ID receiver_state //Stores state with state ID ...

Cannot connect to remote MySQL DB from GoDaddy

I developed an ASP application (VBScript backend, JavaScript frontend) that makes use of a remote MySQL database (Bugzilla). The applicaiton works well on a localhost, yet fails to work when uploaded to GoDaddy. Spending two hours on the phone with GoDaddy's support didn't help... The error I'm getting is: =============================...

Group Union

I have the following query that always give me two rows. I want to group them to one row using tbluser.userid, is it possible to group a union? SELECT SUM(tblfooditem.calories) FROM tblfooditem INNER JOIN tbluser ON tblfooditem.userid = tbluser.userid WHERE tblfooditem.userid=?userid AND tblfooditem.date=?date GROUP BY tbluser.user...

MySQL database change tracking

Hi! What tools are you using to track changes in your MySQL database? Currently I'm in a project where we use a plain text-file (version controlled via SVN) in which we manually add SQL statements when making changes to the database.Many of the changes magically disappears every now and then, and we are now looking for a better way to c...

What is the equivalent of 'go' in MySQL?

In TSQL I can state: insert into myTable (ID) values (5) GO select * from myTable In MySQL I can't write the same query. What is the correct way to write this query in MySQL? ...

size limit of a mysql query ruby/mysql

Hello everyone, I hope this is the appropriate place to ask my question. My mysql query currently looks like this @records = Record.find(:all, :select => "`records`.id, records.level as level, (SELECT (count( b.id ) + 1) FROM records as a, records as b WHERE a.id = records.id and b.skill > a.skill and b.created_at ='#{vandaag}' ...

In MySQL how do retrive multiple values from a Search form with three fields?

Hi. I have a two tables: Clients Cities Then in the search form I have three fields: A text input form to fill with the name of the client A select box to choose the city where they want to search(table cities) Another select box to choose the main business that the user wants to search for(businness is included in the clients tab...