Questions tagged as 'mysql'

1
answer

Composite primary key using a foreign key

Is it possible to create a composite primary key using a foreign key? I have the table mov_estoque , where I thought of putting id_mov and id_prod as the composite key, however, id_prod is a foreign key of the produ...
asked by 15.02.2018 / 18:01
1
answer

Add value at the beginning and end of a string in mysql

How to add text at the beginning and end of a string? For example, I'd like to add <p style="display:inline;"> at start and </p> at the end of all rows in column answer in table question_answer .     
asked by 20.04.2018 / 14:24
1
answer

Query with Select query in MySql

I have the "customers" table and I have another with the name "products". Each client has several products where the tuples of the products table have the customer id to make the reference. I need a Select that returns all customers who own t...
asked by 06.02.2018 / 16:52
1
answer

Add Count () in mysql

I have this query that returns me the number of dates equal: SELECT 'Data', COUNT('Data') AS 'Quantidade' FROM sua_tabela GROUP BY 'Data'; | Data | | 2016-06-09 | | 2016-06-09 | | 2016-06-09 | | 2016-06-08 | | 2016-06-08 |...
asked by 09.02.2018 / 13:12
1
answer

SQLGrammarException

Good evening! Can someone help me with the error in my code, I followed the steps of the teacher but presents error in mine and not in his example. I'm using the same dependencies. Here is the snippet of the method and the error. public List&l...
asked by 20.02.2018 / 04:13
1
answer

How to do a session

I have a system that has a login page, but it only sees if there is that email and password that the user typed in the database and releases it to the main page. Now I needed to create a profile page for this user so the system needs to know...
asked by 13.04.2018 / 13:58
1
answer

Maximum width and height validation with PHP

I'm uploading an image directly to a database but I want to check its width and height and if it's not between (X, X) width and (X, X) height does not insert the data into the database and shows an error message saying that the measurements of t...
asked by 08.06.2018 / 11:11
1
answer

Add return from select

I have the following query : SELECT (case when day(sysdate()) < 10 and meses.mes = month(sysdate()) then 0 else CAST(SUM(CASE WHEN s2.name LIKE '%Servidores' THEN ( coalesce(ta.time_unit,0) * 1.5)/ 60 ELSE coalesce(ta.time_unit,0)/60...
asked by 06.06.2018 / 15:52
1
answer

MySQL Error: ER_TOO_LONG_KEY

I'm getting the error in MySQL and I do not know how to solve it. Below is the output: code: 'ER_TOO_LONG_KEY', errno: 1071, sqlMessage: 'Specified key was too long; max key length is 767 bytes', sqlState: '42000', index: 0, sql:...
asked by 06.06.2018 / 00:41
1
answer

"Column 'Value' not found." when fetching balance in query

I'm building an ATM simulator, with the Deposit, Draw, and Extract features functional. But I'm not getting the balance. I have the emitirSaldo() method that should receive the value calculated by the query. Here is the code: public...
asked by 12.03.2018 / 01:46