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
-
10
votes5
answers98198
viewsHow to display the result of a query on an PHP html page?
How can I display the results of a query in a table of an html page? Below is what I was able to do. However, the code only shows the first record. include("conectar.php"); $sql =…
-
10
votes3
answers3229
viewsFind certain dates in VARCHAR field in SQL (Mysql)
I have the following condition: WHERE sv_users.userDataNascimento LIKE '%95%'; And this condition searches a date (11/12/1995), of the kind VARCHAR and not Timestamp, one year ending with the…
-
10
votes4
answers5293
viewsHow to check if the user is online?
I am developing a project in PHP and using Mysql as a database. I only have one question about how to chat: How to know which users are online at that exact moment?
-
10
votes3
answers9148
viewsQuery in two tables without INNER JOIN
I would like to know, is there a difference in the performance of these two queries? in Mysql SELECT employee.*, company.name FROM company, employee WHERE employee.company_id = company.id AND…
-
10
votes3
answers6487
viewsHow to take ID from another table and INSERT into another?
I have two tables: destinations and input: On the table destinations: id_destination(AI) and destination; On the table entree: id(AI), id_destination(relation with table id_destination…
-
10
votes4
answers24249
viewsWhat is the right way to connect to the Mysqli database
I have a question that has brought me several incompatibilities. With the evolution of PHP and Mysql, more recent versions have emerged, this way Mysqli. That’s where my problem lies, I would like…
-
10
votes3
answers2642
viewsReceive array and record multiple lines in Mysql
I have the following HTML form: <h2>Sessao 1</h2> <input type="text" name="ipl[]" class="span12 "> <input type="text" name="spot[]" class="span12 "> <input type="text"…
-
10
votes2
answers2126
viewsMultiple LEFT JOIN and slow search
In a client application (a school calendar and record of absences/presences) there is this query: SELECT *, the_courses.course_desc as course_name, schedule.id as schedule_id, students.id as…
-
10
votes3
answers10155
viewsUppercase in the first letter of every word in a column in Mysql
How do I get first letter of all words in a specific column be converted to capital letter using Mysql pure? Example: gustavo silva Guilherme souza joão Silva maria souza To: Gustavo Silva Guilherme…
mysqlasked 9 years, 4 months ago Gustavo Piucco 2,401 -
10
votes2
answers16161
viewsWhat types of data exist in Mysql for text?
What kind of data exists in Mysql? What’s best for storing long texts? (HTML-shaped document for example) Why?
-
10
votes5
answers11633
viewsHow to do a LIKE ignoring accentuation?
I need to make queries in a database of registered users. However, I need this survey to be done by the name of the user, through the LIKE, and this should ignore the encoding UTF-8 present in the…
-
10
votes1
answer12629
viewsWhy should we use "IS NOT NULL" instead of "<> NULL"?
I’ve always wondered why we should use IS NOT NULL instead of <> NULL? For when I do as in the second case, no result is found. Example: SELECT * FROM tabela WHERE campo IS NOT NULL Displays…
-
10
votes6
answers992
viewsLike saving today at the bank?
How do I automatically save the day in the database without having to pass it when adding the product or whenever you add a product it automatically already writes the date of the computer in a…
-
10
votes5
answers26385
viewsWhat is the best practice to know if an Row exists in a SELECT in Mysql?
For example, when we check if a user is already registered in the table, we do not need any data return by query, just check if the number of Rows is greater than 0 (num_rows > 0). Us scripts and…
-
10
votes2
answers341
viewsError updating the entire JAVA table
I’m trying to perform a mass update to update all prices of products registered in the system, adding the value passed by the user to the unit price of the registered product, according to the…
-
10
votes1
answer2317
viewsMysql local to remote sync
I wonder if it is possible to replicate a local Mysql database with the remote. Use Phpmyadmin and do not know if it will be possible because I have no fixed IP to find each other.
-
10
votes1
answer3282
viewsHow to compile the database to install together with a C#application?
I’m developing an application in c#, and I need to know if I can compile the database to install together with the application, I’ve seen something here talking about Sqlite, but I don’t know the…
-
10
votes2
answers5991
viewsBIT(1) versus TINYINT(1) for boolean values
I may be wrong, but I have the impression that in practice the default in Mysql is to use columns of the type TINYINT(1) to store boolean values, true/false or 0/1. Only that TINYINT accommodates up…
-
10
votes2
answers3110
viewsMysql = Mariadb, huh?
It’s been a few days since I’ve been listening to the teacher in my class saying,: Oracle purchased the MySQL and just renamed it to MariaDB. As I am not easy to believe in the things spoken, I went…
-
10
votes1
answer1031
viewsSort Varchar field by taking into account groups and subgroups
I need to sort the values below in ascending order. They are Varchar type and the solutions I have found so far for Mysql have not worked. An example of the data type would be 1.12.02, because these…
-
10
votes2
answers3515
viewsWhat is the difference of an empty string and NULL in SQL?
What’s the difference of storing a string as NULL or empty in SQL? How these two can behave when I go to make one SELECT, or INSERT worthwhile '' in that column which is of the type varchar? If I…
-
10
votes2
answers108
viewsHow to order a select 1 to 255?
Personal I have a query of a table with Ips numbers from 1 to 255 of various ranges. When I do SELECT IPS FROM ipvalidos WHERE REDE ='{$rede}' ORDER BY IPS It selects from 10.0.0.100 before…
-
9
votes7
answers31206
viewsHow to insert data into DB with jQuery/Javascript without using PHP?
I am learning Javascript and jQuery and I am wanting to make a small site to test the insertion of data in a database. I have no knowledge in PHP, I wonder if it is possible to insert data in a…
-
9
votes7
answers30383
viewsHow to dump a Mysql database with PHP?
Currently, to export only the structure of a given database, I use the following: mysqldump -h host -u usuario --no-data --database banco > dump.sql -psenha This generates an SQL file, all…
-
9
votes3
answers2825
viewsCheck whether a date and time (timestamp) represents the current day
I have a table with the following field: dh_send (TIMESTAMP) and I want to mount a query to get all records of this table in which the dh_send is equal to the current date (TODAY). I thought as…
-
9
votes2
answers1950
viewsClose connection to database c#
I am making a login system and get the message of sql Exception when I try to create new account in the database: MySqlCommand usuaExiste = new MySqlCommand( "SELECT * FROM contas WHERE nome =…
-
9
votes2
answers5943
viewsConvert row to column
I have a field called "Shift" kind STRING, storing data in Mysql in this way: '1,2,3,4,5,6,7,8,9' I need this string line to transform (transpose) into a single column (in this case, it would be the…
-
9
votes2
answers3276
viewsHow to make a Stored Procedure dynamic by taking data from other tables in the database?
I’m on a project to build a social network with the @Rodrigoborth, and we have the problem of How to index and update a user comparison system... We were given the idea of working with Stored…
-
9
votes1
answer58526
viewsHow do I make a SELECT in 2 or more Tables with 2 or more conditions?
I have a problem making a select with the following conditions: I want to show the data either with condition1 or with condition2 Select * tabela inner join tabela2 WHERE campo = 0 and campo2 = ''…
-
9
votes1
answer666
viewsMulti-step form, losing values of variables when page changes
We have three PHP pages with html form. In the first page we have the fields showing the values of the variables and the fields Hidden containing the values of the variables like this: <input…
-
9
votes3
answers1225
viewsMysql Transaction When? How? Why?
I’ve been reading the question What is a Mysql Transaction for? and I was left with many doubts on this subject. When we should use transactions? Why should we use transactions? How we should use…
-
9
votes2
answers3065
viewsMysql Nicknames in Inner Join
I tried to do this internal merge in SQL to connect two tables in my report. What I’d be doing wrong, why is giving "ffccf column unknown", even though I nicknamed the column? Follows the code:…
mysqlasked 10 years, 5 months ago Ramon Ruan 1,018 -
9
votes3
answers25430
viewsSQL command to display specific records from the "id" field
Which SQL command would display the records where the field id were 22, 23, 25 and 27?
-
9
votes2
answers55209
viewsSet OPTION as SELECTED based on database values
I am preparing a form where I am setting the values of the fields with the database data. I’m having trouble setting the chosen option as selected to the <select/> in the code below: PHP…
-
9
votes5
answers6499
viewsSave the binary content of an image in the database
How do I get the bytecode of an image at upload time to be able to store it in the mysql blob field without the need to save the image to ftp?
-
9
votes2
answers2492
viewsWhat’s the difference between SOME, IN and ANY?
What is the difference of SOME, IN and ANY in Mysql and when to use them? They have a bad performance if used often in the same SELECT?…
mysqlasked 9 years, 7 months ago Guilherme Nascimento 98,651 -
9
votes1
answer27206
viewsDatabase connection - Mysql and Java
I already have a local server on my machine (localhost) with Mysql running normally. From there, I would like to connect my database with Java, but... how do I do that? Is there any Swing component…
-
9
votes1
answer1625
views -
9
votes3
answers14735
viewsHow to break a line of a Mysql field into an HTML page
I need to save a value with a line break in the table For example, instead of keeping: 0 anos, 3 dias Keep: 0 Anos 3 Dias I tried the following process: INSERT INTO tabela (tempo) VALUES ('0 Anos\n3…
-
9
votes5
answers38375
viewsConvert date to dd/mm/yyyy format
I’m getting two PHP post of two dates in format dd/mm/yyyy, however to display the data need to convert dd/mm/yyyy for yyyy-mm-dd. Code: if (isset($_POST)) // Se existir o array post, pq ele não…
-
9
votes2
answers144
viewsIs it redundant to use LIMIT in a QUERY whose ID is the primary key?
My question is if using LIMIT there will be some performance gain in the QUERY. Example: SELECT descricao FROM produto WHERE id = 9999 LIMIT 1 Has better performance than? SELECT descricao FROM…
-
9
votes1
answer1603
viewsHow to bring table with data when returning from an Insert
I edited the question of the post because I think it is the most logical solution to the issue. I have a page with 3 tabs and in one of these I upload files to my hosting and send the necessary…
-
9
votes2
answers18476
viewsoptimized way to recover last mysql ID
Which is the most optimized way to recover the last table id? I tested these two methods and the orde by took a long time. There is some beyond these? Note: nãp will be a query after Insert. It will…
-
9
votes1
answer22992
viewsAccess Mysql with C#
I’m creating a Form simple that has 3 TextBoxes and 3 buttons and I want to save the information typed in Textboxes in a table. I’ve already created the querys all within a class acessoBD, but I…
-
9
votes2
answers5074
viewsWhat is the use of 'SELECT 1'?
I am making a query using NOT EXISTS on a college job. The situation is as follows: 1.14 - Designing the CPF and the amount to pay in rentals by customers who have rented media and have not made any…
-
9
votes2
answers1340
viewsSmart Query with Mysql
I’m trying to make a "smarter" query on my DB, my doubt is as? I have a query: SELECT * from publicacao where titulo like '%$busca%'; and in my DB has several publishing titles, for example:…
-
9
votes2
answers202
viewsWhich is faster to read and edit, a database or a . txt?
It would be to store and rewrite only 1 digit INT, erasing one and writing another, on the condition that when it reaches 5, go back to 1, and go on doing that loop every time someone accesses.…
-
9
votes2
answers3664
viewsConnection to the Bank drops after a certain time
I have a server where I have several web applications connected to the database(Mysql). The problem is that if any system gets idle it loses the connection to the bank and I have to refresh the…
-
9
votes2
answers2252
viewsHow to check real-time database change with php websocket?
I want to update a div only when there is change in a certain field in the database, I’m currently using Polling, but I want to switch to websocket for performance reasons, but I only found examples…
-
9
votes1
answer517
viewsWhat is the name given for the number of columns in a table?
What is the name given for the number of columns in a table? And the name for the number of lines?