I need to implement custom fields in a booking software. I need to extend some tables containing, for example, the user groups with dynamic attributes. But also, a product table where each product can have custom fields (and ideally these fields could be nested). I already made some searches about EAV but I read many negative comments, so I’m wondering
Tag: mysql
inner join with condition on joined table
I’m trying to collect data using the following query: SELECT * FROM `table1` AS `t1` INNER JOIN `table2` AS `t2` ON `t1`.`id`=`t2`.`id` WHERE `t2`.`name`=’myname’ It looks like the WHERE …
Join two tables only if a value is null or a specific number
I have three tables in a database: Product table – +100000 entries Attribute table (list of possible attributes of a product) Product attribtue table (which contains the value of the attribute of a product) I am looking for 8 random products and one of their attributes (attribute_id = 2), but if a product hasn’t this attribute it should appear at
mysql allow invalid dates on select
For some reason, I can’t even select invalid dates in my table. How do I force select? I just receive: select * from table >> Mysql2::Error: Invalid date: 1900-00-00 I’m not trying to insert, …
MySQL ON DUPLICATE KEY UPDATE syntax error
I was wondering if anyone can spot any mistakes in my sql statement. I would like it to insert a new record into my table if one doesn’t exists already. If it does exist then just update it. My primary key in the date field. Here is my statement as it appears in php and also the error I’m getting:
Is there a way to change DATE format on?
I need to store some date in my SQL database, the problem is that the default storage is And I need My only solution was to store date as Varchars (10) and it’s working pretty well, but now I can’t order my queries by DATE, and I need to order them from the oldest to the newest… Answer There is
Export table description in PHPMyAdmin/MySQL
DESC table_name Above SQL allows me to get the table description in PHPMyAdmin. I want to export it to a text file or word file for the documentation. Is there a possible way to do it. Thanks.
Inserting NULL into MySQL timestamp
I’m observing unexpected behavior with inserting/updating NULL in a MySQL timestamp column. Consider the following statements. The first insert (when hiredate is not specified in the SQL, hireDate is null(0) which is expected. However when an explicit null passed in SQL, the current date time is inserted which is unexpected. Why does this happen? Note: Hibernate uses second type of
SQL query to find Primary Key of a table?
How can I find which column is the primary key of a table by using a query?
How to separate DATE and TIME from DATETIME in MySQL?
I am storing a DATETIME field in a table. Each value looks something like this: 2012-09-09 06:57:12 I am using this syntax: Now my question is, while fetching the data, how can get both date and time separately, using a single MySQL query? Date like “2012-09-09” and time like “06:57:12”. Answer You can achieve that using DATE_FORMAT() (click the link