Questions tagged as 'mysql'

2
answers

How to remove a foreign key in mysql?

I need to edit a table, but I can not remove it. I need to remove the foreign key, but all the commands I tried did not work. I'm currently tempting the alter table tabela drop foreign key nomefk And the error always happens saying that...
asked by 14.02.2018 / 19:22
2
answers

How to get the current date in MySql?

I want to create an event so that every hour verifies that the expiration date of the advertisement is higher than the current date, in which case it should change a topic of this ad in the database, that is, it would be something of the kind th...
asked by 29.04.2015 / 17:01
6
answers

How to do the following query without using INNER JOIN?

I have table A with the following fields: ID | ID_PAIS_ENVIO | ID_PAIS_RECIBO 1 | 23 | 47 //... I have table B with the following fields: ID | NOME_PAIS 23 | Brasil 47 | Portugal //... I need a query that returns the follow...
asked by 02.07.2014 / 15:50
3
answers

How to query in MySQL with two different conditions in WHERE

I have two queries that work perfectly apart, but I needed all of their records together. They would be these: SELECT b.idBanca AS idB, b.DataHora AS dataHora, b.Sala AS sala, t.idTrabalho AS idT, p.Nome AS orientador, a.Nom...
asked by 09.12.2014 / 04:11
4
answers

Convert MySQL data (YYYY / mm / dd h: m: s) to dd / mm / yyyy

Look at my database: I'musingthefollowingcode:<?php$data=$noticia->data_cadastro;setlocale(LC_ALL,"pt_BR", "pt_BR.iso-8859-1", "pt_BR.utf-8", "portuguese"); date_default_timezone_set("America/Sao_Paulo"); echo strftime("%A, %d de %B de...
asked by 23.02.2015 / 14:56
5
answers

How to create a view in mysql by taking data from 3 tables and repeating the different columns in the result?

I have the tables: +----------Tabela-1--------+ id | nome | cnpj | qtd1 1 | carlos | 0563233 | 4 +--------------------------+ +----------Tabela-2--------+ id | nome | cnpj | qtd2 1 | carlos | 0563233 | 6 +-------------------...
asked by 18.06.2014 / 14:20
3
answers

How to group SQL results by month and year?

I would like to know how I can query the MySql database and group the records by year and month. At the moment I first make a query to get the year records, then for each year I use a for () to filter the results per month within that year....
asked by 09.11.2016 / 20:36
3
answers

Set the value 0 when the number is negative

How can I assign 0 when the value in the column in MySQL is negative? Or is there some kind of data that only has positive numbers?     
asked by 15.12.2017 / 18:53
2
answers

Post system - "Duplicate entry '0' for key 'PRIMARY"

I'm having a problem, I'm not really sure if it's in PHP or in the database. In a posting system using PHP, as soon as you submit a notice, ID (the primary key, which would be used like this: index.php?ID=0 ) is not changing, ie...
asked by 20.07.2015 / 15:07
4
answers

How to display 2 columns of 2 different tables in MySQL?

I have 2 tables with several columns. I would like you to display individual columns from more than one table at a time: tabela1 | tabela2 Nome | Apelido     
asked by 10.07.2015 / 19:35