Questions tagged as 'mysql'

1
answer

Query in MySQL does not sort correctly

I have a game table called game , a game platform table called plataformas and a table that makes the N-to-N relationship between the two calls game_plataforma . I have a query that has to search for a gaming platform, but...
asked by 08.01.2017 / 00:44
1
answer

What are the differences between the HASH and BTREE algorithms used in an index?

I realized that I can create two types of indexes for a determining field in HeidiSQL, which use the algorithm HASH or BTREE , see below: See the CREATE code for a sample table for the illustration: CREATE TABLE 'pessoa'...
asked by 25.11.2017 / 18:50
1
answer

How to restore database to recover data?

Does Mysql exist any automatic backup system? In my table there was a CNPJ field that contained CNPJs and CPFs, it was type varchar I changed to type int and screwed it all.     
asked by 30.08.2017 / 17:57
1
answer

Variable comparison in C, and MySql field [duplicate]

I am trying to compare the name variable entered by the user, with the value obtained in the column name MySQL . char name[45]; //declarando variável name scanf ("%s", &name); //Lendo variável name mysql_query (&mysq...
asked by 12.11.2016 / 20:45
2
answers

How to sort by average and quantity (weight)?

I have this query in MySql : SELECT dealers.id, COALESCE (AVG(rating), 0) AS media, COALESCE (COUNT(dealer_ratings.id), 0) AS qtd_avaliacoes FROM 'dealers' LEFT JOIN 'dealer_ratings' ON 'dealer_ratings'.'id_concessionaria' = '...
asked by 19.08.2016 / 13:38
2
answers

How to use WHERE function in column created from a formula?

I wrote this code: SELECT produtos.id AS id, nome_produto AS Nome, SUM(estoque.Estoque_produto) AS Estoque, Periodicidade AS Periodicidade, produtos.estoquemax_produto AS 'Média de venda mensal', IF(SUM(estoque.Estoque_produto) > produt...
asked by 26.09.2016 / 15:38
1
answer

Select with two tables and one condition in each with MYSQL [closed]

I have two tables that do not relate. One is of reports, where it contains the name of teachers and their respective subject, the other table is called login, which contains credentials of each teacher, their privilege and also their respective...
asked by 26.09.2016 / 14:56
2
answers

How to insert all array values and avoid $ query-execute () at every execution of foreach?

How to insert all array values and avoid $query->execute() with each foreach execution? $_POST = json_decode(file_get_contents('php://input'), true); $sql = "INSERT INTO teste(nome, email) VALUES (:nome, :email)"; try{ $query=...
asked by 30.12.2016 / 16:36
1
answer

CRUD PHP Do not update and give no error

I'm having problems when I try to run an UPDATE on my system in PHP + MySQL. I have the file code edit: <?php require_once 'init.php'; // resgata os valores do formulario $nome = isset($_POST['nome']) ? $_POST['nome']: null; $nasciment...
asked by 02.01.2017 / 22:34
1
answer

Which correct way to do UPDATE

Friends this error ( SQLSTATE[HY093]: Invalid parameter number: parameter was not defined ), what is the correct way to apply UPDATE according to the code below? DB fields id_seguradora nome_seguradora cnpj_seguradora tel_segurado...
asked by 14.01.2017 / 15:53