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
-
2
votes1
answer47
viewsMysql giving error only when using query via variable
I am trying to save information in my database with the following functions: $sql = $request[0]; $query = $this->conn->prepare($sql); $query->execute(); var_dump of $sql: string(322)…
-
2
votes1
answer2976
viewsPhp does not connect to database (Mysql)
So, I started recently with php and tried to do a simple crud with php+mysql but, I had a problem that I believe is the connection with mysql. when loading the action (action) into html, the page is…
-
2
votes2
answers5168
viewsRelational database model with SKU
I am creating a system for selling products and I need that these products can have different prices according to their size or color, for this I am using SKU, I am creating the relational model of…
-
2
votes2
answers309
viewsMYSQL - Using SUM with Join
I have 3 tables Table Produtos with the columns id,descricao,peso. Table op_itens with the columns id_op, id_prod (chave estrangeira da tabela Produtos com a coluna id), qtd. I want to make a sum of…
-
2
votes1
answer411
viewsHow to do a query in sql that returns data from a table when the data is empty?
Well, I created a table called installments, that when the customer pays it is inserted 'PAID' in the column situation, and when not paid it remains blank. I wanted to fetch the information from…
-
2
votes1
answer42
viewsError reading Like with Timestampdiff
Good People Visual Studio can not read the column Days to make a search with like and is a mistake! I believe he reads the code at once and does not find Dias created with TIMESTAMPDIFF(DAY,…
-
2
votes2
answers41
viewsLogin form returning error!
I have a login form that returns the following ERROR: You have an error in your SQL syntax; check the manual that Corresponds to your Mysql server version for the right syntax to use near 'as valor…
-
2
votes1
answer38
viewsHow to turn a query row into columns and group according to the first 4 characters?
I would like to transform the return of my SQL query into an array where I select the first four characters, which will act as a kind of group, and return the values for that group in columns. I’m…
-
2
votes1
answer88
viewsDifferent variable value in sub-select
I have the following query: SET @VAR = 'N'; SELECT 'TESTE1','OI',@VAR := 'S' AS T UNION ALL SELECT 'TESTE2','OI',@VAR AS T UNION ALL SELECT * FROM ( SELECT 'TESTE3','OI',@VAR AS T ) AS TAB UNION ALL…
mysqlasked 7 years ago Cleber Griff 668 -
2
votes2
answers585
viewsMysql search data Save to PHP variables
I want to get the value of a query on mysql SELECT lamp_estado, lamp_descricao FROM lampadas ORDER BY lamp_id And write each value found in the search into a variable. I am using this command plus…
-
2
votes3
answers391
viewsInsert multiple mysql checkbox records
are trying to enter in the database information of multiple checkbox at once , for example a news is related to more than one category then and only select the categories and save , however this…
-
2
votes1
answer832
viewsHow to run the same php script via cron without overloading?
What is the best way to run the same php script several times by making random queries for a given column with a limit of 1000 per query of the same mysql table via cron (Cpanel) without generating…
-
2
votes0
answers668
viewsError while updating Mysql.Data
I upgraded Mysql.Data and Mysql.Data.Entity from version 6.9.9 to version 6.10.4 and started getting the error below : Inheritance security rules were breached by the type:…
-
2
votes0
answers31
viewsPHP - determining values in euro and credits
I have a sales website where I use credits for "discounts". What I want to do is if the product is 5.00€ and the user has 100 credits These 100 credits will discount X value at 5.00€. Example,…
-
2
votes0
answers44
viewsSwitching from MYSQL to MYSQLI
PHP Deprecated: mysql_connect(): The mysql Extension is deprecated and will be Removed in the Future: use mysqli or PDO Instead in /resocubatao/public_html/includes/Bancodedados.php on line 6 on my…
-
2
votes2
answers176
viewsSelect a certain amount of data for each status type
Billy Jow here! On my table historical I have a field status that can assume four possible values: 'EVALUATE', 'FAILURE', 'REEVALUATE', 'SUCCESS' I wish to select 20 records from each status where…
-
2
votes2
answers530
viewsHow to make an SQL query with some blank criteria?
I am creating a filter for a database search in a PHP application and obviously I have numerous criteria, but, I have only been able to work with one criterion. Code: select codigo, despesa, data,…
-
2
votes1
answer911
viewsMysql Does Not Connect by getConnection() Netbeans Java
I’ve been trying for a while to get my Mysql database connected by getConnection(). I’ve tried several different ways, to put the name of the bank, I’ve seen several tutorials including tutorials…
-
2
votes1
answer61
viewsPromotion Ecommerce consultation
I’m developing a platform Ecommerce, and I came across a problem to calculate the value of products, applying the discount of promotions in consultation SQL, currently the promotion rules are being…
-
2
votes4
answers4316
viewsHow to import a csv file to Mysql?
I am starting my studies in Mysql. I decided to install Mariadb 10.1.14 in Centos. I want to create a database from a file . csv with about 166 million lines. I looked for tutorials on the internet,…
-
2
votes2
answers81
viewsHow to get the value of one table depending on the maximum value of another?
I have the following code that gives me a table like the picture, but my doubt is how do I only get the name and only the name of the one that has the highest health value that will be gasoline? It…
-
2
votes2
answers785
viewsHow to create a Stored Procedure for two tables
I’m trying to do this Stored Procedure, but it’s giving error. I can do an Insert with proceed? DELIMITER $$ DROP PROCEDURE IF EXISTS `centralrit`.`sp_InterdDetalhe_Encrypt` $$ CREATE PROCEDURE…
mysqlasked 8 years, 4 months ago fabricio_wm 1,090 -
2
votes2
answers229
viewsComparing a subquery with another subquery
I have two tables, table A and table B, each with a column called text. Both tables have equal records to some extent, up to the character '='. What I want to do is a SELECT of all records in table…
-
2
votes1
answer95
viewsHow to remove keywords between { } keys in the Mysql field?
I have a table that contains a field with some values between keys, how do I delete the chaves and the valores that are within them? Example: cod | Movimento | 01 | Prazos {aguardando} | Prazos…
-
2
votes1
answer849
viewsDelete a record from the database when the deadline is passed
How can I automatically delete a record from the MYSQL database when it reaches a deadline? remembering I am using a data_termino attribute of type Date
-
2
votes1
answer480
viewsBLOB column 'about' cannot have a default value (default)
When trying to keep a column as null, mediumText, and add an 'as defined' value, it returns: BLOB column 'about' cannot have a default value (default) Why can’t I? What things imply this? How can I…
-
2
votes1
answer256
viewsAdd value to database
I use Codeigniter, and the situation is as follows: The product has a current stock, and I want to input more items from this stock... how do we add the existing with the new entries? Follows code:…
-
2
votes1
answer91
viewsSlow opening of Jframe with Hibernate
Good morning to all. I have a Swing application that has a Jframe using Hibernate 3 for networked Mysql BD persistence. When I run through Netbeans, it opens very fast. But when I run the jar built…
-
2
votes4
answers118
viewsselect dinamico
good afternoon! I have a table like this: id | valor | nome_campo | item_id (fk) ---------------------------------------------- 1 | 9 | campo_1 | 22 2 | 10 | campo_2 | 21 3 | 2 | campo_2 | 22 4 | 3…
mysqlasked 8 years, 4 months ago Quati_Maldito 107 -
2
votes2
answers115
viewsConverting two Mysql selects to one
I have a little doubt about Mysql. I have the following Mysql query: sq1 = mysqli($conexao,"select * from tabela1"); $tr1 = mysqli_num_rows($sq1); Then I make the famous bow: for…
-
2
votes1
answer579
views -
2
votes1
answer401
viewsSend email to customer to check if there is or not
I made a registration to be entered the Cpf and email, the Cpf I was able to validate straight, to see if it works or not. But when the part comes to know if the email exists...I searched a lot and…
-
2
votes1
answer1170
viewsDuplicate key in mysql
I am in the third quarter of database and we started using the Internet in our database but I came across the error "Error Code: 1022. Can’t write; Duplicate key in table '#sql-aa4_a". Is there a…
mysqlasked 8 years, 3 months ago Lucas Alves 133 -
2
votes0
answers72
viewsShould fields in the order by clause be indexed?
I’m reading a lot about using indexes in Mysql. I noted that it is really necessary to know how to use it at the right time and in the appropriate columns in order to make the queries faster and not…
-
2
votes0
answers99
viewsSelect MYSQL, list row not present in NULL table
I’m making a hotsite with a quiz (questions and answers), with more than 3000 users. The question is in the list of quizzes for each user, I have two tables (simplified to focus on my question):…
-
2
votes3
answers1806
viewsSQL searching records from a Date and Time
I have the following SQL: select * from tb_valores where DATA >= '14/12/17' and HORA >= '16:34:00') I would like to bring all records from that date and time. The problem is that if I have…
-
2
votes1
answer33
viewsUsing a connection for multiple methods in the same class and other methods
Could I have only one connection and use it in several methods? For example: The Prepared statement needs an open connection to run, so I do the getConnection(), and another method also needs, so I…
-
2
votes1
answer26
viewsVariable returning null value
I’m creating a precedent for it to store the food name in the Procedure food variable, follow the code: DELIMITER $$ CREATE PROCEDURE armazena_nome(id INT, OUT alimento VARCHAR(20)) BEGIN SELECT…
-
2
votes1
answer731
viewsPick up and list months between dates of different years
I have the following question. Starting date: 01/10/2017 and end date 01/10/2018. How can I list the months between these dates? For example: October(17), November(17), December(17),…
-
2
votes1
answer223
viewsProblem with Mysql connection in C#
I created a connection class for my application in Xamarin, but every time I try to connect throws this exception: "The type initializer for 'Mysql.Data.Mysqlclient.Replication.Replicationmanager'…
-
2
votes1
answer618
viewsI cannot assign a database value to a php variable
Hello guys I’m beginner in php and I’m having a difficulty have a table of users (id, login, password, level) according to the level of the user should go to a different panel, the login part this…
-
2
votes0
answers179
viewsAuto ID increment relative to another field
I have been looking for something to solve such problem that I have been finding in other systems that I developed, I would like to know a solution for how to make an id auto increment, but an auto…
-
2
votes1
answer1411
viewsSelect with Inner June too slow
I have a problem where select is bringing the right result, but taking too long. Follow select : SELECT c.cod_paciente, p.nome, i.valor, i.quantidade, d.convenio, c.cod_conta FROM caddadosclinico d…
-
2
votes2
answers828
viewsHow to connect a Mysql database with QT on a local network?
Hello, at the moment I am Noob in manipulation of servers with databases. I am using Qt Creator 5.3 to develop my project, and have decided to incorporate a Mysql 5.7 database into it. I am trying…
-
2
votes1
answer405
viewsPass value parameter by clicking on radio input type, with php, jquery and mysql propagating
Hello, good afternoon everyone, guys I’m having a doubt I do not know how to proceed I need to send the value that is inside the value input type radio to a variable jquery remembering that I even…
-
2
votes2
answers78
viewsA single SQL query for a user’s products!
I have the following appointment: SELECT id_produto, produto, (SUM(credito) - SUM(debito)) as producao_total FROM produtos_farm PF INNER JOIN produtos P ON P.id = PF.id_produto WHERE PF.id_usuario =…
mysqlasked 6 years, 10 months ago Guilherme Lirio 470 -
2
votes2
answers19092
viewsHow to make INNER JOIN mysql
How do I make an Inner Join in these tables: Vehicle ve_id ve_name vey_cor mar_id (foreign key) Brand mar_id mar_nome I want to pull in a table ve_name, ve_color and mar_name…
-
2
votes0
answers37
viewsWhat is the advantage of saving whole in the field that I want to save prices?
I was reading about building RESTFUL API with Laravel, and I noticed an interesting flame that I once wondered if the way I always saved "money" in the database. Is there a problem in saving as…
-
2
votes1
answer90
viewsDoubt to bring mysql data
I have the following question. Consider that I have the following sales data: Two former states: São Paulo (Atibaia, São Paulo and Campinas) and Paraná (Londrina, Curitiba, Cascavel). | cidade |…
-
2
votes1
answer1525
viewsIs it possible to search a data in the database without knowing which table it is in?
I have a banco de dados very large and it is impossible to build a SELECT * FROM for each table and locate the data I need. It is a texto especifico ('with as parameter 23') I’ve searched every way…