I'm building a simple calendar for holiday cottages to show when they are booked or available.
What would be the fastest mysql table design for this, bearing in mind when users mark dates as available/booked they will do so via a start date and an end date.
i can see 2 obvious options
Store 'booked' data for every day [more rows]
or, store 'booked' data with 2 columns a start_date and end_date [more processing?]
Which is best or is there another method i'm missing?
How can I restore a mysql database that was dropped using a "drop database" command? I have access to binary logs which should make this type of rollback possible.
hi
I have the following simplified tables:
CREATE TABLE recipe(id int, name varchar(25));
CREATE TABLE ingredient(name varchar(25));
CREATE TABLE uses_ingredient(recipe_id int, name varchar(25));
I want to make a query that returns all id's of recipes that contain both Chicken and Cream.
I have tried
SELECT recipe_id FROM uses_ingredient INNER JOIN
(SELECT * FROM ingredient WHERE name="Chicken" OR name="Cream")
USING (name) GROUP BY recipe_id
HAVING COUNT(recipe_id) >= (SELECT COUNT(*) FROM theme);
which gives me :"ERROR 1248 (42000): Every derived table must have its own alias"
and is probably wrong too.
Next I tried
SELECT recipe_id FROM
(SELECT * FROM ingredient WHERE name="Chicken" OR name="Cream") AS t
INNER JOIN uses_ingredient USING (name)
GROUP BY recipe_id HAVING
COUNT(recipe_id)>= (SELECT COUNT(*) FROM t);
which gives "ERROR 1146 (42S02): Table 'recipedb.t' doesn't exist"
I want to avoid creating temporary tables including using ENGINE=MEMORY.
As i am a newbie to fluent nhibernate i would like to get step by step tutorial that explains configuring mysql with fluent nhibernate and retriving a table data from it... Any suggestion....
I am generating tables from classes in .NET and one problem is a class may have a field name key which is a reserved MySQL keyword. How do I escape it in a create table statement? (Note: The other problem below is text must be a fixed size to be indexed/unique)
create table if not exists misc_info (
id INTEGER PRIMARY KEY AUTO_INCREMENT NOT NULL,
key TEXT UNIQUE NOT NULL,
value TEXT NOT NULL)ENGINE=INNODB;
Hi,
I am trying to make a dynamic form which retrives data. How can I use javascript to load a value from a mysql database?
I understand that it must use php in some way, and I know how to query the database and assign the value to a php variable, but I have no idea what to do after that...any advice?
the goal is to have someone enter their orderid say, then the datbase auto pulls down and enters their last invoice in the field below it after they click GO...
I have a table in mysql with a row called 'newrelease'. If the item is a new release my form posts it as 'yes' if no 'no'.
How would i display all items that contain the data 'yes'?
$query = "SELECT * FROM movielist ORDER BY newrelease DESC LIMIT 4";
I am getting "ASCII encoding" errors when I insert into my database because I did a fresh install of the MYSQL.
I'd like to change the default to UTF-8 again.
I am creating application for MAC using cocoa framework, I would like to know how and what are the ways i can connect to MySql database using cocoa framework.
I am generating tables from classes in .NET and one problem is a class may have a field name key which is a reserved mysql keyword. How do i escape it in a create table statement? (Note: The other problem below is text must be a fixed size to be indexed/unique)
create table if not exists misc_info (
id INTEGER PRIMARY KEY AUTO_INCREMENT NOT NULL,
key TEXT UNIQUE NOT NULL,
value TEXT NOT NULL)ENGINE=INNODB;
I have a MySQL query that:
gets data from three tables linked by unique id's.
counts the number of games played in each category, from each user
and counts the number of games each user has played that fall under the "fps" category
It seems to me that this code could be a lot smaller. How would I go about making this query smaller. http://sqlfiddle.com/#!2/6d211/1
Any help is appreciated even if you just give me links to check out.
How can i find out if there is transaction open in mySQL? I need to start new one if there is no transaction open, but i don't want to start new one if there is one running, because that would commit that running transaction.
I have a query where the user types a block of text in a textarea field. They are able to save this information in a database. The problem is that if they have not changed the information or if the information matches the data already in the database, I recieve a '0' for affected rows. Usually I display an error that says the query failed when there are no affected rows. How would I 'know' that the 0 affected rows is because the data already exists, so that I can display a more specific error?
When stepping through a script in MySQL Query Browser's script window, is there any way to view the value of a variable I have just assigned?
Specifically I do an update on one line, and then:
SET @Num=row_count();
While debugging the script, I would like to be able to know the value of @Num
Hi everybody,
Is there a "known limit" for columns & rows in a mySQL table that when passed, it can be safe to say that performance is severely affected?
I've think that I had heard that there is a "golden number" that you really dont want to exceed in either columns or rows in a table. - Or is it all about the size of the index and available RAM + CPU on the server?
Thanks!
I have a keyword field with a list of 5 keywords for each item. example below:
2008, Honda, Accord, Used, Car
Will MySQL full text return the item above for the following search requests?
2008 Honda Accord
Honda Accord
Used Car
If so, how well will this hold up when searching through fifty thousand plus records?
Hello, in my web page a user fill a form who send information to a MySql database. One of the data inputs sent is a date/time, in the format date('l jS \of F Y h:i:s A');
(I can change the format as needed)
So when the user submits the form i wanna check if the actual time/date is 30 seconds more than the sent time/date in order to allow or not the submission of the form. Thanks!
What are the most efficient SQL queries that would take an existing MySQL table and re-sort it by one of the columns? Not a selection, but the whole table should be sorted by one column. Somehow using a temporary table, I guess, but what's the best way?
I would like to pass a MYSQL query via Coldfusion the following date: 03/13/2010
So the query filters against it like so:
SELECT *
FROM myTable
WHERE dateAdded before or on 03/13/2010
I'd also like to be able to take 2 dates as ranges, from: 01/11/2000, to: 03/13/2010
SELECT *
FROMT myTable
WHERE dateAdded is ON or Between 01/11/2000 through 03/13/2010
thanks
is there a way to insert pics(not url,the pic)into a MYSQL table made with phpmyadmin?
and if there is when i want to get that picture and insert it in the page , what should i do? :)
I'm just getting my head around java (and OOP for that matter), the only thing I am familiar with is MySQL. I need to keep the DB connection open throughout the duration of the application, as well as a server socket.
I'm not even sure if they both need separate classes, but here's what I have so far:
http://pastebin.com/qzMFFTrY
(it wouldn't all go in a code tag)
The variable I need is con for line 86.
How do i decrypt an aes encryted column when using flash/flex to display the table data?
adobe flex connected using php connection class to mysql
for php, we would use aes_decrypt()
however i am not sure how i can get flex to do this.