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
-
9
votes3
answers46833
viewsHow to rename the column name SQL Table
I want to rename the column name via SQL. I am trying as follows: ALTER TABLE nomes_clientes RENAME COLUMN primeiro_nome TO nome, RENAME COLUMN segundo_nome TO sobrenome; But that way it’s not…
-
9
votes1
answer3234
viewsWhat is dynamic SQL?
I have seen many cases where some show how to use, and others where they simply advise against using SQL dynamic. I had the following doubts: But anyway, when we should or should not use dynamic…
-
9
votes1
answer503
viewsQuestions about Mysql integration with Java
I am creating a system in Netbeans, using the Java language and the Mysql database. I wrote the following code to make the connection between the program and the database: public class Conexao {…
-
9
votes2
answers1527
viewsHow to search for saved records in the current week?
I’m doing a database query, and I plan to list the records for the current week. It would be something based on the question about retrieve data from last 7 days from current date, but instead of…
-
9
votes2
answers395
viewsDifference between Alter Table Foreign Key
I would like to know the difference between the execution in the clauses Alter Table when inserting the ADD CONSTRAINT , such as running the following code: ALTER TABLE Orders ADD FOREIGN KEY…
-
9
votes3
answers3355
viewsWhat is the difference between LOCATE and INSTR functions?
The description of the function LOCATE, in free translation, it is: Returns the position of the first occurrence of substring. The description of the function INSTR, in free translation, it is:…
-
9
votes1
answer23344
viewsSQLSTATE 42000: Syntax error or access Violation: 1071 Specified key was Too long; max key length is 767 bytes with PHP
After I created the project with the command composer create-project --prefer-dist laravel/laravel laravel-scout I have been making the following changes to the archive .env DB_DATABASE=course…
-
8
votes1
answer1608
viewsHow to apply the IF ELSE condition to selecting a column?
In Mysql, I have an old table entities where the column gender is in the format ENUM, containing values of the type: "i", "m", "f". When migrating this data to the new structure of this table, I…
-
8
votes6
answers52587
viewsHow do I use a database on an HTML site?
I am interested in making a site that will use a database, many told me they use Mysql to do this, but I have no knowledge about it, installation, use etc. I have knowledge in PHP, HTML, CSS and…
-
8
votes6
answers1639
viewsRemove an undetermined number of " " in a column in the database
The field description on the table product contains HTML generated by Ckeditor (English) that tries to escape the content: <table…
-
8
votes2
answers2031
viewsHow to take the position of an individual user in a rank, if in the database I only have your score?
With the code below I can display all users as I put DESC and the variable $num and increasing the placement with $num++;. But what if I want to take the placement/rank of the guy who’s logged in…
-
8
votes7
answers54187
viewsRemove letters and special characters in a select
I have in my table the field documento with the following data: How do I select only the numbers of these records by removing the letters and special characters? DOCUMENT CPF-12345698-35…
-
8
votes3
answers2192
viewsHow to work with multi tenancy architecture?
I was asked to develop an application with multi tenancy architecture in the PHP language using Mysql as a database. After reading several materials and posts on the Internet, I had a question. How…
-
8
votes1
answer1256
viewsInvalid parameter error when doing PDO perform action
I’m trying to learn how to use PDO, so I’ve already worked HARD looking for everything to understand it. So I’m at a point that has left me quite confused. I got the following code, he’s the:…
-
8
votes2
answers654
viewsPerformance of query LIKE in Mysql
Is there any way to increase the performance of a query with LIKE '%string%' in Mysql? I know that if the LIKE for 'string%', is faster. The problem is when the % is at the beginning of the string.…
-
8
votes3
answers7725
views"HTML contains invalid UTF-8 Character(s)" error when using mpdf
I have a problem using mPDF. Basically, I have a code that makes a select of a table and then displays the values in a PDF page. The problem is that if any table value has an accent (example:…
-
8
votes1
answer1660
viewsPooling Connection management by PDO
We often see in the applications multithreaded using connection to a database, the use of a Connection Polling, where you keep an open "pool" of connections, thus increasing performance so that you…
-
8
votes3
answers1971
viewsRecords with recurring dates filtered for a period
The Problem I am creating a financial system where I need to register a recurring movement, for example, a light bill that repeats every month. In the system, this type of movement is treated as a…
-
8
votes3
answers1629
viewsMultiple connections with the Bank
In a PHP system that communicates with the BD (Mysql) to recover the information and returns it to the user who accesses it is necessary to establish multiple connections with the Bank? Or just one?…
-
8
votes2
answers1720
viewsWhich is faster, access data in file or database?
In terms of performance which method is fastest to recover data, 1) read a file (which will be generated only once with PHP) or 2) take this data from a database? This data will always be shown on…
-
8
votes2
answers362
viewsHow do I convert LINQ to SQL for Mysql?
I am trying to remove the use of SQL statements from within the system (to make it flexible as to which database will be used), use instructions Insert, Update and Delete via stored Procedure…
-
8
votes1
answer6718
viewsTruncate all tables in a database in Mysql
There are ways to use the TRUNCATE to clear all bank tables? TRUNCATE tabela; This command cleans one by one.
-
8
votes3
answers17275
viewsError #1062 - Duplicate entry '1' for key 'PRIMARY'
I was trying to put one of my tables as primary key. As soon as I try to get the message: #1062 - Duplicate entry for key 'PRIMARY' The data are filled in and are more or less like this: I tried to…
-
8
votes2
answers2097
viewsMysql connection failed via VBA
I am trying to connect to a Mysql database via Excel VBA, but returns an error stating catastrophic failure. I made a test by putting the wrong password, or the name of the wrong database, and it…
-
8
votes1
answer641
viewsSQL using an Array of words
Is the following I have a search field in a form where the user type for example a color or product and is returned to it a list of products with the characteristics typed in the form, the problem…
-
8
votes3
answers579
viewsHow to join data from another table
How to join data from another table. On the bottom bench I have 3 tables: dados: id, nome, end, tel... etc.... cidades: id, nome_cidade status: id, nome_status $sql = "SELECT * FROM dados ";…
-
8
votes3
answers24407
viewsWhat is the performance difference between BIGINT and INT in Mysql?
There is some negative impact on the performance of Mysql, where the Primary Key is the type BIGINT(20), instead of INT(11)?
-
8
votes1
answer81
viewsProblems with a MYSQL query - Categories and Items
I’m doing a project, which basically consists of item and category... or better "animes" and "episodes"... Here’s the problem, I want to list all the registered anime and a count of the episodes…
-
8
votes1
answer2706
viewsHow to count the number of tables in Mysql?
I am trying to count the number of existing tables in a Mysql database. I tried to do it the way below, but returned a syntax error: SELECT COUNT(SHOW TABLES) How can I do that?…
-
8
votes1
answer564
viewsCardinality of the index does not update
I am creating a program that connects to a Mysql database online, and when starting it it creates a table with an index if it does not exist. To check if everything is ok I am analyzing the database…
-
8
votes1
answer3746
viewsHow to save multiple inputs with the same "name"?
I need to save several input that contains the same "name", but the problem is that it only saves one single result for several. Example: <form method="post" action="guardar.php"> <input…
-
8
votes1
answer14933
viewsDouble type and Decimal type, which is suitable for monetary value?
I found here in the SO a question with an answer until well accepted by the community What kind of data (double, float or decimal) should I use to represent currency in . NET with C#? I just never…
-
8
votes1
answer1129
viewsLong Polling performance with PHP, Mysql and Ajax
I’m developing a site in PHP, and using Long Polling techniques for real-time notifications. I’m making the script wait 50 seconds for an answer, and not getting one, in 2 seconds it comes back to…
-
8
votes3
answers11171
viewsHow to return the ID of a record right after it is inserted?
I am making a Java application in conjunction with a Mysql database and would like to know what would be the best command to return an auto database increment ID right after the record is inserted.…
-
8
votes3
answers1685
viewsHow to handle large volumes of data in a database?
I have a process that I need to implement on my system that, at a given time, will check a relatively large number of data and, if not found, should save in the Mysql database. This should be…
-
8
votes3
answers2208
viewsCreate database on server via mysql-Workbench (.mwb) template via command line
I am trying to assemble a bat to create the database in the mysql server from an EER (.mwb) mysql-Workbench model, that is, in the command line, is it possible to perform this process? Someone could…
mysql relational-model batch mysql-workbench command-lineasked 9 years, 5 months ago Artur_Indio 1,093 -
8
votes3
answers241
viewsBest way to keep data that depends on a condition
Hypothetically I have a table publicação that has, by default, attributes autores (derives from a relationship table),titulo, edição, editora and ano. However, depending on the type of publication…
-
8
votes1
answer1481
viewsWhat are "generated columns" in Mysql and what would your applications be?
I downloaded the new version of Mysql Workbench and when I was creating a table I noticed a new property of the field that is called Generated Column. On the Mysql website it says that this is a new…
-
8
votes1
answer528
viewsORDER BY only day without hour
In Mysql I have a column timestamp calling for dia_cadastro (2016-06-21 11:27:32), in consultation I want to give a ORDER BY only on the day, and disregard the time. That is, if they have products…
-
8
votes4
answers1166
viewsHow to sort the data of a query by predefined values?
Using as an example, I have a certain user table, where that user’s city is, is a reference to another table. I need to order these users in a query according to the location of the current logged…
-
8
votes2
answers233
viewsHow do I display the customer name of a particular sale? I’m not getting the name with get
sales list code I’m having trouble presenting the customer name of each sale and product name of each sale tbm! I don’t know what I’m doing wrong <?php include_once("Sessao.php");…
-
8
votes3
answers1491
viewsIs it good practice to use composite keys as the primary key?
I don’t have much knowledge in database structuring. I have been trying to improve myself and I am seeking best practices on how to create and structure tables. Currently I usually create link…
-
8
votes2
answers184
viewsHave images in the tables where they will be used or table with image repository?
It is good practice to create a table to record all images from a database, or I can create columns that save image information for each specific need? For example, let’s assume that I want to…
-
8
votes2
answers1059
viewsHow to create a csv from a database and data query
I was able to create a perfect . xls file, but . csv can’t follow the code I used to create . xls $dadosXls = ""; $dadosXls .= " <table border='1' >"; $dadosXls .= " <tr>"; $dadosXls .=…
-
8
votes3
answers2879
viewsHow to know how many Sundays have php mysql months
Let’s say the year is: 2016 I need to know how many Sundays have the months of the year and save and result in php variable. Reason: I need to pass a condition,: if ($dom_mes == 4 ) { //CONDIÇÃO A }…
-
8
votes5
answers1583
viewsHow to read data from the Mysql database of an application in c#?
I have a table with 2 columns in phpmyadmin,I can connect and read one column but not the other, from the following error An unhandled Exception of type 'Mysql.Data.Mysqlclient.Mysqlexception'…
-
8
votes2
answers195
viewsHow to check data range?
When requesting a vehicle reservation, the system inserts the scheduled departure and return time code (we prefer to work with fixed codes instead of schedules in order to facilitate programming).…
-
8
votes4
answers5196
viewsHow to save line breaks from a textarea to the database?
I have a textarea and would like to save the user-made line breaks in the database. For example, user writes the following: "Lorem Ipsum. Is simply. Dummy text. Of the printing. And typesetting."…
-
8
votes1
answer1119
viewsRounding of 5 cents
In a PHP system I am developing, I need to update a column of the price table. The price field is in the format float and the administrator informs the percentage of increase. Example: Informs that…
-
8
votes3
answers1312
viewsHow to create PHP executable program?
Is it possible to create a program for my company that is executable, only with PHP and Mysql? Or I will need other languages such as C, Java, etc. In case the program is internal only.