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
-
3
votes1
answer60
viewsExport . csv with complement of lines based on a fixed number
I have a table in Mysql of products. I need to create an export . csv of them. The products are in the bank as follows: cod produto valor pagina 123 caderno 1,00 1 456 lápis 1,00 1 789 borracha 1,00…
-
3
votes3
answers924
viewsCan you start a Select (SQL) in the middle of the data table?
Friends, is there any way inside the SQL language (and using mysql BD) where I can start a Select in the middle of a table? For example, I have 500 addresses in the table. I do a search of…
-
3
votes1
answer36
viewsNOT EXISTS usage in 2 subquerys
I tried to use the NOT EXISTS, but is bringing the results that does not exist in the table tb_pedidoproduto, I believe that the LIMIT is not working: SELECT produto.idproduto ,produto.nomeproduto…
-
3
votes2
answers655
viewsMysql parameter error with C#
string sql = @"UPDATE ivendas SET nritem=(@rank:=(@rank+1)) where id_venda = 20"; try { MySQLBase basemysql = new MySQLBase(); MySqlCommand cmd = basemysql.connection.CreateCommand();…
-
3
votes1
answer112
viewsWhat is the safest way to display ID (primary BD key) on web pages?
I am in the development of a web application, which would be necessary in some cases to make available in HTML (for JS to interact) ID of user posts, ID of comments and others... Example: <div…
-
3
votes2
answers77
viewsUpdating multiple records at the same time
I have a list with the id and email of each user id email 1 [email protected] 2 [email protected] 3 joao@gmailcom ... How do I mount an sql statement to update all emails at once in my user table? My…
-
3
votes1
answer1004
viewsFOUND_ROWS() from Mysql is a function that runs relative to local or global session?
I don’t understand much of this Mysql session issue, but to resolve a need I had to use the command FOUND_ROWS(), my query was like this: SELECT * FROM LICENCAS where FK_PEDIDO = 9479174 AND…
mysqlasked 6 years, 8 months ago Leonardo Bonetti 5,313 -
3
votes1
answer244
viewsDuplicated data when sending form and F5 and also stores empty values
Whenever I hit F5 or click send, php stores the data again. I know it’s a common problem and I’ve tried redirecting with the header, but it’s included in index.php with include. I also know that the…
-
3
votes2
answers181
viewscheck if the day exists or not with the if
I need to check if the day doesn’t exist... do Insert, if yes, update. I set an example in practice of what I need: if(ver se existe no banco){ .....if(){ ..........faz insert .....} }else{ .... faz…
-
3
votes2
answers152
viewsQuery between Mysql dates showing all days of range
I have a system of e-commerce in which N products are sold and I am making a comparison between sales of a particular product per period of time, ie the admin will have an area in which he chooses a…
mysqlasked 6 years, 7 months ago Bruno Boassi 31 -
3
votes2
answers101
views -
3
votes1
answer1430
views -
3
votes1
answer177
viewsHow to insert the button pressed in the database
In my code I have 3 buttons, which serve for the user to classify the service: <input type="submit" name="verde" class="verde" value=""> <input type="submit" name="amarelo" class="amarelo"…
-
3
votes2
answers351
views -
3
votes1
answer116
viewsHow to update two tables in an alternative way that does not return "safe update mode" in Mysql?
I have two tables, one for users, and one for validation codes. I do a code check in PHP and need to do a query in the validation table at the same time that I update this table disabling this code…
mysqlasked 6 years, 5 months ago Samanta Silva 463 -
3
votes1
answer1298
viewsFULL OUTER JOIN generates errors
I am trying to run the following Mysql script SELECT `AccessDayClass`.`total` AS 'em aula', `AccessDayNotClass`.`total` AS 'em casa', `AccessDayClass`.`DateOnly` AS 'week' FROM `AccessDayNotClass`…
-
3
votes2
answers122
viewsQuery of similar records
I have a table where I cross exchange data of some professionals, For example, prof A has in common the exchange with prof F, so F has with A as well. But in the permutation report I would not like…
-
3
votes1
answer292
viewsConnection to separate PDO databases - (multi-tenancy )
I have the following password for my application: I have a PHP + Mysql application, with PDO connection, I need the application to be shared with all registered companies, but each company will have…
-
3
votes2
answers258
viewsIs it possible to manipulate SESSION variables to perform SQL Injection?
I’m not an expert on cyber attacks and I have a little doubt about the safety of my projects. Basically one of the ways I prevent injections SQL is creating a function "treatString()", for example,…
-
3
votes2
answers541
viewsMount INSERT from SELECT
I’d like to make a select and from it to generate the insert. I want to start from the prepost that I don’t know the table structure, the number of columns, nothing but the table name. select * from…
-
3
votes1
answer140
viewsEdit mysql ini in container
I’m using Docker to generate a LAMP. Man yml is like this: web: image: tutum/apache-php ports: - "80:80" links: - db volumes: - $PWD:/app db: image: mysql environment: - MYSQL_ROOT_PASSWORD=…
-
3
votes1
answer72
viewsCondition of a query with an under-consumption
I need to update the last 110 table records relevo, but my problem lies in the current WHERE. I’m doing it this way: UPDATE relevo SET id_projeto = 157 WHERE id_relevo = (SELECT id_relevo FROM…
-
3
votes1
answer111
viewsWhy the "quotes" in the INT data?
In the Mysql Workbench, when we do not enter a record by query, and yes manually, when giving the APPLY, to query is displayed before execution. Example of a query composed of the Mysql Workbench:…
-
3
votes1
answer381
viewsCalculation of SQL hours
I need to implement a report of hours worked within a period. My difficulty is as follows: the records of each day are in different lines and because of this, I’m having difficulty to beat the entry…
-
3
votes1
answer1791
viewsHow to remove duplicate records in Mysql with WHERE condition
My address book table has many duplicated addresses for each client. Note in the image below that I have many duplicate Zip Codes for the same client with ID 12. I need to remove duplicate addresses…
-
3
votes1
answer219
viewsValidation of string size
I was creating a function to validate large text fields (description, observation, ...), which in SQL will be saved as TEXT, so I basically did this: function($valor, $min = 0, $max = 65000) { if…
-
3
votes1
answer131
viewsColumn for Mysql row
I have the following table: | Roll No | Student Name | Q1 | Q2 | Q3 | |--------------|--------------|--------|------|------| | 1 | Aluno 1 | 1 | 1 | 1 | | 2 | Aluno 2 | 1 | 1 | 0 | | 3 | Aluno 3 | 1…
-
3
votes1
answer90
viewsDisplay data from two grid tables with YII framework
Hello, I’m starting how to develop web and I’m having a problem working with YII framework 1. I have in the application a grid that displays: product name, segment, price. All these data come from…
-
3
votes2
answers426
viewsSQL command in String Mysql
I am making a precedent that saves a select in a varchar variable. Now I need to run this sql command, how do I do that? I am using Mysql. Procedure: delimiter $$ create procedure eixos_caminhao (in…
-
3
votes1
answer1428
viewsHow to quote a variable for Mysql query
I’m doing a trial, I need to put a variable varchar in the query, but it doesn’t go with the simple quotes, I tried to concatenate like this or something but it’s no use: set @comando :=…
-
3
votes1
answer956
viewsScale of shift services in php
I intend to create a monthly shift schedule. I’ve got four shifts: T.M = Morning shift (has 11 assistants this shift, but on each day break 3) T.T = Afternoon shift (has 5 assistants this shift, but…
-
3
votes1
answer155
viewsUse multi-tenancy model or other types?
I am working on several systems for a single company. In some cases, the systems must integrate and in others not. For example, user access control must communicate with all other systems, since…
-
3
votes2
answers388
viewsHow do replace in all fields except one?
I have a table with several fields, and I need to make a insert or replace on each line. I receive the data coming from a software and if it does not exist, I enter, otherwise I replace. I get a…
-
3
votes1
answer457
viewsCodeigniter form_open_multipart, how to use
I’m using Codeigniter in a project but I’m having a hard time sending the information, I have a view that contains a form with the registration fields: <?php echo…
-
3
votes1
answer224
viewsIs there a difference in finding the maximum value directly in SQL or checking it with PHP?
I saw in a question on the site a user get the maximum value of a given column of a table in the database as follows: $result_max = mysqli_query($conn, "SELECT CGenericas1 FROM…
-
3
votes1
answer156
viewsHow to manipulate several banks with Hibernate?
I am testing the functioning of Hibernate and I came across a question. I have the following configuration: Hibernate.cfg.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE…
-
3
votes1
answer45
viewsMYSQL 5.6 does not recognize the query as it should
Greetings! I’m building a query to pick all the times the value was 0 on a given day and the highest time of the previous day. The data in my database is similar to the data I put in SQL Fiddle.…
-
3
votes2
answers290
viewsDoubt when performing SQL with Eloquent of Laravel
I’m with a bug I don’t know why. I have in my controller the following Eloquent: $balances = BankUser::select(DB::raw('SUM(balance) AS total, created_at, DATE(created_at) AS total_at'))…
-
3
votes2
answers351
viewsSum values from a column in the database via date filter
I need to sum all the values of a column containing in each row a specific date, that is, in the database, the values are saved with the date typed in the textBox in the act of registration, and I…
-
3
votes1
answer36
viewsHow do I use today’s date as column title in Mysql
I have the following table: Whereas today is 02/01/2019, while doing the pivot table below: SELECT hora, CASE WHEN data = CURDATE() THEN tarefa ELSE NULL END AS campo_1 FROM tabela WHERE data…
-
3
votes1
answer54
viewsDatabase is not connecting!
My database isn’t connecting. When doing a refctoring of my code following the MVC standard the database stopped working. Follow link with the test files:…
-
3
votes1
answer130
viewsWhere do Eloqent Laravel Doesn’t Work
I have the following code public function getConsultaLocacao() { $consulta = LocacaoBanco::where('id',4)->get(); foreach($consulta as $v) { echo"aqui->".$v->datalocacao; } echo…
-
3
votes1
answer31
viewsLogin using Prepared Statements from Mysqli returns error
I’m, for the first time, using Prepared statements. I am confused and do not know why is not returning the authenticated user. Follow my code: index php. <form method="post"…
-
3
votes1
answer1310
viewsIn Sql server does "GO" have the same point and comma function?
What is the reserved word "GO" for Sql Server, when generating a script using Sql Server Management is always generated with the reserved word "GO" at the end of the instructions, however if I take…
-
3
votes1
answer66
viewsIncomplete sum with JOINS in Mysql
I’ve had a doubt for a few days and I can’t find a solution. I own the tables: swing +------------+---------+------------+----------+ | id_balanco | id_loja | data | dinheiro |…
-
3
votes2
answers503
viewsDeleting data from a MYSQL table with Java
I’m trying to delete data from a table with Java but for some reason the code is not working. Excerpt from the code below: public void excluir(ModeloObjeto modelo) throws Exception{ Connection…
-
3
votes1
answer725
viewsLogic SELECT CASE WHEN
would like help in building the following logic: I have my main table and two other tables A and B, which have foreign key from the main. When an X column is filled in table A I need to classify my…
-
3
votes1
answer179
viewsHow to insert PDO records into Mysql sequentially
I am sending six fields of a form to insert in my Mysql but only the first three are going correctly, I need to insert the first three and in sequence the other three, but I have this difficulty in…
-
3
votes0
answers240
viewsWhat am I doing wrong?
Hello, good(a) day, afternoon or night, I would like you to help me answer what I am doing wrong in my code, because, I have already tried to redo and do everything and more, and I am not…
-
3
votes2
answers82
viewsSave changes to the bank
I am trying to change the data saved in the Database, basically when I double click on DataGrid he populates my TextBoxs to make the changes in the bank, but when I click to save it from the…