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
-
5
votes2
answers1524
viewsCondition on Join or Where?
Is there any difference if I use: select * from a left join b on a.id = b.id and b.id2=1 where ... or select * from a left join b on a.id = b.id where b.id2=1 Sent on: Fri ? The first SQL returned…
-
5
votes3
answers2040
viewsCheck if a record was deleted when running DELETE query
I’m making a simple PHP code to delete database email, only I need to use one if and else if a given action occurs. If for example, deleting an email shows a particular message, or if you do not…
-
5
votes1
answer624
viewsWhat kind of data do you use to store Uris in the database?
What kind of data to use to store Uris in the database, taking into account an indeterminate or very large URI length?
-
5
votes1
answer259
viewsGroup items with a date difference of 10 minutes between you
I have a table called tb_log, in it I have some data id, usuario_id, produto_id,..., data. I need to group the records by date as follows: All records that differ by up to 10 minutes from each…
mysqlasked 8 years, 2 months ago Leonardo Hofling 59 -
5
votes1
answer2898
viewsCode to show procedures in Mysql
What Mysql code to display procedures created by me?
-
5
votes2
answers1913
viewsQuery to pick text after a certain character
Good morning, I need a way to get all the rest of a string after a certain character, for example, I have the following database I always need to find what’s left of the string after the last "»"…
-
5
votes1
answer150
viewsDoubt how to make Insert in this model
I am developing an application that has the need to have a natural person and a legal, I would like help to know how would be the insert of this model If I want to register a natural person I must…
-
5
votes2
answers309
viewsMysql does not use Input in query (Inner Join)
I have a query that is taking time to be executed, analyzing the explain I see that Mysql is not using the Word in one of the tables. Tables: CREATE TABLE `rel_financeiro` ( `protocolo` char(13) NOT…
-
5
votes2
answers879
viewsAvoid more than one register in the database
I’m having problems because I’m making a community system where the user registers and shares stories. More when I went to test clicked on register 2 times and 2 times it went to the database even…
-
5
votes2
answers3089
viewsJS node - Mongodb x Mysql
Why every JS Node tutorial we see, is always shown example in Mongodb. What you both have that are so used? Why not use Mysql with Node?
-
5
votes1
answer116
viewsIn a repetitive structure are there differences between working with Object or Array?
When I do a query in the database by PHP and want to return this data with while, usually use the fetch_object(), which returns the data in type object. For example: $query = "SELECT * FROM TABELA";…
-
5
votes2
answers324
viewsSearch with Mysql PDO in Array
I have that code: $whereBusca = "itaim-bibi"; $whereBusca = explode(',', $whereBusca); $sql = $pdo->prepare('SELECT id, nome, caminho FROM regiao WHERE caminho IN (:whereBusca)');…
-
5
votes2
answers1943
viewsUsing AND inside an INNER JOIN can?
I wonder if it is possible to use AND within a INNER JOIN, example: SELECT * FROM tab1 INNER JOIN tab2 ON tab2.id2 = tab1.id1 AND tab2.camp1 = 'valor' INNER JOIN tab3 ON tab3.id3 = tab2.id2; I gave…
-
5
votes2
answers1020
viewsHow does the pagination with PHP + AJAX occur?
I was browsing the site looking for a functional example of paging with AJAX + PHP, when I found this example Excuse my ignorance, but the 'asynchronous loading' of AJAX causes me doubts.. However,…
-
5
votes1
answer649
viewsHow to use LIKE in bindValue?
How to use the operator %, to the bindValue(), in query down below: $sql = 'SELECT * FROM nfe WHERE (cliente LIKE :cliente OR :cliente_ IS NULL)';…
-
5
votes2
answers4183
viewsHow to discover a collation of a table or database using an SQL query?
I can visualize the collation of certain table or bank perfectly by Phpmyadmin. But if I did not dispose of this aforementioned tool, as I could do to discover the collation by manually doing an SQL…
-
5
votes2
answers4615
viewsSQL LIKE is Case Sensitive(Case Sensitive)?
By having this doubt, I did not find quick results in Portuguese that offer answer(most of the results are in Stackoverflow in English). It would be interesting to have an objective answer here in…
-
5
votes1
answer433
viewsHow to select multiple columns using the table prefix only once?
In relational model condition, I have to specify the prefix of the table, I’m sure? Example: SELECT c.nome, c.idade, a.nome, a.idade FROM... What I wanted to know is if you can’t do something like…
-
5
votes2
answers1259
viewsHow to escape the percentage character (%) in the LIKE?
I have a system where I use the Laravel to make the query in the database. It is a search form. I use the following code: $search = trim(Input::get('search')); return Empresa::where('nome_fantasia',…
-
5
votes1
answer1718
viewsHow does auto increment work with composite keys in the Myisam engine?
I ended up taking a table to manipulate, I noticed that sometimes the value of auto increment repeated, the first thing that called me the attention was that the key Primary was composed of two…
-
5
votes1
answer1165
viewsLocate nearby restaurants registered in the database through google maps
I could use some help. I have a PHP system with a mysql database with several registered restaurants, with fields such as: id, name, address, longitude and latitude and I am creating an application…
-
5
votes2
answers2096
viewsMysql and C#inheritance modeling
I have a question about modeling a Desktopapplication system in C# with Mysql. Essentially I will have the entities Customer, Supplier, PF and PJ. PF can be a customer or supplier. And PJ can also…
-
5
votes1
answer2736
viewsError "Doesn’t have a default value" when trying to insert data into DB
I was trying to enter the variables I received from a form when I received this error message: 'nidcrespons1' doesn’t have a default value My code: <?php $link = mysqli_connect("localhost",…
-
5
votes1
answer1838
viewsCompare Coordinates
In my mysql I have a column containing positioning coordinates coming from a polygon, drawn in the google maps api, the question is how can I compare the coordinates I have within the column with…
-
5
votes2
answers2991
viewsSQL for last month and last two months
Hi. I’d like a hand here. I need to get the records: Mysql bank 1) last month 2) last quarter 3) Current year SELECT id, data, lote, modelo, qtd FROM controle_diario WHERE modelo like ? The table is…
-
5
votes2
answers354
viewsWhy does max not even min return the expected value?
I need to take the highest and lowest value of a given field to be able to make a filter, only SELECT MAX or MIN does not work. As you can see in the image below, I need this amount of users Table…
-
5
votes3
answers6709
viewsIs it possible to have more than one Primary key in a table?
I have a gym and I’m wearing one Pk for all gym users to have their own (ID). It is possible to use other PK in the same table? For example: to prevent Número da Matricula or even the CPF/RG if…
-
5
votes1
answer423
viewsUse CONCAT to adjust the amount of php mysql numbers
I need to complete the amount of numbers to display on the screen, what would that be. a amount which would be an example: 20 need to fill 15 characters with 0,Example: 000000000000020. A friend of…
-
5
votes3
answers1864
viewsCheck if a date is earlier than another date
Good morning, I wonder if there is a way to check if one date is earlier or higher than another, in my code there are 2 inputs like date, which send their values to the database, but one date will…
-
5
votes2
answers2146
viewsWhat is the difference between mysql-server and mysql-client?
It is said that using the command apt-get install mariadb-server would also install the mariadb-cliente. I understand that the server can be said to be where the data persist, however I lack an…
-
5
votes3
answers24766
viewsIs it possible to use if Else in Mysql queries?
I’ve been searching the internet and hearing rumors that it is possible to use if else in Mysql queries but saw nothing concrete about it. Is it even possible? If so, how? I want to make a query in…
-
5
votes2
answers398
viewsConvert date to Unix timestamp
I have a table in a Mysql database that has a date column VARCHAR, guy 20-09-2017 and I need to migrate this column to a column bigint(8) using the date format timestamp unix. How to do this?…
-
5
votes1
answer166
viewsWhat are these sql modes for in mysql?
Here is the code: SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES'; SET SQL_MODE=@OLD_SQL_MODE; SET…
mysqlasked 7 years, 1 month ago M. Martins 71 -
5
votes2
answers1573
viewsWhat is the advantage of a 1:1 relationship?
I have a database (Mysql), and in a table I’m having about 80 columns. I am thinking of separating this information into other tables, and maintaining a 1:1 relationship. But this can impact a…
-
5
votes2
answers2074
viewsChecking remaining days between current date and contact deadline
Good afternoon everyone, as per the code below, I am not being able to check the remaining days between $data and $prazocontact. $consulta = mysql_query(" SELECT s.id_cliente, p.nome_servicos,…
-
5
votes1
answer776
viewsAllocation Space for Mysql Fields
First I create the model in my application, then the Entity Framework generates the SQL for the table creation. The first statement generates a column with the type varchar(20), the second generates…
-
5
votes2
answers287
viewsMysql query - Cross Tables count
I have the following tables: Each tuple of the table Pageviews (main) contains a single page view. If by chance the same person in the same session (Sessions) view the same page (Pages), a new tuple…
-
5
votes1
answer1602
viewsHow to avoid deletion of relational data through referential integrity in MYSQL?
I have the tables SIMULATED and QUESTAO, where a simulated can have several questions, but a question can only be for a simulated (relationship 1-n). MOCK TABLE: simuladoId simuladoNome TABLE…
-
5
votes2
answers1719
viewsHow to search two words in the same Mysql field
Good morning. I have a field on my table called tags, would like to do a search, where two or three words can be considered. Example: In the field tags, I have some words, like "free", "cabins",…
-
5
votes4
answers13421
viewsQuery INSERT with WHERE condition
How can I make an Insert with a Where condition? I have the following query: INSERT INTO `registro`(`id`, `username`) values ('','USER_1'), ('','USER_2'), ('','USER_3') It will add a new user to the…
-
5
votes1
answer3762
views -
5
votes1
answer77
viewsQuery to find if value is between "1|3"
I have a table units that represents the number of dormitories of the buildings: id| dorm 1 | 1|3 In this case above means that id 1 has units with 1 or 3 dormitories. Then I have a search using…
-
5
votes2
answers131
viewsMysql DATE type is displayed as DATETIME on a datagrid
I create a very simple database with the following command: CREATE TABLE IF NOT EXISTS `ABC`.`Socio` ( `idSocio` INT NOT NULL, `SocioNome` VARCHAR(45) NULL, `SocioDataNasc` DATE NULL, PRIMARY KEY…
-
5
votes1
answer2397
viewsMysql connection problem - Connection must be Valid and open
I’m having a problem at a Windows Form in C# using Datagridview. The following is done: by clicking on a datagrid line the information of the respective line, saved in a database, must appear in a…
-
5
votes1
answer217
viewsBetter BD structure with large number of data and filterable columns
I have a Mysql database with a table that is taking too long to complete a query. I would like to know what would be the best database structure indicated for a table with many fields that are…
-
5
votes2
answers7405
viewsWhat is the difference between SCHEMA and DATABASE?
I had never used Mysql Workbench and it instead of database, gives me the option of SCHEMA. What is the difference between the two? It gives in the same one or the other?
-
5
votes1
answer106
viewsCalculation of hours within consultation
I already made this account and it works right in C++. My problem is to do inside a select to appear in the table. If someone wants to see the C++ algorithm to help mount in Mysql I can send. This…
-
5
votes2
answers397
viewsMYSQL - Check if PK exists if it does UPDATE if it does not exist
I didn’t want to have to do two transactions in the database, currently I’ve been doing SELECT first to know if the record already exists in the table, then I do either INSERT or UPDATE depending on…
mysqlasked 6 years, 2 months ago SneepS NinjA 7,691 -
5
votes1
answer330
viewsHow to save bank data in the database?
When making a virtual store what is the best way to save the user’s bank data in the database? Credit card number, security number and expiry date. For example, using Laravel. It would use a type of…
-
5
votes2
answers69
viewsSort a Select by criteria outside the database
I would like to create a SELECT with the personal relationship here of my company. SELECT função, nome FROM responsavel; So far so good. But as ordered by the Manager, passing by the Incumbent,…