Questions tagged as 'mysql'

1
answer

Use CONCAT to adjust the amount of php mysql numbers

I need to complete the amount of numbers to display on the screen, what would that be. the quantity that would be an example: 20 need to enter 15 characters with 0, Example: 000000000000020 . A friend of mine showed me in Excel a way he...
asked by 03.05.2016 / 20:45
2
answers

Add date with int

I'm trying to make a sum of days, reported in a int field, with a date field using SQL. I tested the form below, but it adds up to the day, but ignores month and year. Is there any way to do this sum? SELECT DATE_FORMAT(ocorrencias.dt_...
asked by 22.03.2016 / 21:44
2
answers

MYSQL - Check if PK exists if yes does UPDATE if it does not exist INSERT

I did not want to have to do two transactions in the database, currently I'm doing SELECT first to know if the record already exists in the table, then I do or INSERT or UPDATE depending on the case, to do though a transacti...
asked by 12.09.2018 / 20:50
2
answers

Updating multiple records at the same time

I have a list with the id and email of each user id email 1 [email protected] 2 [email protected] 3 joao@gmailcom ... How do I set up an sql statement to update all emails at once in my users table? My table: usuarios id...
asked by 08.03.2018 / 15:13
3
answers

Function contrary to TRIM

How to insert characters into a varchar field in MySQL? For example, in the update with trim vc you can remove certain characters from a field varchar ... but add? Example: update tabela set campo = TRIM(leading '11' from...
asked by 12.02.2016 / 12:59
4
answers

Error when executing hibernate

After catching a little, I'm walking with my project. When I run the project, I get the following error: mai 16, 2016 6:41:22 PM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation INFO: HHH000204: Processing PersistenceUni...
asked by 17.05.2016 / 02:44
1
answer

Querying RG in database ignoring scores

I have a mysql database where I need to make a comparison of registered RGs with another one provided by the user through an input, to see if the same RG is already registered in the database. The problem is that since you have records with s...
asked by 29.10.2014 / 22:02
2
answers

The less you consult the better, right?

It is possible to vary the writing of the results, as an example below where I want to use. <table width="1000" align="center"> <tr> <td>&nbsp;NOTICIAS</td> <td>&nbsp;</td> <t...
asked by 04.04.2015 / 15:02
3
answers

How to sum the results of an array brought from the database in PHP?

I'm doing this, but what's being added is the number of rows and not the values of the "something" field. <?php $searc= mysql_query ("SELECT algo FROM lugar") or die (mysql_error()); while ($rows = mysql_fetch_array($searc)) { $soma_das_...
asked by 30.04.2014 / 15:32
2
answers

Optimize Mysql tables

I work with some huge tables in a system I've developed. These tables are constantly being updated and sometimes the query becomes slow. Some of them have more than 100,000 lines. I would like to know how often I should run the optimization c...
asked by 20.02.2014 / 17:08