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
-
1
votes0
answers38
viewsProblems with dynamic php DIV programming
Good afternoon! I am working on a project that involves building a website about a very popular game. This same website will have a "coinflip" This feature consists of a betting system where: The…
-
1
votes1
answer92
viewserror while trying to change a table by adding a new column of type datetime in mysql
ALTER TABLE tb_coletas ADD dia DATETIME NOT NULL generates the following error Incorrect datetime value: '0000-00-00 00:00:00' for column I didn’t understand the error, as far as I know everything…
-
1
votes3
answers1285
viewsReturn checkbox checked PHP
I have this code: <?php $pdo = db_connect(); $sql = "SELECT * FROM cor_fundo"; $query = $pdo->prepare($sql); $query->execute(); $option = ""; $result =…
-
1
votes2
answers863
viewsHow to insert into 3 tables at once? (PHP +Mysql)
I always come here for research but I never had to ask. I now find myself at a crossroads. I need to add data in 3 tables at the same time( books, author and editor), and in book, I have foreign key…
-
1
votes0
answers32
viewsMysql incorrect decimal value in view
I don’t know why the number 9937.77 stored in Mysql as Decimal(12.2) displays 9 million in views 1.00 displays 100 (1.00 is correct) 5.77 displays 577 (5.77 is correct) I tried to DisplayFor(m =>…
-
1
votes1
answer66
viewsWhile to Analyze Select Return
good afternoon! I’m having my first contact with Mysql, before I worked with Oracle, and I came across a problem that on Oracle, I had the following structure: for a in (select id, nome, salario…
-
1
votes1
answer2284
viewsError 1452 mysql: Cannot add or update a Child Row
I created the following tables and populated in 2 (user and type); CREATE: CREATE TABLE utilizador(utilizador_id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,username VARCHAR(100) NOT NULL, password…
-
1
votes1
answer378
viewsDatabase does not work
I never made a form, so forgive me if I’m absurdly wrong. Here is the bank with the table: CREATE DATABASE db_formacao; USE db_formacao; CREATE TABLE `db_formacao`.`formacoes` ( `ID` INT( 5 ) NOT…
-
1
votes1
answer34
viewsStop running a particular php snippet
I am in need of stopping the functioning of a particular chunk of code. Exit, how die, stops the whole foreach code block. I just need it to stop inside the if, but keep running the foreach, then go…
-
1
votes0
answers27
viewsProblem with Ajax does not support BLOB ?
I want to bring a file with ajax that is in my database only that the file becomes too big for ajax. It has how to modify the ajax for it brings the file or there is another way. MY AJAX CODE…
-
1
votes2
answers246
viewsHow to read Mysql data with Python?
I’m running a registration and product sales system. I need to have access to registered units to check how many units still remain to be sold (with each sale I’m decreasing the remaining units). I…
-
1
votes0
answers47
viewsNot returning the value when using the QT C++ query
When I use the following query to return the database data code, the following message appears: Qsqlquery::value: not positioned on a Valid record Use the same model code and the same is working,…
-
1
votes1
answer209
viewsCategory modeling logic in an e-commerce
I am with a project to create an e-commerce, in which my doubt refers to the modeling of tables: Category(ROOT)>sub-categories>sub-categories of sub-category. As should be these tables, and a…
-
1
votes0
answers59
viewsModeling relationship tables
Good evening, everyone! I’d like to ask you a question. Is it possible for multiple tables to reference a single foreign key from a table? Follow the example of the modeling where the table…
-
1
votes1
answer33
viewsEfficiency in querys with different schemas [Mysql]
Is there any loss of efficiency making querys in different schemas? For example query 1 is more efficient than query 2? 1: SELECT * FROM SC1.T1 INNER JOIN SC1.T2 ON ... 2: SELECT * FROM SC1.T1 INNER…
-
1
votes0
answers17
viewsFind tables containing columns with a prefix
Hello, Is there any way to know in a mysql database which tables have columns that contain the word "commissario" ?
-
1
votes1
answer2316
viewsCRUD Mysql with Nodejs: how to use Pool correctly?
I created two file to test the use of Mysql with Nodejs as follows below, but I’m finding the answer a little slow and I think I’m doing something wrong: DOUBTS: 1) Is this the most correct way to…
-
1
votes1
answer3707
viewsWhat is the best way to generate random code that does not repeat in the database?
I need to generate a random code of 5 characters, can not have repetitions. I managed to do as follows: function testarcode($code){ global $link; if ($code == ""){ return false; } $comando = "SELECT…
-
1
votes2
answers37
viewsUpdate table according to column quantity
The registration table was not modeled correctly, but I need to do an UPDATE by SQL to perform this import, follow example: Note that the children of Bomi Bulsara, need to stay in [nameDoDependent1]…
-
1
votes2
answers73
viewsNon-functional PHP Mysql database
I have a PHP form with a Mysql database generated by phpMyAdmin, but the database does not receive the information entered in the form. Follow the form code: <!-- content --> <div…
-
1
votes1
answer33
viewsHow to know which supplier provides more products by returning the supplier’s name?
First of all, this is the code that I’m trying to sum up the products of each lab and display select l.razaosocial, sum(p.quantidade) from produto p inner join laboratorio l on p.fk_laboratorio_id =…
mysqlasked 3 years, 11 months ago Junior Rinco 11 -
1
votes1
answer23
viewsLimit using group_contact in Mysql 5
Good morning guys, I’m having a question: I have the following SQL example: group_concat( DISTINCT `mvu5877_anuncios_photos`.`image` ORDER BY `mvu5877_anuncios_photos`.`order` ASC SEPARATOR ',' ) AS…
-
1
votes1
answer101
viewsPHP and Mysql Login Validation Problem
I’m a beginner in PHP and I have a problem validating a login with access level. Code Index.php <?php //Inicializado primeira a sessão para posteriormente recuperar valores das variáveis globais.…
-
1
votes0
answers316
viewsHelp to optimize an index in mysql
I own a site of relationships and for years I try to optimize this query. Almost every day the site hangs because of it. Structure of the user table CREATE TABLE `usuarios` ( `id` bigint(20) NOT…
-
1
votes1
answer224
viewsProblems with UTF-8 resale Locaweb
I have a project hosted on Ocaweb at resale, php/html are coded correctly in utf-8, because what is html or echo is returning perfectly, but information from the database is not returned correctly…
-
1
votes1
answer96
viewsMysql - Select in two databases comparing columns
I’m trying to make a select in two different databases by comparing the matrix column. select A.matricula, B.matricula from banco1.escolas A JOIN banco2.escola B ... The bank1 is the most complete.…
-
1
votes1
answer19
viewsRelate Products to duplicated EANS in a relation where 1 product has n EANS. sql language
How could I make the comparison with the EAN of another product without comparing it to the same product... in sql? CREATE TABLE `produto`( `idproduto` INT NOT NULL AUTO_INCREMENT, `nome`…
-
1
votes0
answers14
viewsQuery error using Entity Framework with Mysql and VB.net
I have developed a method to do with simple query provided by the Changed textbox event and the query returns the right values the first time. When I change the value of the component and the query…
-
1
votes1
answer28
viewsQuery to insert into a Sqlserver table
Sqlserver, given a table with the fields: id (int), name (nvarchar) and birth (smallDateTime) How can I write a query to insert into this table and then query this data from all table records. Id:…
-
1
votes0
answers30
viewsAccelerate selection by varchar - Mariadb 10
I have an Innodb table with 105 columns and about 300,000 rows. There is a varchar(24) where the username is stored. When I execute queries like these: SELECT * FROM users WHERE BINARY…
-
1
votes1
answer41
viewsMYSQL Operation subtraction fields from the same table with different WHERE?
Hello There is a table with TYPE field and Value, Operation value field output (TYPE = REVENUE) - (TYPE = EXPENSE) in MYSQL in a Select…
-
1
votes1
answer38
viewsRelating 3 Standard Tables
Hello. I have a small model attached here. My task is from users, to get the records of Orders that have some record in the payment with the id of that order and the id of that user. Basically, an…
-
1
votes1
answer66
viewsHow to join the select of these 3 tables that have no connection at all?
The image below shows 3 tables, united by Excel. The first is called customer, the second representative and the third is called channel. But I would like to join them in a single select in sql, and…
-
1
votes1
answer31
viewsHow to restrict minutes in a time interval using Mysql
I have a table that contains day, month, year, hour, minute and second. I need to return only the time between 8 and 11 o'clock, but do not want me to return from the 11 o'clock forward Example:…
mysqlasked 3 years, 9 months ago Leandro Kojima 429 -
1
votes1
answer108
viewsSelect hard with date
I’m unable to do the following:how to return the time in minutes or hours that a certain WORTH occurred in the table below? Example: how long did the WORTH greater than "23" on 01/05/2017? and if…
-
1
votes0
answers32
viewsProblem with SELECT and bindParam()
When adding bindParam() after preparing the query, you are giving an error in execute, which says the following: Fatal error: Uncaught Error: Cannot pass Parameter 2 by Reference in C: xampp htdocs…
-
1
votes1
answer373
viewsRun 2 `SUM` on a `UPDATE`
Well I’m trying to do the SUM of two different fields and give a UPDATE in another table. I’m doing like this: UPDATE pedidos a SET custo = ( SELECT case when SUM((b.qtd - b.qtd_devolucao) *…
mysqlasked 7 years, 4 months ago Hugo Borges 5,294 -
1
votes3
answers78
viewsReturn Most recent date per Column?
I have this table in `Mariadb [accounts]> SELECT * FROM mercado WHERE nome_mercado LIKE 'extra'; +----+--------------+-------------+-----------+-----------+-------+ | id | nome_mercado |…
-
1
votes0
answers5099
viewsMysql - Types for CPF, RG and CNPJ
Fala galera. I am at the beginning of Mysql and I have a question about field types in RG, CPF, CNPJ. I did some research but I can only find answers from years ago, so I’d need something more…
-
1
votes0
answers90
viewsAsynchronous nature of nodejs, loop for com querie mysql
Inside an upload route in the nodejs I have it: router.post('/uploads',function(req,res){ //Omitido algumas instruções para melhorar o entendimento. InsereMidia = function(midia){…
-
1
votes1
answer1131
viewsProblems listing data from related tables in Laravel 5.3?
I’m working with php, Laravel 5.3 and myql. Having created everything (Migration, model,controller, View, relationship), is giving me the following error: Errorexception in…
-
1
votes1
answer367
viewsHow to save a foreign key in Laravel 5.3?
I am having trouble saving the foreign key in the database. I am working PHP, Laravel 5.3 and MySQL, below goes the code: Controller Product namespace App\Http\Controllers; use…
-
1
votes1
answer270
viewsIs it possible to group a range of values?
I made the following consultation: `select t.net, t.hora, t.`data`, t.`local` from domingos t join( select net, updated, count(*) from domingos where `data` = '07/05/2017' group by updated, net…
-
1
votes2
answers63
viewsSQL query to identify available hourly providers
I have a table for service providers that informs the time they are not available. id_prestador | id_pedido | hora_entrada | hora_saida 1 | abc1 | 2017-08-10 10:00:00 | 2017-08-10 14:00:00 2 | xpto2…
-
1
votes0
answers9
viewsPermission to Joker Base
I need to grant access to a particular user to all databases that start with abc (abc1, abc2, abcTeste, etc...), but new databases can be created and did not want to have to do this manually. It…
mysqlasked 3 years, 7 months ago NilsonUehara 3,105 -
1
votes1
answer122
viewsError adding" 0 " to a tinyint(1) field in the database
In my database in the users table, I have a field called status, whose type is tinyint(1). If the status is "0" the user is enabled (can access the site), if the status is "1", disabled. But when…
-
1
votes1
answer253
viewsWhat is the best way to store a multi-valued item
When issuing a NF-e it is possible to insert up to 990 products/items per document . Each product has several attributes. What would be the best way to store and link each product, and its…
mysqlasked 7 years, 3 months ago lucasbento 856 -
1
votes1
answer20
viewsMysql KURDATE with month
In Mysql if I want to search only dates that are in the current year, I do so: WHERE dia = year(CURDATE()) But I’ve been trying to find dates that are in the same month as the current one: WHERE dia…
mysqlasked 3 years, 6 months ago caiocafardo 1,897 -
1
votes2
answers150
viewsQuery with JOIN in 3 tables
I have the following tables: livroautor id idautor idlivro ------ ------- --------- 1 1 (NULL) 2 2 2 3 3 3 4 4 4 5 5 5 6 6 (NULL) 7 7 5 8 8 2 9 9 2 10 10 (NULL) book id titulo resumo isbn paginas…
-
1
votes2
answers1567
viewsError: "Can’t connect to local Mysql server through socket"
I just created a domain on Ocaweb and created a website and database. When accessing the site, it loads part of the page, but I have the following error: SQLSTATE[HY000] [2002] Can’t connect to…