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
answer111
viewsUsing sql_cache in Mysql query
When I learned Mysql, I was recommended to use the expression sql_cache after the SELECT, something like that: "SELECT sql_cache * FROM tabela..." Since then I started to use this in my codes, but…
-
3
votes0
answers24
viewsCache Mysql Web Base
Good morning, I have an application developed in Delphi 2010 with Mysql, the base is server on the Web, a few days ago they migrated this server and updated the version of Mysql, since then I have…
-
3
votes2
answers2141
viewsTaking keys from an array
am ultilizando PDO for mysql query,and I would like to grab the keys of an array, tried several methods and failed, e.g.:$arr_cars['id'] an error has occurred class Cars extends DB{ static function…
-
3
votes2
answers470
viewsProblems opening connection to JSF and JPA
There’s something wrong with mine persistence.xml? I can’t open the connection. My Bean is like this: import java.util.List; import javax.faces.bean.ManagedBean; import…
-
3
votes3
answers758
viewsHow do I know if a record has been added to the database?
Hello, I am working on a warning system, when a data larger than normal is registered in the database an alert has to appear on the page where the user is browsing. The problem is that I don’t know…
-
3
votes2
answers8186
viewsMysql using variables in select
I already searched in some tutorials but I do not find a specification of how to declare the variable in select by Mysql, follows what I am trying to do. DECLARE @idPedido INT; DECLARE @idCombo INT;…
-
3
votes1
answer60
viewsWhy in PHP and Mysql ! is it converted to 0 in some cases?
The question is the title by itself, in PHP we can do: var_dump((int) "!"); And receive int(0). And in Mysql we can do: SELECT campo_int FROM tabela WHERE campo_int = "!" What if this 'campo_int'…
-
3
votes3
answers1115
viewsFiltar Birthday of the day
I’m trying to filter out the birthday kids for the day, but I’m not making it. I can only put exactly the date of birth; to make it right I needed to filter the dates of birth of the same day and…
mysqlasked 7 years ago user31040 -
3
votes2
answers100
viewsUPDATE giving error but updates database
I’m creating a page of login where I need to save to the Mysql database the date and time when the login user. In the database I have a table like this:…
-
3
votes1
answer8239
viewsHow to display an image stored in the mysql BLOB field in a php page?
I have an image saved in my mysql blob encoded in base 64. However, I cannot display the image in a simple php page. In reality what I want is for the user to click on a product category, be…
-
3
votes2
answers542
viewsArduino + Module SIM900 + PHP + Mysql - POST method problem
Good afternoon to all!, I am developing a project that consists in the communication of a module SIM900 with an application, and doing the interaction of the two will be a server WEB + Database. The…
-
3
votes2
answers100
viewsDelete sectors and their descendants - PHP
I have the following structure table: CREATE TABLE IF NOT EXISTS `setores` ( `set_cod` int(10) NOT NULL AUTO_INCREMENT, `set_base` int(10) NOT NULL, `set_setor` varchar(50) NOT NULL, `set_data`…
-
3
votes3
answers93
viewsError in declarations with Array
Guys, I have a mistake that I can’t find the solution to. I have two accommodations on the same site Hostgator, in a hosting my application is all right and working. But I had to migrate the…
-
3
votes2
answers381
viewsSELECT issues with postgresql
I am making a migration from mysql to postgres, but there is an error happening, not much experience with postgres: SELECT SELECT m.* , (SELECT c.id FROM corridas c WHERE c.motoqueiro = m.id AND…
-
3
votes1
answer53
views(SQL) Each property has multiple images and a cover image
Suppose I have a Real Estate table where a property can have multiple images. I have therefore another table, Images, with the url. I also have an intermediate table that makes the relationship N:N…
-
3
votes1
answer270
viewsSQL does not return all results
I have 2 tables in Mysql, a call municipalities and another call municipios_ibge both have a column called municipality that guards the municipality of each city in Brazil. I have to do the…
-
3
votes2
answers323
viewsHow to sort by average and quantity (weight)?
I have this query on Mysql: SELECT dealers.id, COALESCE (AVG(rating), 0) AS media, COALESCE (COUNT(dealer_ratings.id), 0) AS qtd_avaliacoes FROM `dealers` LEFT JOIN `dealer_ratings` ON…
mysqlasked 8 years, 3 months ago Diego Souza 16,524 -
3
votes2
answers1848
viewsAjax returning [Object Object]
HTML index.html <!DOCTYPE html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script…
-
3
votes1
answer454
viewsHow to cancel an INSERT event on Trigger?
Hello, I created a Rigger that every time the user performs a sale is made the debit in the quantity of items, but if I do not take care the quantity can be negative because the user can sell more…
-
3
votes1
answer109
viewsMigrating from Firebird to Mysql
I’m migrating a project in Firebird to Mysql, I’m with a difficulty in converting a trial, would like any hint in how to proceed, below goes the Trial in FIREBIRD. CREATE PROCEDURE…
-
3
votes2
answers2217
viewsRadio de Preenchimento Obrigatório html
How do I place this mandatory field: <p><h5><strong>Estado</strong></h5> <p> <input type="radio" name="Estado"…
-
3
votes1
answer100
viewsMysql and PHP grouping
I need to group a query with a detail, the grouping should be done only when the information is repeated in sequence, for example: id nome 1 lucas 2 lucas 3 marcos 4 lucas 5 marcos In the example…
-
3
votes2
answers1940
viewsAdd a number in front of all records
A question arose when mounting an sql statement. I have several records in a table called db_contrato, I wanted to add the number 0 in front of all records, for now I defined the contract column as…
-
3
votes1
answer539
viewsmysql error with foreign key
I am creating a template but I am running into an error when I am going to create foreign MYSQL keys from a "Cannot add Foreign key Constraint" error. follows my sql. use fatec; create table aluno(…
-
3
votes2
answers87
viewsHow to pass a different value in an HTML form?
I am creating an HTML date filter so that the SQL query can return a specific value to me. I’m just trying to make it difficult to pass on this information because the form option needs to appear…
-
3
votes1
answer621
viewsCreating tables with PHP
Expensive; I have a problem and need a little help. I have an html page that contains some radio Buttons. When clicking on a radio button and then on the send button, it redirects to a PHP page that…
-
3
votes1
answer340
viewsImport Mysql data to Excel
To want to import data from Mysql to excel using Python, when I try to make it from an error of tuple. Someone with more experience can help me? I followed the code and the error: # coding=utf-8…
-
3
votes1
answer653
viewsSelect with two tables and one condition in each with MYSQL
I have two unrelated tables. One is of reports, where it contains names of teachers and their respective subject, the other table is called login, where it contains credentials of each teacher,…
-
3
votes2
answers47
viewsCatch date previous to year 2000 Mysql
I need to select all employees with employment date prior to the year 2000. How can I put this condition in the clause Where? SELECT nome_funcionario FROM funcionario WHERE data_contratacao...…
-
3
votes1
answer536
viewsMulti connections Mysql Codeigniter
In my.php database I created two connections: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); $active_group = 'default'; $active_record = TRUE;…
-
3
votes3
answers161
viewsHow to perform a select by multiple fk?
I have a question about one (or more) select. I have the following bank created and I need to do a search for a certain recipe based on one (or more, and here’s the problem) ingredients. How can I…
-
3
votes4
answers765
viewsNumeric sequence loop in PHP
Good morning I have the result in MYSQL 01 03 04 06 11 I need a solution that fills with 2 zeros where the numerical sequence loses until the number 12. Example: 01 00 03 04 00 06 00 00 00 00 11 00…
-
3
votes1
answer118
viewsPrimary key return of an INSERT
I have the tabela_x, where the first field (campo1) is primary key and autoincrement. I make a simple INSERT: $ins = " INSERT INTO tabela_x (`campo2`,`campo3`,`campo4`) VALUES ($c2, $c3, $c4) ";…
-
3
votes1
answer1124
viewsConcatenate PHP date to insert into Mysql
Good morning, my doubt consists in the method of concatenation and creation of a Datetime to insert in a database. Having the variables: $dia = '2018-04-11'; $hora = '09:36'; The desired format is:…
-
3
votes1
answer53
viewsSum all results of a table and separate by day/month
I have a table where I would like to add all the results and separate them by Day/Month. 01/Abril = 3 Resultados; 03/Abril = 5 Resultados; 02/Maio = 1 Resultado; The table I’m using. **ID --…
-
3
votes1
answer1060
viewsSelect Float Mysql
In a field mysql is stored 104.13 format Float; With this select, I can see the record: SELECT * FROM parcelas WHERE valor like '104%'; But with this select does not appear: SELECT * FROM parcelas…
mysqlasked 6 years, 7 months ago Pedro Augusto 2,392 -
3
votes1
answer103
viewsMysql is duplicating search result
I’m having difficulties to assemble a query. I have a database more or less in this structure. Table1 Table2 Table3 Table4 I need to mount a query that picks the results in the 4 tables, for this I…
mysqlasked 8 years ago Bruno Folle 729 -
3
votes3
answers996
views -
3
votes1
answer923
viewsHow to Create Event in MYSQL?
I’m learning now about create Event in mysql I’m creating a simple test Event, but it’s not working, it appears in Events, but the table is not updated: CREATE EVENT teste ON SCHEDULE AT…
-
3
votes1
answer442
viewsSearch in different tables knowing what the result came from
I’m trying to find a term in 4 different tables in Mysql, using like, but I need to rescue the id of each and identify from which table came to make the listing and direct with link. This is a…
-
3
votes1
answer347
viewsForeach in XML with ids and store in a variable to insert data in a given table
Good afternoon, Next, I have a system that already have the registered ids in a table, ( of cars , are opicional of cars) and in the other table where it is registered the cars is called these IDS…
-
3
votes1
answer697
views -
3
votes2
answers16210
viewsMysql returning "Group By" error after upgrade to version 5.7
I had a certain MYSQL query that was working correctly. This is the consultation: SELECT *, count(*) as count FROM `post_hashtags` WHERE `created_at` BETWEEN ? AND ? AND (SELECT count(*) AS…
mysqlasked 8 years ago Wallace Maxters 102,340 -
3
votes3
answers203
viewsHow to show a column, but if null show another sql
How to show a column, but if null show another sql as Example a table with the name tasks. | id | nome | nome resumido | +-----+----------+----------------+ | 1 | nome 1 | 1 | | 2 | nome 2 | 2 | | 3…
-
3
votes2
answers848
viewsQuery filter php mysql
BD structure Companies ----------------------------------- | uid | nome | endereco | | 1 | empresa01 | endereço01 | | 2 | empresa02 | endereço02 | ----------------------------------- Products…
-
3
votes1
answer337
viewsHow to Call Values from Another Class
I am creating a vehicle control, and in it I have a register of Fuel that has description and value, and another record of Supplies. My supply record has a autoComplete of Fuel. The problem starts…
-
3
votes1
answer79
viewsHow do I make the student registration number of the logged in account stick in the published table?
I am doing a rating project of a "college", I have the publication class and in it the method: public String NovaPublicacao(Connection conn){ String sqlInserir = "INSERT INTO Publicacao (Assunto,…
-
3
votes1
answer103
viewsDelete select value by comparing to another table
Good morning, I am developing a scheduling site, however, I am having a huge difficulty trying to display only the schedules that are available. Explaining: There is the table Agendamento´, onde…
-
3
votes1
answer49
views -
3
votes2
answers7609
viewsSQLSTATE[23000]: Integrity Constraint Violation: 1062 Duplicate entry '0' for key 'PRIMARY'
When trying to perform an INSERT in my table with PDO, I get the following error: SQLSTATE[23000]: Integrity Constraint Violation: 1062 Duplicate entry '0' for key 'PRIMARY' I’ve researched enough…