Questions tagged as 'sql'

1
answer

Register multiple records using the same form

I have a customer registration form where it is possible to register one client at a time, how do I register two clients for example at one time using this same form? I tried to put one more input, but only the last record. form.php <htm...
asked by 18.01.2018 / 17:47
1
answer

SQLite error: foreign key mismatch (fk incompativeis) when trying to do an INSERT

I'm trying to create a Associative Entity (N: N) in SQLite like this:    [Pet --- < VaccinePet> Vaccine] And, here is my Associative Entity code CREATE TABLE VACINAPET ( vp_data TEXT NOT NULL, vp_is_aplicada INTEGE...
asked by 18.01.2018 / 00:48
1
answer

How to sum the values of an SQL column

I need to make a system that catches the three biggest donors. My table: donate_ID | donate_NAME | donate_AMOUNT This donate_NAME can be repeated, and if it does, its value will add up to the others, but what should be added is...
asked by 14.12.2017 / 17:41
1
answer

ERROR CODE 1215 - You can not add the foreign key

Table 1: Table2: Command: ALTER TABLE extras ADD FOREIGN KEY (login) REFERENCES usuario(login); Response: Error Code: 1215. Cannot add foreign key constraint    Can not find an index in the referenced table where the   ...
asked by 11.12.2017 / 17:51
1
answer

formatting command export sql with sed

I've exported a table from my database as follows: "1";"Boi Preto";"2000-02-29";"2";"Sol Nascente";"2009-10-01";"3";"Parque Belo";"2007-03-15";"4";"Pedras Bonitas";"2017-12-12";"5";"Medeiros";"2011-06-22"; and needed to leave as follows:...
asked by 25.01.2018 / 13:59
2
answers

SQL query fetching Javascript dynamic field

I would like to do a sql query by picking a user-entered field on a form and automatically filling the result in other fields?     
asked by 05.12.2017 / 17:43
1
answer

Error in group by of a query in db2 SQL

Query: Select ITEMNFS.Recnum, ITEMNFS.ITEM, sum(ITEMNFS.VL_TOTAL), sum(ITEMNFS.QTDE_FATUR), ITEM.PER_IPI from ITEMNFS inner join ITEM on ITEMNFS.ITEM = ITEM.ITEM inner join NFS on ((ITEMNFS.NRO_NFS = NFS.NRO_NFS) and (ITEMNFS.SERIE = NFS.SER...
asked by 20.02.2018 / 13:25
1
answer

SQL group by returns duplicate POSTGRESQL

My SQL query is returning multiple rows with the same id following: SELECT distinct (c.nome), c.id, c.email,c.telefone1,c.telefone2, SUM(a.valor) AS "valorDaCompra",u.id AS "idLoja",u.nome AS "nomeLoja", SUM(a.qtd_pecas) AS "qtdPeca...
asked by 01.12.2017 / 20:27
1
answer

SQL query returns value duplicates and with error

I have the following query but it is returning duplicate and erroneous results. Arthur should appear 0 instead of 30.     
asked by 03.12.2017 / 12:20
1
answer

pg_dump run via windows command prompt

I executed a dump with the following script: C:\Arquivos de Programas\postgresql\bin>pg_dump.exe -h xxx.xxx.xxx.xxx -p 5432 -U postgres -W postgres Senha:... -- PostgreSQL database dump -- -- Dumped from database version 10.1 -- Du...
asked by 28.02.2018 / 16:14