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
answers7411
viewsDetermine the field in ORDER BY RAND() in mysql
Determine which field of the table will have ORDER BY RAND() Example: display random data according to field (id_category) As I put one: WHERE ORDER BY RAND() id_categoria ???
-
4
votes2
answers3023
viewsQuery in Mysql to return scheduled records for the next 30 days
I have a table called AGENDA, where I have the fields, ID, Location, Date. Do the insertion and selection inside the database already managed to do correctly. But I can’t select the date in…
-
4
votes4
answers713
viewsSearch from between dates
I need to search in my Mysql age of some registered collaborators. I have the field dt_nascimento and I need for example to find collaborators who are between 20 and 30 years old, how can I do this?…
-
4
votes2
answers576
viewsHow to get the last id inserted in Asp.net?
I’m making a website on ASP.NET, and I need to register a user/client. The question is: as soon as I enter the values in the table users, I need to get the id of this table and use in the table…
-
4
votes3
answers2200
viewsHow to group mysql results by foreign keys in a single array through a single query?
Let’s say I have 2 tables, one with phone numbers, and one with sectors: Ex. tb_extensions: id, branch, group_id(fk). id | ramal | grupo_id 01 | 1234 | 01 02 | 2345 | 01 03 | 3456 | 02 04 | 3457 |…
-
4
votes3
answers12958
viewsGenerate Excel with php query
I need some help. I have a query in php and Mysql and would like to add to this query the option to export the data also to excel. It is possible to do this with php? <div id="tabs">…
-
4
votes3
answers3859
viewsCount the columns of a Mysql table using PHP
As I can count the columns of a Mysql table using PHP, someone knows some command to do this? I tried to do it this way but it didn’t work: $sql4 = mysql_query("show fields from ".$tabela) or…
-
4
votes6
answers1555
viewsHow to do the following query without using INNER JOIN?
I have table A with the following fields: ID | ID_PAIS_ENVIO | ID_PAIS_RECIBO 1 | 23 | 47 //... I have table B with the following fields: ID | NOME_PAIS 23 | Brasil 47 | Portugal //... I need a…
-
4
votes1
answer1157
viewsALTER TABLE causes auto_increment resequencing, Resulting in Duplicate entry '1' for key 'PRIMARY'
I’m trying to put id as primary key but gives this error: ALTER TABLE causes auto_increment resequencing, Resulting in Duplicate entry '1' for key 'PRIMARY'
mysqlasked 10 years, 4 months ago feliphe felix 629 -
4
votes1
answer1133
viewsProblem reading words from database with accent or cedilla
I’m reading my table categories from the database and when I have words with cedilla or accents, they appear in my project with strange characters. For example, in the categories I have a title…
-
4
votes1
answer826
viewsIs SQL Query in Loops a good practice?
Ride query with Where or other sql commands within loops like Foreach is it a good practice or not recommended at all? There is a better way to treat the data without having to make so many calls in…
-
4
votes1
answer133
viewsError in database query with Linq
Good night! I am trying to perform a query in a mysql table, using English, and present this result in a gridview for the user. I have the table below: I’m not searching all columns of this table,…
-
4
votes1
answer931
viewsPersistent connection to Mysql database
Hello would like to know if I keep an open database connection(persistent connection) is better than I always close after a query?
-
4
votes1
answer1078
views"No suitable driver found" in Java database connection
Well, I use the eclipse and I’m trying to connect a Mysql database with my project, my code, compared to other tutorials I found, it’s perfect, and it’s this: package pack; import java.sql.*; import…
-
4
votes3
answers3897
views -
4
votes2
answers114
viewsDo not register in the time range if it already exists
How not to register events in the time zone that is already registered ? Example: I have an event in BD starting at 18:00 and ending at 22:00, I need that if the user tries to register a new event…
-
4
votes5
answers6102
viewsHow to create a view in mysql by taking data from 3 tables and repeating the different columns in the result?
I have the tables: +----------Tabela-1--------+ id | nome | cnpj | qtd1 1 | carlos | 0563233 | 4 +--------------------------+ +----------Tabela-2--------+ id | nome | cnpj | qtd2 1 | carlos |…
-
4
votes1
answer8146
viewsHow to create a mysql Trigger to take stock?
First I will present the database structure: Order table: id cliente data status Table Items: id produto tamanho = Estoque.id quantidade pedido = Pedidos.id Stock Table id tamanho quantidade chave =…
mysqlasked 10 years, 4 months ago RodrigoBorth 4,475 -
4
votes2
answers2789
viewsDisplay Mysql PHP errors correctly
Hello, I have a simple registration form, where there can be no repeated records in the field cpf and also in the field resposta(cupom). The validation of cpf is ok and the data does not duplicate…
-
4
votes3
answers1909
viewsError creating a Mysqli database via PHP on Wampserver
I’m having trouble creating the database, on the net I found little content on, I only find how to build database by phpMyAdmin, but it is via script that I want to create. I have the following…
-
4
votes5
answers57768
viewsCount equal records with SELECT DISTINCT and COUNT
How do I count the equal results and add the amount in front? For example: Currently the records of my table are like this: Id | Nome ------------ 0 | Teste 1 | Teste 2 | Teste I want to give a…
-
4
votes1
answer241
viewsInner Join between two tables
I tried it this way but it’s wrong SELECT * FROM produto INNER JOIN familiaproduto ON familiaproduto.idfamiliaproduto = produto.idNomeProduto INNER JOIN qualitygate ON (qualitygate.idQualityGate =…
-
4
votes2
answers3135
viewsHow to add with jQuery data in a table?
How to obtain with jQuery the sum of all the fields of class="subtotal1" returned from the database? <?php while($M_P = mysql_fetch_array($Dados_Produtos)) { ?> <tr class="somatoria">…
-
4
votes1
answer589
viewsHow to capture a Mysql query from a given table in real time?
I am wanting to capture the queries that are sent to Mysql of a particular application, it is possible?
-
4
votes1
answer284
viewsIs it possible to create a decision structure in a table in SQL?
I have a massive database, has more than 2,000 lines, and the second column has an ENUM that allows only 'Option 1' and 'Option 2'. If I insert 200 lines into the table and write the wrong ENUM name…
-
4
votes1
answer721
viewsHibernate + Inheritance
I’ve been trying for some time a solution to my problem. I’ve done a lot of research but nothing clearly explains what I need. So I created an example application and am making it available from…
-
4
votes1
answer580
viewsTender relationship with a foreign key not mandatory
I have a database with three entities that relate: user, process and courses. The goal is to model the bank to meet the following requirements: The user can sign up for several selective processes…
-
4
votes1
answer67
viewsHow to use the PDO class in this situation
I am using the PDO class to connect the database but in this particular situation I do not know how to use the PDO because in the mysql_fetch parameter I need to put a variable and so I searched…
-
4
votes1
answer1326
viewsDownload Blob Mysql file
I need to download a file .xls that is in a Mysql database, but I need to save it with the original name. Can someone help me? I can upload it easily. I need to download it. include_once 'db.php';…
-
4
votes1
answer11438
viewsUser root mysql without permission
I’m having a problem changing permissions of users in mysql with the root user in Debian. I can access normally through the terminal: $ mysql -u root -p So he asks me for the root password, I put…
-
4
votes1
answer85
viewsProblem in Mysql query
I’m having a problem with a Mysql query. In it I have 3 tables I need to cross: Table "drawing": id concurso_id customer_id Table "competition": id titulo criterioDiasCorridos criterioNotaMedia…
-
4
votes1
answer333
viewsPerformance in Mysql Database Queries
What is the best option in terms of performance? I do select * from agenda, paciente where agenda.id_paciente = paciente.id_paciente and take the data together from the agenda and patient or do…
-
4
votes2
answers6461
viewsSelect in Mysql with an array
I have a form with a field multiple select: <form action="processa-chose.php" method="post"> <select id="selecionar" name="fornecedor[]" data-placeholder="Fabricantes" style="width:350px;"…
-
4
votes1
answer1711
viewsSave to the database the office hours and perform a query
Hello, I am looking for a North to create with PHP and Mysql a way to record in the database the hours of operation of several establishments, to be able to easily search and show if the…
-
4
votes4
answers249
viewsMost common words among Rows
Is there any function in Mysql that gives me the 3 most common words between a column in format TEXT one-table? Example Maria Joaquina Maria Antonienta Maria B. among these Rows he returns Mary…
-
4
votes1
answer410
viewsPhonetic Research for Telephone Directory
I’m having a problem searching for phrases, I have a search field and I’m using the LIKE operator to do this, but it’s not serving me correctly, I tried now using SOUNDEX, but it only returns a word…
-
4
votes2
answers970
viewsTime between (between) "start time" and "end time"
I’m having trouble picking up the current time, in case I’m using CURTIME(), need to fetch the results that the current time, is between the value(time) of the column initial time and of final time,…
-
4
votes1
answer162
viewsQuery to sort by two Mysql dates
I have my table tbl_noticias with two dates of the type date: data_criacao_noticia and data_atualizada_noticia. The aim is for the listing to be ordered as follows: if the data_atualizada_noticia is…
-
4
votes1
answer358
viewsSmall Back Office
I’m raising a little back office in PHP, Mysql and HTML and I have a little doubt. Table: IDNoticia Dia Mes Titulo Noticia Then in HTML/PHP I’ll do echo to show the day, month, Title And News but I…
-
4
votes1
answer4598
viewsHow to list a sample of all tables in a Mysql database?
I need to sample all tables in a Mysql database, for example through a SELECT * ... LIMIT 10. I already have the code that returns all tables of the current database: select table_name from…
-
4
votes1
answer1434
viewsProcedure with IF NOT EXISTS
Hello stackoverflow developers, I started to delve into sql commands a little while ago, I have some stupid error of syntax of this project, but for countless attempts, I could not Scan it, follow…
-
4
votes1
answer3803
views -
4
votes3
answers1446
viewsSpecify fields I don’t want in Mysql
In Mysql, when we will make a SELECT, generally we can specify each field we want to return. SELECT id, nome FROM usuarios But let’s imagine a scenario where I have 50 columns in a table and I…
-
4
votes1
answer3999
viewsHow to execute a pagination with PDO?
I am developing an application in PHP but I just started in PDO and I have no idea how to make a pagination using the same. I managed to put together a little query with example of the information…
-
4
votes2
answers1711
viewsCorrect way to perform a dynamic UPDATE with PHP in Mysql
What is the right way to accomplish update dynamic? the big problem is being dynamic, if I pass only the first parameter and others are not changed. What is the best way to leave this update only…
-
4
votes2
answers1384
viewsSort by day of the week starting by today
I want to sort the results by days of the week I have 7 events, 1 event for each day, and have to order in the following way: Sunday, Monday, Tuesday, fourth, Thursday, Friday, Saturday Assuming…
-
4
votes1
answer321
viewsView database information securely
What kind of encryption should I use to encrypt a CPF in the database and then display that same CPF (decrypted) to the client in a secure manner?
-
4
votes1
answer245
viewsHow to create a page numerator?
I am developing a page "News" with several news, and it will be displayed only 9 news per page, above that, should go to page 2 and so on... how do I do this?…
-
4
votes1
answer97
viewsIn which part of the application is it more appropriate to reorder an array (database, server application, client code)?
Suppose, in a query to the MYSQL database, I need to take the last 1000 dice released, however, within these displayed results, his order must be growing (and not decreasing, as would happen in the…
-
4
votes2
answers755
viewsNormalization of Mysql tables
I’m creating a system for employee registration, but I’d like to start in a standard way; tb_funcionario (id_func, id_funcao, id_depto, nome_func, data_nasc, end_fun, dt_admissao, dt_demissao)…