Most voted "mysql" questions
Mysql is a relational database management system (RDBMS) that functions as a server, and provides access to multiple users simultaneously. Your source code is available under the GNU General Public License.
Learn more…10,264 questions
Sort by count of
-
4
votes2
answers272
viewsQuery in two tables at the same time
I have for example the following scenario: Table Coluna01 Coluna02 Coluna03 book id name gender captl id name content cplivro id idcap idlivro When I have to associate a book with a chapter I use…
-
4
votes2
answers8268
viewsSelect with the day of the week in Portuguese
Good afternoon Guys, I need to make a select that translates the day of the week into Portuguese, it is already working, but in English. How can I change. Select *,id, data,…
-
4
votes1
answer297
viewsSelect by group
Good morning guys, I would like to know how to do the following SELECT in mysql: Having the following table, I need to select the last 3 purchases of each Name: From now on, thank you…
-
4
votes1
answer648
viewsHow to change a comma, by a point, to a decimal number inside a string
Here’s what I was trying to do: String: ajskjnsjs, eeiisois, 10,98 oismsnsjh; In this case I wanted to change only the comma of the number by a dot getting the rest of the string the same. I was…
-
4
votes1
answer601
viewsMysql function to return text according to numeric index
I have a table called tb_usuarios with the columns id_usuario nome email telefone tipo_de_acesso I would like to create a function in Mysql, where when using echo $row['tipo_de_acesso'], already…
mysqlasked 7 years, 7 months ago Sr. André Baill 6,946 -
4
votes1
answer2544
viewsSelect last JOIN record
I have a table tb_processos and another tb_detalhes (saves details of a particular process), would like to take all the data of the process and only the last detail of the process. The way I’m doing…
-
4
votes1
answer539
viewsWhat’s the difference when you use Inary in the Where clause?
What is Binary and what he does? What is the difference generated when using the Binary in a query in the Mysql and when it does not use the Binary? SELECT email, senha from login WHERE usuario = ?…
-
4
votes2
answers728
viewsField size takes total defined value?
If the maximum size of a field of type VARCHAR is 65535 (ocupa 65KB), it will always take up a space of 65KB in the database for each line even if I put less text in it? EXAMPLE: a field…
-
4
votes1
answer2136
viewsnodejs, get value from a SELECT mysql
Well, I wanted to know, how can I take this result, and turn into variable and be able to use within functions in the script, example take this Name Warrior and use as if it were a variable, like:…
-
4
votes1
answer59
viewsSelect with YEAR and MONTH together
Good is possible together the year and the month, and spend a party like this 20017-06 for the select? SELECT SUM(valor) FROM contas where YEAR(data) = '2017' and MONTH(data) = '06'…
mysqlasked 7 years, 5 months ago Hugo Borges 5,294 -
4
votes1
answer274
viewsSQL return in different columns, not rows
I am testing a query, where I would need the returns to come in separate columns, but the way below it returns in rows. I tried to use LEFT JOIN but the syntax didn’t work. select u.nome_completo AS…
-
4
votes1
answer339
viewsUse IN or multiple OR? Which one performs better?
I have the following queries in Mysql: 1º: Using multiple devices OR SELECT SUM(qtd) FROM produtos WHERE qtd > 10 and (status = '0' or status = '4' or status = '7') 2º: Using IN SELECT SUM(qtd)…
-
4
votes1
answer72
viewsPDO without JSON support
I need to return a line in JSON, but the PDO does not seem to give full support to operations. Always the error message type 245. PDO::prepare(): Unknown type 245 sent by the server. Please send a…
-
4
votes1
answer1187
viewsTomcat 8 + Mysql + Hibernate > Name [jdbc/toca_data] is not bound in this Context. Unable to find [jdbc]
I’m having serious problems with an application, I’m trying to set up and nothing. As I am beginner in the web part, I will say first what I understood: Tomcat needs settings (xml) to work with…
-
4
votes1
answer849
viewsListing the most offensive querys in Mysql
I would like to know which are the most offensive queries in my database. I have already used the conventional methods "Show full processlist" and among others.
-
4
votes3
answers1242
viewsUpdate based on a select
I have to update the field custo table pedidos based on the field valor table produtos_pedidos. Whereas the a.id table pedidos must be equal to the field b.id_pedido table produtos_pedidos. I’m…
mysqlasked 7 years, 3 months ago Hugo Borges 5,294 -
4
votes2
answers1508
viewsI cannot enter the values in the table with auto_increment in the primary key
This is my table: CREATE TABLE Utilizadores( IDUtilizador INT NOT NULL AUTO_INCREMENT, PNome VARCHAR(2000) NOT NULL, UNome VARCHAR(2000) NOT NULL, Email VARCHAR(2000) NOT NULL, PalavraPasse…
-
4
votes2
answers1634
viewsSelect records smaller than the current date and time
What is the best way to query the database where the data is smaller than the current date and time SELECT * FROM agenda WHERE agendamento < '".date('Y-m-d H:m:s')."'…
-
4
votes1
answer61
viewsIs it possible to use the DOUBLE data type on 32-bit systems?
The type of data DOUBLE is a 64-bit floating point, but can be used on 32-bit systems without any problem?
-
4
votes2
answers422
viewsCalculating average time
In my bank I have a table that has the fields entrada, saida, the two fields have the format D-MM-YYYY H:M:S, would like to make an average calculation. Ex: The average waiting time is 30 min Based…
-
4
votes1
answer339
viewsCheck if a value is contained in the line
I am working with a query system, and I would like that, for example: If I look for the value "a", it returns me all the lines that have "a". I tried to use the command like, as shown below: SELECT…
mysqlasked 7 years, 2 months ago Lucas Ramos 321 -
4
votes1
answer249
views -
4
votes1
answer229
viewsDoubts about Stored Function
What is a Stored Function, what is its basic syntax ? How and where to use a Stored Function
-
4
votes2
answers1020
viewsFormat ZIP in Query - Mysql
In my column of the bank I have the field CEP varchar(20), and a record: "92820142" there is some way to format in the pattern: 92,820-142 during the consultation? I tried using the format, but it…
mysqlasked 7 years, 1 month ago M. Bertolazo 653 -
4
votes1
answer54
viewsTransactions does not work in structure creations/modifications?
I was looking on the internet if there was any way to run Transactions for operations of the type ALTER TABLE or CREATE TABLE in the Mysql. This is because in one of our systems, we used Migrations…
-
4
votes2
answers502
viewsAdd previous line in mysql
I have a launch line, in which this line would need to receive the value of the previous line +1, some example of how to do this? Table structure: CREATE TABLE `lancamento` ( `data` VARCHAR(10) NOT…
-
4
votes1
answer3517
viewsDefault error for datetime field in Mysql
I had a problem trying to run my database script on the server. The error already gives in the first table that the script generates: CREATE TABLE IF NOT EXISTS `categoria` ( `cd_categoria` int(255)…
-
4
votes2
answers12357
viewsHow to make an INNER JOIN between two different databases on the same server in MYSQL?
I’d like to lay a INNER JOIN between two distinct tables but that are on the same server. It would be something like? INNER JOIN BANCOA.tabelaA.colunaA ON BANCOA.tabelaA.colunaA =…
mysqlasked 7 years, 1 month ago Geraldão de Rívia 940 -
4
votes1
answer1174
viewsProblem with codeigniter (mysqli) BD connection
Guys, I made a registration form for newsletter. And when loading the database on autoload['libraries'], presents an error Call to Undefined Function mysqli_init() in…
-
4
votes1
answer142
viewsPHP functions adapted to Mysql
When trying to optimize some darlings not to depend on PHP to do something that could come ready from the database, I was trying to adapt the two routines below in the form of functions mysql:…
-
4
votes3
answers1628
viewsConvert seconds into days
I have a very simple question: How to convert seconds into days? tried using: <?php echo date('d', $userstats['OnlineTime']); ?> but only goes up to 31 days. <?php $userstats_a =…
-
4
votes2
answers1749
viewsUpdate HTML Table with PHP
I have a page that you can select in php in a Firebird database and return the result in table form. My interest and update prices from a list to quote price, as I do to click on the cell and update…
-
4
votes1
answer1453
viewsDoubt in the method of using Distinct and Count together!
I have a requested table as the example below: Id | Cliente | Status 1 | XPTO | Proposta 2 | ABCD | Proposta 3 | XPTO | Venceu 4 | XPTO | Perdeu And I want to present a result like this: Cliente |…
-
4
votes1
answer4332
viewsHow do JOIN in 4 tables or more?
I need to make a select on four tables but I’m having a headache with it, follows the image of how they are related: It would be something like : SELECT integrantes.id_integrante,…
-
4
votes1
answer365
viewsString combination in SQL
I need to generate all combinations of a word varchar of a database record. I need to develop in MySQL in PostgreSQL To make it simpler: TABLE DADOS_BASE How to make a process/Function that selects…
-
4
votes3
answers1617
viewsSet value 0 when the number is negative
How do I assign 0 when the value in the column in Mysql is negative? Or is there some kind of data that only has positive numbers?
mysqlasked 6 years, 11 months ago user92401 -
4
votes0
answers62
viewsHow to know the current position of the user in the ranking
I have the table quiz_general and the table account, the table quiz_general that’s how it is: I’m doing a ranking system, it uses several lines to make the sum of points of each user, not just one…
mysqlasked 8 years, 3 months ago caiocafardo 1,897 -
4
votes2
answers1297
viewsRetrieve data from another mysql table and quantity
I’m having a lot of doubts about Mysql when I have to use INNER JOIN to retrieve data from other tables. I have 3 tables: MEDIA id, user_id, title, Description COMMENTS id, user_id, media_id,…
-
4
votes2
answers420
viewsStore New Value by Updating Old Value
Can someone help me with a PHP and MYSQL function? Today I have a view for Expense and Revenue Launch. I also have a box, which, when I launch an Revenue,the value is added to the box and when I set…
-
4
votes2
answers1159
viewsHow to make a "LIKE" in a DJANGO ORM query?
To make a query to get the data accurately in Django, I use the filter, thus: usuarios = Usuarios.objects.filter(nome='Jonh') This will generate an SQL similar to: SELECT * FROM usuarios wHERE nome…
-
4
votes1
answer808
viewsSelect to compare value sets from columns of two tables
Sirs, First, I have 2 tables Table 1: ID L1 L2 L3 L4 L5 ------------------------------------ 1 a c e g i 2 a c d g i 3 l n p r t Table 2: ID L1 L2 L3 L4 L5 L6…
-
4
votes1
answer100
views -
4
votes1
answer211
viewsAjax locks the computer
Analyze the code below function update(){ $.ajax({ url : 'http://localhost/sistema', type : 'get', dataType : 'json', success : function( data ){ console.log('Mostrar dados: '+.data.dado); } }) }…
-
4
votes1
answer194
viewsWhere Mysql search by full word
I have a database and would like to know how I do to search for the data by typing the full result using Where Example: ID NOME CODIGOS 1 | Joao | 9714,51,100 2 | Maria | 50,9714,88100 Ai wanted to…
-
4
votes1
answer698
views -
4
votes2
answers167
viewsTake mysql field dynamically
I created a select command based on information sent by the user, e.g.: $anoini = $_GET['anoini']; //variavel com ano escolhido pelo usuário $anofim = 2016; //ano final é 2016 $s = 'SELECT…
-
4
votes3
answers2377
viewsStructure table day and times (schedule type)
I need to create a table that contains days and hours of operation of an establishment, a kind of agenda. This table should represent every day of the week and on each day contain the opening and…
-
4
votes4
answers11110
viewsHow to group SQL results by month and year?
I would like to know how I can query the Mysql database and group the records by year and month. At the moment I first make a query to get the year records, then for each year I use a for() to…
-
4
votes1
answer266
viewsSave dataset C#
I’m searching several tables from the database for a Dataset through a Stored Procedure in the MySQL using the Mysql Workbrenck, but when saving only the first table is saved, my code: Stored…
-
4
votes2
answers1673
viewsHow to resolve this 'java.lang.Illegalargumentexception: Unknown Entity' when running this simple application?
I am new to the world of Hibernate and when I run this application, I get the following exception: java.lang.IllegalArgumentException: Unknown entity: com.nataniel.api.domain.User at…