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
votes1
answer416
viewsHow to group Counts for different queries into one?
I need to make an SQL query to count indications, I have the following querys: SELECT 'FACEBOOK', COUNT(id) FROM `clientes` where indicacao like '%face%' SELECT 'Instagram', COUNT(id) FROM…
-
4
votes1
answer1340
viewsWhat are the differences between the HASH and BTREE algorithms used in an index?
I realized that I can create two types of indexes for one determining field in Heidisql, which use the algorithm HASH or BTREE, see below: See the CREATE code from an example table for the…
-
4
votes1
answer392
viewsRandomly select lines
I am developing a very complex system, where, in some cases I need to select only a few fields, a friend who has more experience in the area gave me some tips, but he did not explain why. I have the…
-
4
votes1
answer114
viewsDOUBT About the use of SELECT and Standard Tables
I have a question as to the advantages of having standardised tables and their forms of use within a SELECT. Suppose the following tables: -------------- | tb_endereco | -------------- | id | | rua…
-
4
votes1
answer13010
viewsHow to adjust the Mysql Time Zone?
I took an old project from github, and the project was a JSF application that was using the old mysql artifact as you can see below; <dependency> <groupId>mysql</groupId>…
-
4
votes2
answers112
viewsHow to make a NOT IN mysql with 2 tables
I have 3 tables Person, class, Notes, table person has: +------+--------------+-----------+ | id | Nome | turma | +------+--------------+-----------+ | 1 | Aluno 01 | 1 | | 2 | Aluno 02 | 2 | In the…
-
4
votes1
answer170
viewsHow to save all data inserted into a form-control in Mysql
Guys, how can I make a script to save all data right after its insertion. In case the view would be this. After typing and typing enter the data would already be saved in the comic. What’s the best…
-
4
votes4
answers327
viewsReturn results for all months of the interval
I own the following query: SELECT CAST(SUM(CASE WHEN s2.name LIKE '%Servidores' THEN (ta2.time_unit * 1.5)/60 ELSE ta2.time_unit/60 END) as DECIMAL(12,2)) AS TEMPO_CORRETO,…
-
4
votes1
answer281
viewsSELECT Mysql - Prioritizing results that are not null
Hello, I have a table with several records, which are not mandatory. I need to execute a query, and bring only the result that has more information that is not null. Ex: ID | Col-A | Col-B | Col-C |…
-
4
votes2
answers2161
viewsHow to delete a foreign key from Mysql
I’m having the same problem in every database. I have a database created with the following lines create database nova; create table estado( id int primary key auto_increment, nome varchar(20) );…
-
4
votes2
answers276
viewsUsing a select with UNION or other mysql parameter
I am developing cash flow from my company and am encountering a difficulty. I have two different tables. A table is a tb_compras(id, fornecedor, nfe, valor, data) and then I have another table…
-
4
votes1
answer784
viewsSelect the first row of each group in Mysql
Suppose I have such a table: item | group -------+-------- item a | group x item b | group y item c | group y item d | group x item e | group z And that I want to select a single item to represent…
-
4
votes1
answer55
viewsHow to make a select based on data from another table
I have to make the following adaptation in a query: Table app_usuários: id, nome, sobrenome, hash, sexo, interesse, latitude e longitude. Table app_likes: id, user_a_id, user_b_id Briefly, I have a…
-
4
votes2
answers66
viewsSearch two numbers at once
Maybe that question has even been answered already, but I don’t know how to do it, and I fell into the typical XY problem. I have a table that has several ids, and I need to search two id’s, 34 e 5.…
mysqlasked 6 years, 2 months ago Layla Comparin 553 -
4
votes2
answers94
viewsLogin panel does not return the number of accounts
I am creating a login area, but when I click the login button, it does not return any error, for example: if the user does not exist I would like the number 0 to appear according to the variable…
-
4
votes2
answers173
viewssql record in tables and return the table name
Well, here’s the thing query Mysql; SELECT idMembro FROM membros WHERE idMembro IN ( SELECT idMembro FROM pastores union SELECT idLider FROM redes union SELECT idLider FROM regioes union SELECT…
-
4
votes2
answers97
viewsSearch for lower values of one field according to values of another
I have this data entered in my table. mysql> SELECT * FROM db_cotacao; +----+------------+-------+------------+--------+---------+ | id | data | valor | validade | idforn | idativo |…
-
4
votes2
answers613
viewsNodejs - Mysql Error: Too Many Connections
I recently made a refactor of my code to adopt the MVC standard, because it was very disorganized! However, an error called "Too Many Connections" started to appear. This error causes my Node-mysql…
-
4
votes2
answers583
viewsWhat makes "group by 1" and why it causes errors in Laravel
I wonder what the group by 1 does in the MySQL ? I’m curious because I have a very complex query on MySQL and it works great, only I’m trying to use it in Laravel and I get an error in the return.…
-
4
votes2
answers238
viewsHow to search MYSQL search for word in title and then in text and sort by title first
I have a table with title and content and wanted to do a search to see if the term is in any of these fields. If you have, bring the results of the title first and then the content tabela…
-
4
votes1
answer78
viewsSecurity in a Task Management System
This is something that raises many questions. I am creating a Task Management System. Most fields are INPUTS or SELECTS FORMS. Most of these fields users only interact when they have already logged…
-
4
votes1
answer102
viewsUse of "global" with mysqli leaves the connection open?
In this form of access to the bank with mysqli I was in doubt whether two connections are opened, and whether, after closing the $stmt, if there is still a connection always open. The use is…
-
4
votes1
answer681
viewsGet the current date and time here from Brazil to enter in the database
I have a table that records the login and logout of users on the system. However, when the login is done, the date and time stored are not being added according to the time zone of Brasilia. Follow…
-
4
votes3
answers144
viewsReturn last contributor who checked the car
I intend to return the last contributor who checked the car products before what you are currently checking. The car has to be the same and just in case there’s any product checked in the car like…
-
4
votes1
answer111
viewsCopy column data from one table to another
I have 2 tables "Orcamento" -> colunas ['id', 'cliente_id'] Essa tabela existe valores em 'cliente_id' "Ordem_servicos" -> colunas ['id', 'cliente_id', 'orcamento_id'] essa tabela não existe…
-
4
votes2
answers1326
viewsHow to work with timezones without using a timestamp?
I was reading that answer, of the Stack Overflow in English, and I came across the following excerpt: For Mysql (or Mariadb), if you don’t need the time information consider using the DATE column…
-
4
votes3
answers283
viewsHow to delete duplicates between multiple tables
I have three tables with structure similar to this: CREATE TABLE itens_chao ( id int PRIMARY KEY AUTO_INCREMENT, pos_x int, pos_y int, nome varchar(255), quantidade int, numero_serie int(11) );…
-
3
votes1
answer4036
viewsHow to use Elasticsearch next to Mysql?
I’m looking to use Elasticsearch to see if I can get agility and speed in my Mysql queries. I started to see some things, but I found a little confusing the issue of integration with Mysql, someone…
-
3
votes2
answers3573
viewsCompeting transactions in Mysql
I am working on a system that needs to draw multiple data(coupons) from one table and return to the user, but I cannot risk delivering the same coupon to the other user. I thought I’d use the…
-
3
votes1
answer1829
viewsExport Mysql database to Sqlite
I usually use a database in the applications I develop locally. With the mysql whenever I need to work clone the application to another machine, I need to generate a dump bank and import at local…
-
3
votes1
answer1046
viewsWhat is the best way to make an online database backup
There is a client of mine who owns two machines, one of them is the server where all the data of the bank is, and the other is the cashier. However, there is customer concern in case something…
-
3
votes7
answers3667
viewsPDO does not connect to Mysql
I’m trying to make a connection to the bank by PDO, but every time I try to make this connection, the message appears: could not find driver I went back to find out and learned that I had to enable…
-
3
votes1
answer1326
viewsWhat naming conventions are in mysql database creation, tables and columns
I would like to know what kind of conventions exist in the names assigned to the database, tables and columns in mysql, is usually used camelCase or other type of convention?…
mysqlasked 10 years, 9 months ago Juan Jardim 133 -
3
votes4
answers3403
viewsCheck data in the database according to the date
Query data in mysql in the last 3 days, ie display database data from day 15 until today (17/02/2014) I’m wearing it like this: $condicaoData = date('d/m/Y', strtotime("-3 days")); $selecionaTabela…
-
3
votes1
answer1384
viewsError deploying to Wildfly
I’m getting an error trying to do deploy of my Wildfly 8 app: Caused by: org.jboss.as.server.Deployment.Deploymentunitprocessingexception: JBAS011445: Failed to get Adapter for persistence Provider…
-
3
votes2
answers258
viewsQuestions about Vagrant
I’m learning to work with the Vagrant, I have already created the VirtualMachine, made the provisionings, the project worked perfectly. But when I walk in I see ssh in VirtualMachine to run a script…
-
3
votes3
answers9800
viewsMysql Workbench - Create Database based on EER Model (Forward Enginner Options)
Doubt: In Workbench I created the table in EER Diagram and now I want to connect to Hostname 127.0.0.1. The way I walk is Forward Engineer -> Next -> and then I have a lot of options, I have…
-
3
votes1
answer78
viewsProblems with CONVERT_TZ and BETWEEN in Mysql 5.1.73
I’m trying to do this search with CONVERT_TZ and BETWEEN in Mysql 5.1.73 but always returns zero lines. Has anyone ever used BETWEEN thus? SELECT x.UserName, x.StartDate , x.EndDate FROM tabela AS x…
-
3
votes4
answers650
viewsReturn multiple arrays using a buffer without overloading memory
I’m developing an application where, in a report, I need to print something around 50,000 lines. When having run SELECT error occurs: Fatal error: Allowed memory size of 134217728 bytes exhausted…
-
3
votes1
answer326
viewsProblems sending FILE to Database
I have a problem sending FILE data to BD. With the help of @Zuul I came to this problem. <?php require("conectar.php"); //chama o arquivo de conexão ao BD if (isset($_POST['Nome'])) { $Nome =…
-
3
votes1
answer247
viewsCheck records between today and 10 days in the future to send by email
I’m using Phpmailer to send an email with data when it’s 10 days away. When I send the email, all the records are showing up when the idea is to show up the logs between today and 10 days in the…
-
3
votes1
answer280
viewsPHP Database error
I uploaded my website (using Filezilla) using php/mysql. On the localhost it works perfectly but on the external server it doesn’t. The following error appears: SQLSTATE[HY000] [1045] Access denied…
-
3
votes3
answers34761
viewsError: "You have an error in your SQL syntax"
I am getting the following error when time to perform a query to insert data into a table in the database: You have an error in your SQL syntax; check the manual that Corresponds to your Mysql…
-
3
votes1
answer306
viewsPDO deletes columns with equal names
I realized that by using the PDO to execute the query below, the results are conflicting with the PhpMyadmin and the Console do Mysql: SELECT a.*, n.* FROM arquivo AS a INNER JOIN numeracao AS n ON…
-
3
votes2
answers592
viewsHow to build friendly Urls, such as Facebook and Twitter.
I have a question, how can I build links like Facebook and Twitter? For example: http://facebook.com/nome-qualquer. I know that the .htaccess treats the url in a certain way, but the question I’m…
-
3
votes1
answer416
viewsMark duplicate fields in a table
I have a table in my database and I would like to mark the occurrences where a certain code is repeated. Remembering that this code field is not a primary key. Example: Data Código Repetição Status…
-
3
votes4
answers23723
viewsHow not to write duplicate data to Mysql with PHP?
I’m learning PHP and, to begin with, I’m doing a phonebook project, with name, DDD and phone. However, before new data is entered, how do I check if the same phone number is already registered?…
-
3
votes2
answers2189
viewsConvert Date dd/mm/yyyy to ISO 8601 format (yyyy-mm-dd)
I have a field called maskedTextBox2 in C# Windows Form, which contains a date mask in the format dd/mm/aaaa. How can I convert this string format aaaa-mm-dd to save to Mysql database, which uses…
-
3
votes1
answer238
viewsHow to play query with Mysql queries in Hibernate?
I am using JPA 2.0 and trying to play this query in Hibernate , but I am not able to visualize how to do. I did it in Mysql language SELECT totalassociado, totalcriticado, items.item_codigo_item,…
-
3
votes1
answer383
viewsValue of a query to a numeric field returns non-numeric
I am trying to read a field in a table that is of the whole type. And it is also a primary key and auto-increment. The value returned is put in a label (I’ve tried putting in an input text as well).…