Questions tagged as 'mysql'

2
answers

Is it redundant to use LIMIT in a QUERY whose ID is a primary key?

My question is if using LIMIT will there be some performance gain in QUERY . Example: SELECT descricao FROM produto WHERE id = 9999 LIMIT 1 Has better performance than? SELECT descricao FROM produto WHERE id = 9999...
asked by 17.05.2015 / 01:57
6
answers

Remove an undetermined number of "\" in a column in the database

The description field in the product table contains HTML generated by CKEditor (English) to escape content: <table cellpadding=\"\&quot;\\&quot;\\\\&quot;\\\\\\\\&quot;\\\\\\\\\\\\\\\\&quot;\\\\\\\\\\\\...
asked by 29.01.2014 / 13:37
2
answers

How to present the name of the customer of a particular sale? I can not get the name with the get

sales list code I'm having problem to present the customer name of each sale and product name of each sale tbm! I do not know what I'm doing wrong <?php include_once("Sessao.php"); include_once("Valida.php"); include_once("Cabecalho.p...
asked by 16.09.2015 / 20:30
1
answer

Invalid parameter error while doing PDO take action

I'm trying to learn how to use PDO, so I've already gone VERY looking for everything to understand it. So I'm at a point that left me pretty confused. I have the following code, it is the: _conecta_banco.php <?php class conectar_banco...
asked by 12.06.2014 / 05:42
1
answer

How to apply the IF ELSE condition to the selection of a column?

In MySQL, I have an old table entities where the gender column is formatted as ENUM , containing values of type "i", "m", "f". When migrating this data to the new structure of this table, I wanted to run a query on the database...
asked by 17.12.2013 / 13:42
1
answer

How to count the number of tables in MySQL?

I'm trying to count the number of tables in a MySQL database. I tried to do the following but returned a syntax error: SELECT COUNT(SHOW TABLES) How can I do this?     
asked by 05.08.2015 / 18:44
1
answer

Result when converting from minutes to hours

I have a query in which I have one example that gives the correct result and the other not when converting from minutes to hours. 1st example in minutes: SELECT A.Colaborador, SUM(A.'Horas Consumidas') AS 'Total Horas' FROM (SE...
asked by 08.05.2018 / 12:09
2
answers

LIKE query performance in MySQL

Is there any way to increase the performance of a query with LIKE '%string%' in MySQL? I know that if LIKE is 'string%' , it is faster. The problem is when % is at the beginning of the string. Is there some sort of...
asked by 13.08.2014 / 03:33
3
answers

Check if a date and time (timestamp) represents the current day

I have a table with the following field: dh_envio (TIMESTAMP) and I want to mount a query to get all the records of this table in which the dh_envio is equal to the current date (TODAY). I thought of it as follows: WHERE dh.envio BEETWEEN '...
asked by 18.02.2014 / 02:13
3
answers

Create database on the server via mysql-workbench template (.mwb) via command line

I'm trying to build a bat to create the database in the mysql server from a mysql-workbench EER (.mwb) model, that is, in command line, is it possible to perform this process? Could someone give a light? Editing: Opening it in cmd I have...
asked by 02.06.2015 / 19:05