Well, I have a table and in it a field called cargo and its value can be repeated, for example, the position teacher. In my HTML I'm setting a <select> when I retrieve the value of this field, but due to the value of i...
Is it possible to program the database so that there is a default record if there is no other one in the table? making the table impossible to be empty.
So if you have other records, it ignores the default, if you do not have any, use the def...
I have a NOTICIA table and I have a column ATIVO
News can be active or not if it is BOOLEAN (0 or 1) if it is ENUM .
What would be best to use BOOLEAN or ENUM ?
I need to create a customer registry, where certain part of the user's registration has several checkboxes that would use to store if the client has such documents, for example:
[] RG
[X] CPF
[] Certidão de nascimento
and a button so you c...
In MYSQL, I know I can return a difference between dates using the DATE_DIFF function.
example:
SELECT * FROM table WHERE DATEDIFF(NOW(), created) <= ?
However, I need to return the difference in day converted to hours in this...
I would like to know how to create a database in MySQL using SQL commands, which I can run in MySQL Workbench, phpMyAdmin or any other software.
What SQL commands do I need to create a database and its tables?
I have this SQL to create group with sales whenever I had two sales of the same client in TYPE = 1 and another in TYPE = 2, both completed in the current month.
But now, what I need is to filter sales with TYPE = 2 in the current month that t...
I have a "cpf" field in my table. This field can be of type INT or VARCHAR, in case I need to change it to solve my problem. In it there are only numerical values, without the dashes and without hyphen (.-).
In PHP, when I'm going to call dat...
I'm running the following php code:
require_once "config.php";
$pagina = $_POST['pagina'];
$conteudo = $_POST['edit'];
//mysql_query("DELETE FROM $pagina WHERE 1") or die("alguma coisa deu errado".mysql_error());
//mysql_query("INSERT INTO $pa...