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
-
3
votes2
answers142
viewshow to query data in a table that is not related to the other table?
I have the following tables: CREATE TABLE IF NOT EXISTS `categoria` ( `id` INT NOT NULL AUTO_INCREMENT, `nome` VARCHAR(25) NOT NULL, `descricao` VARCHAR(100) NULL, PRIMARY KEY (`id`)) ENGINE =…
-
3
votes5
answers2538
viewsHow to use Try Catch on an Insert
How do I use a Try catch to return an error from an Insert that was not inserted into the database. For example $sql = $pdo->prepare("INSERT INTO usuarios (nome,email,senha,telefone) VALUES…
-
3
votes1
answer98
viewsSQL: MAX(data) with wrong results
Good guys, have a problem, when searching for the highest date by grouping by id, I get wrong value in the Obs field. Query in use: SELECT a.n_func,a.id_sk, a.data, a.obs, b.maxdata, b.obs FROM…
-
3
votes1
answer653
viewsQuery is executed, but the data does not go to the database
Good afternoon, Guys, I’m studying the PDO and with the following difficulty, the query runs (or rather, does not return me any error), only when I go to the bank has nothing, what I do? pdo = new…
-
3
votes2
answers1198
viewsDynamic tables with Jquery, Javascript and Mysql
Good afternoon friends, I’m having a problem, I’m not able to register all users in BD, only only register the last, how can I solve this problem? Index <form method="post"…
-
3
votes1
answer401
viewsCount with LEFT JOIN does not return when zero or null
I have a problem in a select where I need to get the data from 3 tables (search, users, and search). Where query can or n have data. The current query is: SELECT usuarios.nome AS nome_autor,…
mysqlasked 7 years, 11 months ago Israel Merljak 943 -
3
votes2
answers220
viewsIs it worth putting two foreign keys on a table?
having the tables: Companies Customers empresa_id: foreign key Sales cliente_id: foreign key and the relationships are: Companies and Clients => 1:N Customers and Sales => 1:N Considering that…
-
3
votes1
answer1316
viewsHow to Make Select Self Relationship N:N
I am unable to perform an SQL query with relationship N:N. I have a table of users and another with self relationship user_has_usuario, who will be registered responsible and students (from a…
-
3
votes1
answer460
viewsHow to view the data registered on another page
Hello friends how could make registered data appear on another page in a table ? That is the code <form method="post" action="index.php" onSubmit=""> <fieldset> <legend>Sistema de…
-
3
votes1
answer146
viewsGet all the data from INNER JOIN
My problem is that I’m doing a query but I’m not able to list all the data in the table. SELECT * FROM suporte s INNER JOIN login l ON l.cliente_id = s.cliente_id INNER JOIN radius_acct r ON…
-
3
votes1
answer49
viewsRows in Columns
I have the following result of a query: NOMECARACTERISTICA NOMEINFORMACAO Marca Samsung Marca ASUS Modelo E32 370E4K-KW3 Modelo X555LF My idea is to transform in the following form: Marca Modelo…
mysqlasked 7 years, 11 months ago cmcampos86 207 -
3
votes1
answer510
views -
3
votes2
answers54
viewsAdding value with Mysql
How do I add the values of the three selects below: ( SELECT (valor1 + valor2 + valor3) AS total SELECT SUM(valor) AS valor1 FROM pagamentos WHERE pagamentos.cliente = '1' AND contratosid = '9289'…
mysqlasked 7 years, 11 months ago Diego Marquez 320 -
3
votes1
answer5346
viewsProgress bar track mysql query execution
I need a bootstrap bar to track the execution of a mysql query. $limite='200'; // limita $i=1; // para gerar o looping da barra de progresso $y = mysql_query("SELECT * FROM $tabela WHERE x='y' ORDER…
-
3
votes1
answer3038
viewsForeign key creation error in Mariadb
When trying to create the toy table, the following error appears: ERROR 1005 (HY000): Can’t create table brinquedos.brinquedo (Rrno: 150 "Foreign key Constraint is incorrectly Formed") Follows the…
-
3
votes1
answer518
viewsHow to insert emoji character into a MYSQL TEXT field?
I have a text editor. In this text editor, you save the information in a table, using a column like MEDIUMTEXT. When I tried to insert an emoji, the following error appeared: Incorrect string value:…
-
3
votes1
answer774
viewsCRUD PHP No update, no error
I’m having problems when I try to run an UPDATE on my system in PHP + Mysql. I have the file code edit: <?php require_once 'init.php'; // resgata os valores do formulario $nome =…
-
3
votes2
answers339
viewsHow to validate integrity when trying to save duplicate data to the database?
Context: When trying to register the object Structure checklist the following error occurred: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '6-5' for key…
-
3
votes2
answers1911
viewsMysql - Search number in a string
SGBD: Mysql I have a table with a column of the type Varchar, with the following data: id Descrição 1 Pgto NF 66096 Lg Sistemas vcto: 01/10/2016. 2 Pgto NF 66096 Lg Sistemas vcto: 01/10/2016. 3 Pgto…
-
3
votes1
answer577
viewsQuery in Mysql does not order correctly
I have a game table called game, a table of gaming platforms called plataformas and a table that makes the N-to-N relationship between the two calls game_plataforma. I have a query that has to fetch…
-
3
votes1
answer280
viewsDump from all banks to a specific user
I have user plant652 who has 54 databases and need to back up all of them. How to do them all at once in Centos 6 with cPanel?
-
3
votes1
answer191
viewsWhich correct way to update
Friends this mistake (SQLSTATE[HY093]: Invalid parameter number: parameter was not defined), what is the correct way to apply the UPDATE according to the code below? Campos DB id_seguradora…
-
3
votes2
answers1174
viewsExport sql server query result to txt file on apache server automatically
I do the following query of my apache server in an SQL SERVER database: <?php // Dados do banco $dbhost = "192.168.0.100"; #Nome do host $db = "DATABASE"; #Nome do banco de dados $user = "root";…
-
3
votes1
answer208
viewsProblem calling Drivemanager.getConnection?
I am studying Java with database and I am doing some examples. On the PC with Windows I used a code and it worked, no problem occurred, now I returned to use Linux and the same code is giving error…
-
3
votes2
answers746
viewsCount how many fields are empty on a MYSQL line
I have a registration table with 53 columns (address, phone, etc). I wanted to set up a consultation that would bring me how many of these columns are empty or NULL, how can I do that?
-
3
votes1
answer179
viewsCONCAT is not working when column is NULL
I need help with the following code: UPDATE propostas SET obs = CONCAT(obs, 'aaa'), cd_status = 0 WHERE tsk_id = 1 If the column obs is null, does not load the new observation. Could someone help…
mysqlasked 6 years, 1 month ago Glenys Mitchell 401 -
3
votes1
answer2359
viewsPerform direct calculations in the sql query
How could you perform a series of calculations directly in the sql query, as there is SUM() that performs the sum would have some way to add one column to another and decrease another? $sql02 =…
-
3
votes1
answer126
viewsHow do I change the order of entering the Mysql database?
I want you to insert something into my Mysql (Phpmyadmin) and place it on top of the last post. Example: Yesterday I inserted Nome: Pedro | Idade: 20 Anos and he was at the top by being the first to…
-
3
votes1
answer68
viewsAdding data from the same column
Is there any way to make a calculation(sum) using values from the same column? For example: the customer wants to buy a quota in the value of 2000, in the bank I have several registered quotas,…
-
3
votes2
answers588
viewsServlet with JSP does not insert into the database
I am doing my Interdisciplinary Project of the college and would be an e-commerce. Well, I was following the part of entering in the bank for a booklet of the course I did by Caelum, but I do not…
-
3
votes1
answer659
views -
3
votes1
answer48
viewsSorting multiple columns
The sales table has the following structure: id_venda | nome_cliente | data_venda | data_agendamento | data_cancelamento | data_ligacao Where the "date" fields are all datetime. I would like to…
-
3
votes1
answer108
viewsIncorrect Usage of UNION and LIMIT
I want my query to return only the first record of the first table (if there is data in it), because the second table has no repeated data. But he returns this mistake: Error Code: 1221. Incorrect…
-
3
votes3
answers308
viewsproblems with distinct in mysql
I have a select where I have to sort it by the field 'Qtd' the problem is that I have this different field, and I need the products not to repeat. The 'a. id' field stores the product code, that is,…
mysqlasked 7 years, 9 months ago Hugo Borges 5,294 -
3
votes2
answers184
viewsBring sql record even if you don’t have the necessary accent
I need to bring a record called Vidraçaria in a survey, how can I bring this record by writing only Glassware in research? Or bring water seeking only agua The search works normally when the word is…
-
3
votes1
answer4100
viewsThe ADO.NET Provider with invariant name 'Mysql.Data.Mysqlclient' is either not Registered in the machine or application config file
I have an MVC project, and I wanted to connect to the Mysql database. I put this connectionStrings. <add name="Contexto" connectionString="server=127.0.0.1;User…
-
3
votes1
answer55
viewsIs there anything equivalent to Mysql’s "FOR UPDATE" in Sqlite?
As the title itself says, there is something equivalent to FOR UPDATE Mysql in Sqlite? Example: SELECT id FROM minha_tabela WHERE id=1 FOR UPDATE I own a query that uses a unique line lock within a…
-
3
votes1
answer71
viewsHow do I filter the data downwards?
I’m trying to filter the data from a table I have on SQL from the highest value to the lowest, but I’m not getting anywhere with Mysql. Source code below select max(id_nf), min(quantidade *…
mysqlasked 5 years, 10 months ago Lucas Tadeu 71 -
3
votes1
answer83
viewsSearching nearby locations with DISTINCT? (Maps API)
I have a separate table in MYSQL with user addresses containing location information (latitude and longitude), and each user can have more than one registered address. My goal is that when…
-
3
votes3
answers701
viewsMake a search independent of the order of the keywords
I have a database in which I need to do a search based on the keywords, regardless of the order. See the complete table below: +----+-----------------------+ | id | description |…
-
3
votes1
answer2402
viewsSynchronize Local and Web Databases
I have a system running on a web server, and also want to put it to run on the company’s local server (intranet), for performance reasons... I realized I’d have a problem with the database…
-
3
votes1
answer594
viewsSave an image to a Mysql database using Python
I don’t know how to save the image in the database. foto =cv2.imread('imagem.jpg') hora = str(hora.day) + '/' + str(hora.month) + '/' + str(hora.year) + '-' + str(hora.hour) + ':' + str(hora.minute)…
-
3
votes1
answer335
viewsGROUP BY does not work in Mysql 5.7
Locally I have Mysql 5.6 installed, and this SELECT works smoothly: SELECT dia FROM indicacao GROUP BY YEAR(dia), MONTH(dia) ORDER BY dia DESC Already on the client server, with Mysql 5.7 this same…
-
3
votes0
answers418
viewsFatal error: Cannot redeclare class Connected
I have a problem that is a mystery to me, in my lodging at locaweb a website that was running normally yesterday morning to afternoon started to accuse me of a connection error, I have not yet…
-
3
votes0
answers582
viewsSelect from all records of an IN clause in Mysql
I would like your help because I made a simple query that would need to return all records specified in clause IN. In this clause ( TF.Codtrains IN ) it comes from a select. The problem is that it…
-
3
votes2
answers1013
viewsHow to write data from a form to a database by converting the fields to JSON?
I have any form, example: <form action="confi.php" method="post" enctype="multipart/form-data"> <p><input type="text" name="nome" value="nome"> <p><input type="text"…
-
3
votes1
answer68
viewsMerge results in mysql
I have a database that already performed a query and got the following table: I would like to know how to assign zeroed positions, or replicate subsequent fields that have some defined value,…
-
3
votes1
answer226
viewsUpdate and increment column by sorting (UPDATE and ORDER BY)
I have the following table ID | NOME | ANO | REGISTO ---------------------------------- 0 A 2015 4 1 B 2017 6 2 C 2014 15 3 D 2017 2 4 E 2013 55 5 F 2017 1 6 G 2017 6 7 H 2017 8 And by doing the…
-
3
votes2
answers1247
viewsSQL Error [42601]: ERROR: syntax error at or near "Foreign"
When creating this table in postgre sql I get this error message Table creation tipo_agendamento_escritorio create table tipo_agendamento_escritorio( id int8 not null, primary key (id),…
-
3
votes1
answer1227
viewsGet the previous record of a date
I need to make a query, where I need to get the penultimate record, IE, the previous record and the date also. SELECT DISTINCT prt_partner.razao_social, prt_partner.end_cidade,…