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
answer66
viewsSelection with LEFT JOIN
I’m studying sql and I don’t know if this is possible. But I have the following tables: Table contatos ______________________ id | nome | sobrenome | ______________________ That contains only one…
-
2
votes1
answer2172
viewsConvert everything to mysql in hours or minutes
I have a table with the two fields Start and End of Tipo de dados Time. Example of records I have in the table: 09:30:00 10:00:00 10:00:00 11:00:00 11:00:00 12:00:00 As I show, I have full hours and…
-
2
votes0
answers88
viewsIt’s not overwriting the value
I’m wanting the final calculation information to overwrite what is already saved in the Stock table, as it would be to do this, because Save, is overwriting correctly, I tried to apply in the…
-
2
votes1
answer84
viewsList an item accompaniments from a mysql sale
Table 1 - sale id_venda Table 2 - item_request id | id_venda | id_pastel Table 3 - item_accompaniment id | id_item_request | id_follow-up Example: I make a sale with two items and their…
mysqlasked 6 years, 7 months ago Bruno Xavier 21 -
2
votes3
answers134
viewsView products from multiple categories
This is my first post, I’ve been trying to solve a problem for some time now, but without success. I have the CATEGORIES table and the PRODUCTS table I need to display the following ways: CATEGORY 1…
-
2
votes3
answers5033
viewsUse UTF-8 or Latin1?
I started a new project and when creating the database (Mysql), I didn’t think twice, I put a CHARSET=utf8. The application will support Portuguese and English and users should use only these two…
-
2
votes1
answer864
viewsUsing data from one select within another?
Two tables tbl_orcamento and tbl_itens the budget table has a column with the following status. 1 = orcamento aprovado 2 = ordem de compra emitida 3 = ordem de compra aprovada To tbl_itens has some…
-
2
votes2
answers1469
viewsHow to automatically add two columns from two different tables and perform Insert in another table in Mysql?
I am starting work with database and would like to perform an intelligent action in the bank. I have two tables that store information from different sensors, each with its respective columns. I…
-
2
votes1
answer70
viewsRegistration in php
Hello, all good ? , I have a problem in performing data insertion in a MYSQL database. When I type a password in my form, for example: metas123, or any other password, it stores the value 0, instead…
-
2
votes2
answers367
viewsHow do I put a select inside the while?
Sublime text, Mysql Workbench and Xampp usage. I made a Join Inner in select below, in a table called Organizations.Copia. In this table there is a field called "id" and I need it to appear in this…
-
2
votes1
answer54
viewsI cannot list a table in php
I cannot list a simple table in php... I don’t see what’s wrong with the code, when I run this php code just shows me a blank page... What I’m doing wrong? <html> <head>…
-
2
votes2
answers210
viewsCross two tables and link the line from one to the other, forming a third
Good afternoon, fellow programmers. I came across the following problem: I have two tables, one with applicants, and the other with vacancies. I need a query that crosses the two tables, and takes…
-
2
votes1
answer207
viewsCheck current date automatically
I’m developing a system in PHP where: I make available an entry contest page for the staff, but this page has an end time, example: The page will be available from today 08/05/18 :17:11 and will…
-
2
votes1
answer140
viewsLimit the number of results of a real-time UNION sub-query for performance improvement
I need to search many values that need two query’s with different conditions. To do this I use one UNION, but I need to set a limit of results. Today this is working with a limit and offset as shown…
-
2
votes1
answer1085
viewsInsert into related tables
Eai personal, to create an SQL for Insert in related tables, are the following tables: tb_Customer(id_Customer INTEGER [PK], nm_Customer VARCHAR, cpf_cnpj NUMERIC) dm_address_type(cd_address_type…
-
2
votes1
answer201
viewsError while deleting data in Mysql by Java
In the database I have three tables, where one of them keeps the foreign keys. Error made: Error: com.mysql.jdbc.exceptions.jdbc4.Mysqlintegrityconstraintviolationexception: Cannot delete or update…
-
2
votes2
answers1148
viewsBlock user access with foreign IP’s
It is possible to restrict access to a particular website or Web system, so that only IP’s in Brazil can access it? I have a mini-system in PHP, and to further increase its security, I would like to…
-
2
votes1
answer967
viewsNotice: Undefined offset searching inside array com for
Hello! My code is a schedule and works as follows, there is an array with some times inside: $horarios = ["08:00", "09:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00"]; I…
-
2
votes1
answer825
viewsCall foreach result Controller checkbox and show in view
I need to recover a method in the controller and display in the view, Controller namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\Categoria; use App\Models\Sessoes; class…
-
2
votes1
answer7523
views(Mysql) Insert or Update in the database
I need to perform one Insert in the database, if there is no Cpf of a person. if there is it has to do a Update. But all this through a single script on Mysql. I illustrated the example below as I…
-
2
votes1
answer65
viewsInsert array from ajax into mysql database
I have this ajax that shows the items chosen in "checkbox" form. $(document).ready(function(){ $('#submit').click(function(){ var languages = []; $('.get_value').each(function(){…
-
2
votes0
answers143
viewsComposite key in Laravel migrate
I would like to create a double primary key with an auto increment field "id" and the "term", but it gives error and I do not know the correct way to do, if anyone can help me, I would appreciate it…
-
2
votes1
answer261
viewsPull data from a table for inputs on the same page
I need help to pull the values that are inside a table. I made a code using table with $sql = "select * from equipamentos"; to pull the data I implemented in the Mysql Database, but specifically in…
-
2
votes3
answers315
viewsHow to mount this SQL to bring months that are not in the list?
The SQL below brings the number of entries made month by month, until then blz. I needed to show the last 6 months, even if it was zero, but in this select it would only bring when there are…
-
2
votes1
answer72
views -
2
votes2
answers6988
viewsQuery with SELECT and SUB SELECT in Mysql
I have a question about SQL, never worked with sub selects and ended up getting lost with it. My SQL: SELECT CLI.id, CLI.nome, CLI.senha, CLI.email, CLI.cpf, CLI.celular, CLI.data_nasc, CLI.genero,…
-
2
votes1
answer2032
viewsDelete in 2 tables at the same time in a single query
I have the following query: DELETE FROM emails,emailsacompanhamento USING emails,emailsacompanhamento WHERE emails.idEmail = emailsacompanhamento.idEmail AND emails.idEmail = ".$idEmail That makes a…
-
2
votes3
answers243
viewsSearch 3 unrelated Mysql tables
In one system, I have 03 types of internal search: And I would like to search in 03 unrelated tables: Tabela1, table2 and Tabela3 For that, I tried the commands below: SELECT * FROM `tabela1` WHERE…
mysqlasked 6 years, 6 months ago user24136 -
2
votes1
answer57
viewsSessions with PHP
I made a session code in PHP for Login and is not working, do this error ERR_TOO_MANY_REDIRECTS Below follows the codes made. <?php require_once "functions_prototipo.php"; //require_once…
-
2
votes1
answer58
viewsJSON for PHP + MYSQL
My client sent me this JSON so that I loop and record the data in Mysql. Only I’m not getting it because it’s different than what I usually do; Someone can give me some hint and what is the…
-
2
votes4
answers209
views -
2
votes0
answers66
viewsTips to optimize Select in SQL. Does the conditional order in Where matter?
Do you have any tips for optimizing Select in sql? If I search a table with over 500,000 or 1 million records, is there any way to optimize my search so that it doesn’t spend too much server…
-
2
votes1
answer287
viewsrelate two tables listing only last php record
I have a jig table as follows: | materia | provaID | matricula | questao | resposta | matematica 303 211834 quest1 A matematica 303 211834 quest2 C matematica 303 211834 quest3 B matematica 303…
-
2
votes1
answer210
viewsError Converting Image to String to Save in Database
I’m trying to save an image in my form at the bank, but I’m having difficulties in solving the error: Field error in object 'usuario' on field 'foto': rejected value…
-
2
votes0
answers175
viewsUpdate within a mysql function
I have to do a process to perform an update on a given table field. I created a function in mysql. But within this function would need to perform an update, but the non-accepted function would have…
-
2
votes1
answer702
viewsPass two variables in the javascript url
I have a website that has 5 different languages and when choosing a language the page text changes! For this I made a function: <script type="text/javascript"> function submitForm() { var…
-
2
votes1
answer368
viewsChange pie colors Chart php
Good afternoon! I’m creating a circular graph, the data I search from the database. However I do not know how to change the colors of the circular graphic sectors, to make it clearer I will show…
-
2
votes2
answers50
viewsOrganizing the response array
How to organize the index of the 2nd dimension array? Seeking $stmt = getConn()->query("SELECT hash,id,quantidade FROM pergaminhos"); $resp =…
-
2
votes1
answer162
viewsChange more than one value in the same column with an UPDATE
I have the following doubt.. I have the example table - reply in the following format *------------*--------------* |resposta_id | INT | |pergunta_id | INT | |resposta | VARCHAR(45) |…
-
2
votes1
answer101
viewsRun addslashes function on all Insert fields
I am using the PHP code below to make an Insert in the Mysql database: $sql = "INSERT INTO acolhidos ( situacao, nome, dataNasc, nacionalidade, naturalidade, cidadeNasc, cpf, ... updateLogin )…
-
2
votes3
answers750
viewsSpace occupied between different types of integers
By the table of official Mysql documentation, and a question here at Sopt, I had a question. Considering the table: Type Storage(Bytes) MinimumValueSigned MinimumValueUnsigned MaximumValueSigned…
-
2
votes1
answer1797
viewsConvert Mysql database from latin1 to utf8
I have a Mysql database that is currently set to latin1 charset. When I select in a table, for example: SELECT nome FROM acolhidos Accented characters appear this way: ALESSANDRO ROGÉRIO MOTA DA…
-
2
votes2
answers131
viewsCan anyone tell me what is causing this error
the email field in the database is Unique <?php require_once("conexao.php"); $nome = $_REQUEST['nome']; $email =$_REQUEST['email']; $telefone = $_REQUEST['telefone']; try{ $conexao = new…
-
2
votes2
answers47
viewsProblem with SQL relational logic
Considering this scheme CREATE TABLE bra_ocorrencias ( estado varchar2(2), genero varchar2(1), ano number, nome varchar2(30), num_ocorrencia number ); I need to make a query that returns me the most…
-
2
votes1
answer40
viewsLooking for similar items when using an intermediation table?
Following some advice to optimize queries in Mysql, I decided to split a list of items into 3 tables: Table anime: +----------------+-------------+ | id | titulo | +----------------+-------------+ |…
-
2
votes1
answer67
viewsWhat is the best way to update multiple tables using a Trigger?
I have a Trigger for After Insert notes After delete notes After update notes And I need to update several tables like, sales, sales_seller. I tested using a cursor for each table, at first it…
-
2
votes1
answer1137
viewsHow do auto increment in Mysql without declaring columns in INSERT?
I noticed that when I have a column with auto_increment, I have to declare the columns on INSERT. For example, I created this test table: create table teste( id int auto_increment, nome varchar(100)…
-
2
votes1
answer410
viewsNode.JS and Express Insert with problem
I am new as Node.JS Express programmer with Mysql, I created the implementation to save, but he create the registry with null in the table, see how I performed the test in Postman; This is my…
-
2
votes2
answers269
viewsUpdate tables using Trigger from a main table
I have the following structure: A main table X, where the "header" of the sale is stored. A Y table, where the sale items are stored. A Z table, where some sales data will be saved, from the…
-
2
votes1
answer202
viewsHelp with GROUP_CONCAT (Mysql)
I’d like to use a grupo_concat for filename and answer but not to repeat the values of filename and answer Follows sqlfiddle: http://sqlfiddle.com/#! 9/f32d78/1/0 It is a question that has 2 images…