Questions tagged as 'mysql'

2
answers

How to relate multiple tables?

Below I put an example that I did in excel. How does a select change the values of the inf_musicas table by the value of the other corresponding tables? NOTE: I know the basics of SQL, I know it uses inner JOIN or it can...
asked by 15.02.2018 / 18:19
1
answer

Return multiple elements through ajax

My question is as follows, I have a table in MySQL with id , pesquisa and data . I want to give select to this table in php and return ajax so that I can insert each element into a specific td...
asked by 20.04.2018 / 16:48
1
answer

Insert in SQL if registration does not exist [duplicate]

I have the following PHP function that adds a row to the table: $idmusica = $_GET['idmusica']; $queryvota=(" INSERT INTO euk_sugestoes_votos (idusuario, idmusica) VALUES ($userid, $idmusica) "); The table has this structure:...
asked by 23.04.2018 / 23:25
1
answer

Reset AUTO INCREMENT and organize item IDs [duplicate]

What command can I use to rearrange the ID of all items in a table? The name of the table is produtos and the column is id . Currently they look like this: id: 1 - 3 - 7 - 8 - 9 - 11 ... That is, they are not in the...
asked by 19.04.2018 / 23:54
2
answers

Disable ONLY_FULL_GROUP_BY for once

How do I disable it ONLY_FULL_GROUP_BY for once? I ask why I have already done the steps below: SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); and also direct from phpmyadmin : I selected localhost; I click...
asked by 20.04.2018 / 16:30
2
answers

Create OR Update - MySQL

Is there something 'native' to MYSQL that does an Update OR Create? Something that is more performative than SELECT, validation, and INSERT / UPDATE as usual. I do not mean methods that simplify this via application, my doubt is about this...
asked by 29.03.2018 / 19:41
2
answers

Count Database result [closed]

Hello. Good night. I have a question I want to sum all the values of the field valor_reais of my table forexampleid1=150id2=100id3=100Iwanttheobviousresult,350I'vetriedsomethinglike:$buscar=$pdo->prepare("SELECT * FROM tabela...
asked by 08.04.2018 / 22:47
1
answer

Difference of character and charset

I'm getting some things in SQL, and sometimes I run into CHARSET and CHARACTER For example: create database teste default character set utf8; And now, creating a table: create table teste ( teste varchar(30) ) DEFAULT...
asked by 15.04.2018 / 15:50
1
answer

Inner Join is returning repeated results

I have three tables! One of them being a relationship table! They are: Person: Treatment: RelationshipbetweenPersonandTreatmenttable: I would like to pass the ID of the person, the query would return the NAMES of the selected treatme...
asked by 16.04.2018 / 03:24
1
answer

Create Array using result of a SELECT

public class TelaGrafico extends javax.swing.JFrame { Connection conexao = null; PreparedStatement pst = null; ResultSet rs = null; /** * Creates new form TelaGrafico */ public TelaGrafico() { initComponen...
asked by 18.01.2018 / 14:41