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
-
7
votes1
answer1742
viewsIs there a risk in using mysqli_insert_id?
Suppose a website with a relatively high flow. An X user inserts a record into the database at the same time as another Y user inserts another record. Whereas the procedure of this insertion of user…
-
7
votes2
answers4071
views -
7
votes1
answer153
views -
7
votes3
answers1297
viewsHow to delete the last record from a table?
I was using the following code in mysql: delete from aluno where id=(select MAX(id) from aluno); But the following error appears: Error Code: 1093. You can’t specify target table 'student' for…
-
7
votes5
answers2439
viewsSubtract sums of fields in two separate tables
I need to add the value of a column in SQL, so it looks like this: SELECT SUM(qtdsaco) FROM armazem This code works. Now I need to add the value of the other table, here it is: SELECT SUM(qtdsaco)…
-
7
votes1
answer522
viewsPHP script paging
I would like to know how I can make a PHP pagination (in this case, 10 items per page). The exhibition is being made this way: <?php foreach($pdo->query('SELECT * FROM videos ORDER BY id…
-
7
votes1
answer131
viewsSearch in two Mysql tables
Is it possible to "select" by merging two tables in Mysql? for example: I have a table called "favorite" that saves the id_da_postagem and the id_do_usuario. the idea would be to go through the…
-
7
votes5
answers4473
viewsIn the ORDER BY of a SELECT change a comma for a period
I have a table in MYSQL (can be seen here http://sqlfiddle.com/#! 9/187ce/1 ), where the price is with commas and not points: 2.00 2,33 11.00 When I’m going to give an order by: ORDER BY preco ASC…
-
7
votes1
answer693
viewsMysql Code Translation for Postgresql
I need to convert a Mysql page into Postgresql commands, but I’ve already reviewed the internet looking for similar commands and Postgresql syntax, and was unsuccessful. Some commands do not exist…
-
7
votes1
answer251
views -
7
votes1
answer729
viewsError using Group by in a Mysql VIEW
I created a VIEW to return in a single query the main data I need. CREATE ALGORITHM = UNDEFINED DEFINER = `root`@`localhost` SQL SECURITY DEFINER VIEW v_historicoProcesso AS SELECT p.protocolo AS…
-
7
votes3
answers339
viewsBash - Mysql backups
I rode the script below, to perform backups of three Mysql bases. I would like to know if it is correct. #VARIAVEIS DATE=`date +%Y%m%d-%H%M` HOSTNAME1="xxxxx" HOSTNAME2="yyyyy" HOSTNAME3="zzzzz"…
-
7
votes2
answers1595
viewsHow to make Jqueryui autocomplete with PHP return multiple data?
I have two inputs, I’m using the automplete in only one. The code of the autocomplete: $(document).ready(function() { $.getJSON('include/funcoes/carrega_cidades.php', function(data){ var dados = [];…
-
7
votes1
answer1010
viewsPHP - Make 3 INSERT in different tables with relationship between them
I’d like your approval. I need to do 3 INSERT all at once. Only I also need to get the last ID of each table, to do the relationship of the tables. That’s right, do it that way? if($_GET['operacao']…
-
7
votes1
answer982
viewsUpdating application(C#) in real time with Database (Mysql)
I am creating a server client application, the application would run on several machines using the same database(mysql) on an online server. I would like that once the data of a table were changed,…
-
7
votes1
answer776
viewsMysql very slow sorting for results with many records
I have two tables, the first is used to group the data of the second with some information about the set, in order to facilitate the pagination of the contents. Table 1: - id INT(11) NOT NULL…
-
7
votes1
answer99
viewsDoubt about using LEFT JOIN in mysql
I have the following problem: I have two tables. students and proof students have 10 students tests has 9 results (because one student missed) The union of the tables is given by the matricula…
-
7
votes4
answers9952
viewsHow to make Mysql return utf-8?
When I require information from my database containing special characters I receive " but in the grouping phpmyadmin is "UTF-8" and my website also has the goal of UTF-8 what can I do to return the…
mysqlasked 7 years, 3 months ago Luhan Salimena 323 -
7
votes1
answer121
viewsIs it possible to change more than one record at a time?
That is the code: UPDATE PESSOAS SET COR = ('Pardo') WHERE ID = 1; But I have 2 more records to do the same procedure, I could do everything at once adding the ID?…
-
7
votes1
answer2093
viewsHow to display error while query?
I’m having the following problem, this query is not entering the data in the database: $inserir2 = mysqli_query($link, "INSERT INTO cliques (emailusuario, brasil, lucrobrasil, portugal,…
-
7
votes1
answer1414
viewsMake mysql query with INNER JOIN between different mysql servers
How could you make a query with INNER JOIN between different servers, as exemplified below: SELECT serverA.clinte AS CLIENTE, serverB.enderecoCliente AS ENDERECO FROM 127.0.0.1.dbo.cliente AS…
mysqlasked 6 years, 10 months ago Chefe Druida 1,086 -
7
votes2
answers1132
viewsSelect too slow, how to improve?
I have a chart of artisans with about 90,000 records. I created the SQL below to return me the total of artisans in each of the regions that they are registered. Although it works, it is slow,…
-
7
votes1
answer489
viewsCompare COUNT from two tables
I have two tables and I must return the total of the table with more data, I am doing so: SELECT CASE WHEN ((select count(*) as `familiar` from tb.familiar)) > ((select count(*) as `personal`…
-
7
votes1
answer2009
views"Incorrect datetime" value in Mysql
Hello, I’m trying to enter dates in the format dd/mm/Y in two jTextField, in MYSQL, however I get an error message only for the first field: Incorrect datetime value: '01/01/2016' for function…
mysqlasked 8 years ago Claudio Pedra 83 -
7
votes1
answer740
viewsSqlite and Mysql synchronization
I have an application in which I have a database using Sqlite and an external service using Mysql. Basically it’s a task application, where I can create a task in mode offline. When the user has…
-
7
votes1
answer2011
viewsCascadetype.ALL doesn’t work. Am I using it wrong?
In my code, I have the classes Author and Book, with the relationship Many To One, as below: Java author. import javax.persistence.CascadeType; import javax.persistence.Column; import…
-
7
votes2
answers798
viewsMariadb ERROR: ERROR 1709 (HY000): Index column size Too large. The Maximum column size is 767 bytes
When I run this code on Mariadb, it gives me this error when trying to create the toy table: ERROR 1709 (HY000): Index column size Too large. The Maximum column size is 767 bytes. I don’t know how…
-
7
votes1
answer9661
viewshtmlspecialchars() expects Parameter 1 to be string, Object Given
I’m trying to make a button select in the Blade with @foreach to get the list of all Mysql databases. Only the @foreach works, I can get the values, but I’m not getting to put the bases inside a…
-
7
votes1
answer3023
viewsHow to set up a development environment manually
I’m trying to set up my own development environment on a machine with Windows 10. The idea would be to install Apache + PHP + MySQL. The problem is that the software documentation is quite…
-
7
votes1
answer99
viewsDouble rule in LIMIT
I have a news table with the fields titulo, conteudo and destaque, being the highlight int(1), is a boolean value just to check whether a news is featured or not, what I would like to do is select a…
-
7
votes4
answers4763
viewsDelete multiple rows from a database
I’d like to delete several figures. For example this would be to delete a line delete from paginasimagens where idPaginasImagens=121; my values are sequentially so a method that is between elements…
-
7
votes2
answers531
viewsCoding conflict using Tinker and Laravel
I’m learning how to use Laravel and grabbed on to an encoding problem. I’m trying to use the Tinker to insert data into my tables, and there I’m getting the following error when I try to include a…
-
7
votes3
answers3104
viewsWhy does GROUP BY not work with Mysql in this case?
I am using the Mysql language and am trying to group a table of professions with the GROUP BY through the consultation below. SELECT name, occupation FROM OCCUPATIONS GROUP BY occupation; But I get…
-
7
votes1
answer587
viewsHow to simulate LEAD and LAG functions? [Mysql]
I have recently been developing a query in which I came up with the need to compare rows of the same data set successively, I mean, from the same column, from the same table. I became aware of the…
mysqlasked 6 years ago Caio de Paula Silva 1,189 -
6
votes4
answers30736
viewsPermission error when trying to access database
I took a little project already ready to study, only that is giving this error, recently migrated to the Ubuntu and I do not know what to do. Error: SQLSTATE[28000] [1045] Access denied for user…
-
6
votes1
answer2288
viewsMysql falling due to lack of memory
I have a dedicated server Linux Ubuntu 12.04 LTS with Mysql/Apache/Wordpress, Only since he has only 1Gb of RAM, sometimes he falls for lack of memory. No syslog marks with the message Out of…
-
6
votes2
answers1602
viewsDisplay "longblob" field content containing PDF file
I have a question about the data longblob which are stored in the Database. I currently have so for the other data: echo "<tr><td>Email:</td>"; echo "<td>"; if…
-
6
votes2
answers824
viewsName of months in Portuguese and English
On the site where I work, I use the following query to display in English the dates that are stored in the database: $conn->exec("SET lc_time_names = 'pt_PT'"); However, I discovered that the…
-
6
votes4
answers41617
viewsSign of different Query
I have a problem presenting the Query. I got the field alvaraValidade which only receives Data fields. When I put nothing in that field, the field date is guarded as 0000-00-00. $sql = "Select *…
-
6
votes1
answer233
viewsStore Files
I have a question about uploading files, I have to create folders for each client and save files from them (word files, excel, txt, dwg, dxf, ascii, pdf) ? It would be feasible to store all this for…
-
6
votes2
answers160
viewsINSERT INTO Does not send data to database
I have the following code: $con=mysqli_connect("localhost","esferinf_fpessoa","*****","esferinf_factura"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " .…
-
6
votes5
answers29249
viewsHow to calculate age based on DATE of birth in Mysql based on month and day?
I have the appointment below, but she ignores the month and day of birth SELECT FLOOR(DATEDIFF(NOW(), c.nascimento) / 365) AS idade FROM clientes c In the result, most come right, but sometimes have…
-
6
votes3
answers4703
viewsHow do a select pick up 8 lines in a row or more where there are common values?
I have a table coordenada that has the columns codigo, latitude, longitude, data and would like to give a select which selected only if it had 8 lines in a row or more where latitude and longitude…
-
6
votes2
answers2478
viewsHow to insert multiple arrays into a Mysql table
I receive via Ajax a request $_POST with 5 indexes and the last 3 are Arrays. It’s kind of like this: Array ( [c] => [s] => [dt] => [nl] => Array ( [0] => valor1 [1] => valor2 [2]…
-
6
votes2
answers2105
viewstimediff() limited to 838:59:59, how to resolve?
SGBD: MYSQL Problem: I am adding HOURS to a TIME field type and the expected result is above 838:59:59, but is visible only up to this limit. How to solve? SELECT he.empresa,…
-
6
votes1
answer876
viewsCombination of 4 numbers in Mysql
SGBD: Mysql Problem: List all possible combinations between the numbers "1,2,3,4", so that they do not recur between them. Example: 1 2 3 4 12 13 14 21 23 24 31 32 34 41 42 43...…
-
6
votes1
answer3804
viewsHow to select categories and count the number of products in each category?
I am trying to select the categories of the database and count in the same query the number of products registered in that category. So far so good, the problem is that I can not return to the…
-
6
votes1
answer1009
viewsWhat is the difference between `filter_var`and `filter_input`?
What’s the difference between filter_var and filter_input? I can’t find it anywhere, at least not in a way I understand. And how can I replace mysql_real_escape_string by one of them? $password =…
-
6
votes2
answers282
viewsConflict between Simple_html_dom and Nonobject-Oriented functions
I’m developing an app that has to access a list of websites stored in a database, upload all their links. It’s a test application but I’ve found a difficulty. The routine is this one: function…
-
6
votes1
answer1595
viewsMysql database update
I’m working with one database on the localhost and the other on production. At various times I need to update my local bank to match the server. I made a . sh script to be able to copy all the files…
mysqlasked 10 years, 5 months ago Marcony Felipe 879