Questions tagged as 'sql'

2
answers

Error performing a filter with SQL

I can not identify the error that is occurring in the code below: $bannerguia=mysqli_query($con,"SELECT id, senha FROM conta WHERE senha = '$senhalog'"); while($painel_banner=mysqli_fetch_array($bannerguia)) { $issenha = $painel_banner['s...
asked by 28.03.2018 / 23:49
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
2
answers

Returning the total with the date in a query with SUM

I need to return a sum of the value field of table m and along with it the date of the initial field of the field sale_date , being it has an aggregate function error: SELECT sum(m.value), t.sale_date from t_transaction t left...
asked by 17.01.2018 / 18:10
1
answer

importing backup by terminal MariaDB

Yesterday I was testing PostgreSQL for insertion and backup import and export, and PostgreSQL has an SQL import command like this: psql# \i backup.sql Is there anything related to this in MariaDB(MySQL) without being plain by the t...
asked by 24.01.2018 / 23:44
2
answers

How to properly display data from a commemorative date table

Table entries The intention is to bring the records of the commemorative dates in a month and day interval. Example: I want to bring the commemorative dates that are between January 15 and February 15, but when the filter is from one mont...
asked by 24.01.2018 / 21:10
1
answer

In PL-SQL how to partially sum a value?

I have to add the value partially the values of a category (goes the code in below) DECLARE --VARAVEIS CURSOR CPRODUTO IS SELECT * FROM PRODUTO_TESTE2; VPRODUTO PRODUTO_TESTE2%ROWTYPE; Vsoma real; BEGIN Vsoma := 0; FOR VPRODUTO IN CPRODUTO...
asked by 24.01.2018 / 14:51
1
answer

Delete SQL record with dependency

Good afternoon. I would like to know how to exclude records from a table containing a foreign key. I would not like to delete child records (to keep history). I always get a message warning that there are dependencies when trying to upd...
asked by 31.01.2018 / 17:28
1
answer

Relationship between 4 tables

I have the tables: -- NORTE -- create table tb_indices_norte( id_norte int not null auto_increment, localidade varchar(30), sem_epi int not null, totOvos smallint, num_pos smallint, num_inst smallint, ipo decimal(5,1), ido decimal(5,1), ano v...
asked by 05.02.2018 / 22:45
1
answer

Update table so that a field has a unique value

How can I update a record in MySQL so that when I change a field in that record all other records change so that this field has a unique value? for example, I have a table called players and a field called artifact , which basically will rece...
asked by 07.02.2018 / 15:32