Questions tagged as 'mysql'

2
answers

Get the highest value from a Mysql column

I have a column where I store the values: Nome | Turma | Nota1 | Nota2 | Nota3 | Nota4 How would I get the highest grade from the Note1, Note2, Note3, and Note4 fields? I understand that MAX () does this, but how could I apply to my need?...
asked by 18.12.2018 / 01:06
1
answer

Problems fetching data in the previous record - MySQL

I have this query that returns the last record and the last one: SELECT Colaborador FROM centrodb.Registolistagem LEFT OUTER JOIN centrodb.Registolistagem2 ON centrodb.Registolistagem2.IdLista = centrodb.Registolistagem.Id WHERE Carro = 'G3...
asked by 10.12.2018 / 17:40
1
answer

Foreign key with 3 primary keys

Hi. I have this table with 3 primary keys and I need to reference it in another table. How? I was going to just put an id of type int in the monthly fee table to be the only primary key. But each monthly fee must be unique to a contract and h...
asked by 05.07.2018 / 04:56
1
answer

Logout problem with php

I'm trying to make a simple login system to learn and improve it, I used a basic material I saw in devmedia, and the matter was already old because it still used mysql instead of mysqli for connection, in that matter did not contain logout, afte...
asked by 04.07.2018 / 22:54
1
answer

SQL statement in MySQL with CURDATE (), does not display API result with PHP

In this SQL what is wrong? SELECT top.id_topatletas, top.idusuarios, top.posicao, top.workout, top.data_inicio, top.data_fim, user.idusuarios, user.nome FROM top_atle...
asked by 03.09.2018 / 16:25
1
answer

ORA-00907: right parenthesis not found - Help

I'm trying to create the following table in SQL create table Compra ( CodCompra number(3) primary key, DataCompra date, DataEntrega date, Fornecedor foreign key Fornecedor REFERENCES (codfornecedor)Fornecedor )    ORA-009...
asked by 08.09.2018 / 00:29
1
answer

create a select within the while

I have this query: while($rows_cursos = mysqli_fetch_array($resultado_cursos)) { $tabela1 .= '<tr>'; $tabela1 .= '<td style="font-size: 12px">'.$rows_cursos['DataAprovacao'].'</td>'; $tabela1 .= '<td style="font-size: 1...
asked by 25.07.2018 / 12:57
1
answer

Problem with BD (foreign key)

My script is as follows. It is giving foreign key error and I can not resolve it. CREATE DATABASE teste; USE teste; CREATE TABLE horario ( id_horario int PRIMARY KEY NOT NULL AUTO_INCREMENT, horario time NOT NULL ); CREATE TABLE linha ( id_l...
asked by 22.07.2018 / 20:05
3
answers

Syntax error in MySQL

I was creating a table in MySQL and this error appeared in this code: USE cadastro; CREATE TABLE países( cod_país INT NOT NULL AUTO_INCREMENT, nome_país VARCHAR (30), PRIMARY KEY cod_país );    1 errors were encountered duri...
asked by 21.08.2018 / 04:57
1
answer

mysql error in creating foreign key

I'm trying to create a foreign key, but it's an error. Here is the code I'm using: CREATE TABLE foto( id INT(10), img varchar(25), nome varchar(25), link varchar(25), vew INT(10), tkm VARCHAR(100), moder INT(1),...
asked by 17.07.2018 / 21:50