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
answers4608
viewsSQL - How to select or delete a column with value equal to null in a query select
I have a table in a Mysql comic that has 5 fields. This would be a model query: select * from myTable where campo1= 4 and campo2=1 and campo3 =7. However field 3 may have null value and I would need…
-
4
votes3
answers4851
viewsCut string at last occurrence of a character in a string
I have a text in a column that has information separated by "-"(hyphen) and I need to remove the last and second to last information. Examples: Transform "Informacoes - Separadas - Por - Hifen" in…
mysqlasked 8 years, 5 months ago Daniel Dutra 2,283 -
4
votes4
answers83
viewsOnly join if the above query returns records
Good staff, I would like to know what approach they would take to make a union only if the above query of the union returns values. Consider that the tables are compatible EX: SELECT * FROM Tabela1…
-
4
votes1
answer7226
viewsHow to run a PHP database
I’m trying to create a listing and I’m having trouble calling the Select Database. Code connecting to the bank: <?php $conexao = mysql_connect("localhost", "admin", "admin") or print…
-
4
votes3
answers1222
viewsFilters with PHP - Search Form
How could I make a filter like that from the example image? The part the tables with the data and SELECT to fetch is quiet. What I’m suffering from is how to build PHP code for this, maybe someone…
-
4
votes1
answer518
viewsHow to upload data to Mysql faster?
I have a DER that represents an airport and I have to upload data from several csv. for example I have a 1-to-many connection, by plane for flights. If I have this table connected with the foreign…
-
4
votes1
answer51
viewsWhat does this piece of sql statement mean?
I have this instruction in the database modeling archive and would like to know what it is. 'price_type' enum("S" "M")
-
4
votes1
answer14054
viewsmysql Delete all records from a table except the first
Does anyone know where I’m going wrong? or if it’s possible to do this? I wrote the query like this: DELETE FROM reservas WHERE ID NOT IN (SELECT ID,IDORIGEM FROM reservas WHERE ID='387' and…
-
4
votes2
answers1405
viewsSUM in SELECT with LEFT JOIN being multiplied
I have 3 tables in MYSQL. Bill: id nome 1 caio 2 zé 3 marcelo Followers (the account id, that is, the user has 2 followers): idqual 1 1 2 2 2 3 Products (the account id, that is, the user caio has 3…
-
4
votes1
answer620
viewsMysql Unique record insertion problem
I have a table that has a Unique field, I deleted a record of this table and now I want to insert it again, however Mysql generates the error: "Error Code: 1062. Duplicate entry '' for key '". How…
-
4
votes2
answers2248
viewsLatitude and Longitude Calculation - Approximation
You guys, I’m in a bit of a pickle... Currently I have the data Latitude and Longitude of business registers in my database, with this I need to bring data next to me, in case would have latitude…
-
4
votes2
answers475
viewsInclude extremes in BETWEEN and List missing values in SQL query
Next. Imagine I have in the bank in the paid months field the following releases: 2015-03, 2015-04, 2015-7, 2015-9. If we set a period for example: from 2015-02 to today (2015-9). Which months are…
-
4
votes1
answer897
viewsSelect to show all tables that have fields with specific data type
I have a database that I need to change all the columns that are in FLOAT AND DOUBLE to DECIMAL, are about 150 tables and I spend a lot of time looking one by one, there is some command that shows…
mysqlasked 8 years, 4 months ago Mauricio Ferraz 2,074 -
4
votes1
answer500
viewsIs it OK to use SQL Server or Mysql with PHP?
I’m putting together a medium project and I’m going to model the bank, then create the tables, the views, as procedures beyond the bank itself of course. I would create everything with Mysql, but by…
-
4
votes2
answers844
viewsOmit seconds in Mysql time field
Guys I have a field on my table of type time, where I save my time. Problem is he’s saving it like this: 10:30:01, how do I save him only the hour and minutes. That is without the seconds? The field…
mysqlasked 8 years, 3 months ago Hugo Borges 5,294 -
4
votes1
answer55
viewsHow do I change everything to a single php value
My question is this:: In a table, I have a column designated nomecliente. In this table I have several records, however the column nomecliente of the records are different from each other. How could…
-
4
votes1
answer29006
viewsvariables in mysql: declare, set, how to pick an element from a table
Speaking of variables that can be declared within the begin, I saw that you have Declare e set only that I don’t know when to use them. I saw that you have set @x, set x, set x = x+1, set x := x+1;…
-
4
votes2
answers40
viewsHow to change the value of fields in a column?
I am with a simple doubt but I could not find a solution. The same way I can when I use select bring an empty column using select a.x,NULL as y,a.z from DADOS a, how can I make a column instead of…
-
4
votes1
answer139
viewsRecover last row inserted in table with non-sequential primary key - Mysql
It is possible to know which was the last row inserted in a Mysql table where the primary key is not sequential? I have a table where the primary key consists of two columns that are FK, so they…
-
4
votes4
answers188
viewsSQL Embedded in C#
I have a C# application that uses a Mysql database with Entity Framework. However, the size of the database is ridiculously small, so I don’t think it’s worth having a Mysql database server just to…
-
4
votes1
answer4360
viewsHow to remove the UNIQUE KEY attribute from a column in Mysql?
I created a table in Mysql that uses a column called loja_num with the attribute key dish UNIQUE KEY loja_num (loja_num, But now, I would like to remove this attribute from this column. I have…
-
4
votes1
answer174
viewsDoubt about float field query (ruby on Rails with mysql)
Hello, I have a question regarding the database with Rails. If I declare a field to be "float", when I do the query, I need to use the ". to_float" so that Rails understands the type of this field?…
-
4
votes3
answers533
viewsHow to compare Mysql to an array?
I have to make a comparison MySQL with an array of numbers. For example: I have a array whole-assed: $inteiros = array(); And I have to return the ids of my class table with this array, thus: SELECT…
-
4
votes1
answer341
viewsError inserting Mysql PHP data using Android Volley lib
I am developing an application that will have to send data to a server. My php source code is this: Connection.php <?php $mysql_hostname = "localhost"; $mysql_user = "root"; $mysql_password = "";…
-
4
votes2
answers1019
viewsGenerate random number for an array
I have a foreach that fetches data from a table and makes a insert in another table. I need to count the amount of foreach, and then generate a random sequence, and feed a field of insert. Look at…
-
4
votes3
answers4136
viewsHow to subtract a date from the current system date
I want to subtract the current system date with the date that is saved in mysql. I insert the date into mysql via INSERT, manually, because I will not always use the current date to insert into the…
-
4
votes1
answer102
viewsHow to model a set of 1 to 4 predetermined values
I am modeling a Mysql database where the main entities are documents. Among several other fields, these documents relate to one or more phases of a particular project. There are 4 basic values…
-
4
votes1
answer2947
viewsHow to change primary key referencing foreign key to auto increment
I have two tables, one call aluno and another call HistoricoAluno. After creating them, a change was missing which was to leave the primary key of the table alunos as auto_increment. By trying to…
-
4
votes1
answer1722
viewsSelect between two tables in PHP
I am currently using the following query to select all saved posts in the database: "SELECT * FROM postagens ORDER BY id DESC LIMIT 7", however, I want to select only the posts made by "friends".…
-
4
votes1
answer89
viewsHow can I get the BD date already formatted using the Max and Date_format functions together
I’m trying to get the biggest date registered in my BD, I am trying to use the functions MAX and DATE_FORMAT together and the search result is not what expected, I have these dates registered:…
-
4
votes3
answers820
views -
4
votes1
answer210
viewsIs it possible to give Insert with select?
I have two tables: hardware(ID, DEVICEID, NAME, ...) and softwares(ID, HARDWARE_ID, PUBLISHER, NAME, VERSION, ETC ...). I need to give insert in the software table, but I do not have the…
-
4
votes0
answers57
viewsJointjs: Embed Parents and Children
Good, I’m working with Jointjs but in a dynamic way. I am currently trying to embed the 'Parent' and 'Child' elements'. After selecting with the Child and Parent info, I get to get this information:…
-
4
votes1
answer339
viewsConsult if SLUG already exists
I would like to know how I do to query if a SLUG already exists in the database and, if it exists, how to increment +1 at the end of the string, getting: site.com/artigo/titulo-de-teste1…
-
4
votes2
answers355
viewsForeign Key does not respect referential integrity
I’m trying to put together tables and add one chave estrangeira, for example, a shopping list has referência of id from the buyers' table. I did it this way: alter table compras add foreign key…
-
4
votes1
answer2455
viewsRest API and Sessions, how does Login work?
I have always worked with PHP/Mysql and Javascript/jQuery. I have always connected PHP to the direct database, and I use login sessions. I am currently working on a project where I use Angularjs for…
-
4
votes1
answer1780
viewsRemove characters from a field in Mysql
I have a table where I have several codes, I would like to get all the codes that start with the following sequence 1170 and remove the same. Example, the following code 11701287871 would be…
-
4
votes3
answers918
viewsHow to do multiple Inserts at once?
Well I have 3 tables in my database, and I do one INSERT on the table sale, and as soon as I insert the data into it I would automatically have to insert it into the tables vendaservicos and in the…
-
4
votes2
answers758
viewsPHP Mysql avoid database registration in uppercase letters
Good morning, I have a database, where users insert various news. I’ve talked to all of them, not to put capital letters in the inclusion, because it makes the project aesthetically ugly. Is there a…
-
4
votes1
answer9332
viewsHow to Do Ascending and Descending Listing in PHP Records
My table is as follows Through PHP, I am listing the MYSQL database records within a WHILE LOOP. I would like to know how to do so that when clicking on ID, or DATA, the data is displayed in an…
-
4
votes1
answer1523
viewsMysql - ERROR! The server quit without updating PID file
I’m trying to spin : mysql.server start and return me ERROR! The server quit without updating PID file (/usr/local/var/mysql/user.pid). I tried to spin: unset TMPDIR mysql_install_db but he did call…
mysqlasked 8 years, 11 months ago user27585 -
4
votes1
answer99
viewsMerge 2 different tables and display content sorting by number of views (larger to smaller) of the two joints in Mysql
Whereas I have 2 tables in the comic, "news" and "news", each with its own fields: It is possible to make a SELECT in both tables at the same time so that I return the 4 highest values of the…
-
4
votes2
answers125
viewsHow to remove rows from a table A that has no relationship to table B?
I have 2 tables and want to remove the rows of table A that has no relationship with table B? For example: In table B I have a field FK_ID and I want to remove from table A all rows that have no…
-
4
votes1
answer206
viewsWhat mysql.sys do?
Good Evening Everyone, I just installed wampserver, later I was accessing phpmyadmin, but I found something strange in the user accounts. As users had only mysql.sys and root, being the "root" which…
-
4
votes1
answer2505
viewsHow to comment / document a table?
I saw in a Postgresql database that each table and each table field has a comment explaining what each one is for. Following model below: I want to know if in Mysql it is possible to do something…
mysqlasked 7 years, 9 months ago Italo Rodrigo 4,344 -
4
votes2
answers4557
viewsHow to compare two arrays and return the difference between them?
I have 2 arrays that come from 2 different banks, one comes from sql server other mysql. The Mysl query returns like this.. array (size=6) 0 => string 'ultimoteste3' (length=12) 1 => string…
-
4
votes1
answer117
views -
4
votes2
answers213
viewsErase everything except the smallest one per day
I have a space problem and there are many useless things being stored, but they are useful during the same day (you will understand). Real problem: There are more than 2 million "lines" and this is…
-
4
votes1
answer514
viewsSelect data from two tables to display in one column?
Consider the tables for customer registration : Table Person |ID|NOME|TIPO|EMAIL| Table Person Physical |ID|CPF| Person Juridical Table |ID| CNPJ| inscricao_municipal| inscricao_estadual| My goal is…
-
4
votes1
answer210
viewsHow to create a simulator using SESSION
Hello, I am trying to create a simulator using SESSION, but as I am a beginner and very lay still, I am asking for the help of friends. Next I created the page where the user can change the logo,…