Most voted "database" questions
A database (its abbreviation is BD, DB, database) is an organized collection of data typically used to model certain situations. Use this tag if you have questions about designing a database. If this is a specific database management system, like Mysql, for example, use this tag instead.
Learn more…3,414 questions
Sort by count of
-
0
votes1
answer27
viewsInserting Data Conditionally in MYSQL
I have a table: conluna1, column2, column3.. The first two columns have integer data, 0 and 1, while the third column is without even a record. I would like to fill this column according to one…
-
0
votes1
answer265
viewsCompare two totals using LEFT JOIN in Mysql
I have two tables: Venda and ProdutosVenda, where the table Venda has a field named 'Id_key' and the ProdutosVenda, that will store the products of this sale, has a field called 'Id_referencia',…
-
0
votes1
answer71
viewslimit users in the database
I searched and did not find how to limit users in a DB... I am making an application in C# using 'sql server' and I would like to know how to make the userDB has a maximum of 5 users, when trying to…
-
0
votes1
answer35
viewsHow to use database information from another application?
I would like to know the procedures for developing a system using information from a third-party database. Explaining: in my work we use a desktop system (SIABI) for managing processes such as book…
-
0
votes4
answers534
viewsHelp with distinct
I have the following sql query: select nome, data, situacao from cadastro The result is like this: MARIA 01/01/2018 0 MARIA 15/01/2018 1 GISELE 15/01/2018 0 CICERA 08/01/2018 1 ANTONIA 20/01/2018 0…
-
0
votes1
answer131
viewsUpdate mysql problem
I have a function that performs an update: function alterarConta(){ $dataemissao = $_POST['dataemissao']; $id = $_POST['id']; $select_fornecedores = $_POST['select_fornecedores']; $valor =…
-
0
votes1
answer34
viewsDoubt regarding the modeling
Good evening, I have to make a database for a simple online sales store, but I am in a dilemma of which tables to create and I would like your opinion. In case, I created the tables: Client Products…
databaseasked 5 years, 7 months ago spider tek 57 -
0
votes2
answers150
viewsSelect with IN operator in array column in Postgres
Good evening, everyone! I have a column (ids_authors) which is an array of integers in a Postgres table. I am trying to make a select with the IN operator in this column, but it is giving error. I…
-
0
votes2
answers410
viewsHow to merge these 2 SELECT into a single query
Good morning, I’m redoing the question because the last one I deleted was a little confused. I have these two select and would like to join them to return the result to a comparison chart. This…
-
0
votes1
answer346
viewsRelationship between 4 tables
I have the tables: -- NORTE -- create table tb_indices_norte( id_norte int not null auto_increment, localidade varchar(30), sem_epi int not null, totOvos smallint, num_pos smallint, num_inst…
-
0
votes0
answers132
viewsBetween with varchar field type
I have two fields where an initial and final date is placed: <form name="filtroClientes" action="consulta_contas.php" method="POST"> <div class="form-group"> <label for="nomefiltrar"…
-
0
votes1
answer294
viewsInfinit Scroll - does not bring all BD data
I am trying to implement an Infinit scroll in my project, but I am having difficulty solving this problem the connection is perfect and I’m receiving the information from BD, but the code only shows…
-
0
votes2
answers206
viewsMysql - auto increment shared between tables
It is possible to share the auto increment value of two tables? Example: Tabela 1 +----+-------+-----------+ | id | campo | criado_em | | 1 | a | 00:00 | | 2 | b | 01:00 | | 5 | c | 04:00 |…
-
0
votes0
answers42
viewsI can’t connect to the database
Hello good night I am studying php, but when it comes time to make connection with the BD, does not connect at all, the names of the bank are correct, the already imported the bank and nothing…
-
0
votes1
answer23
viewsReturn message using declare?
I need to check a variable on MySQL similar to that of the SQLSERVER. where i check return on a variable in the bank’s own message example in SQLSERVER I do so: DECLARE @nome VARCHAR(20) = 'NOME'…
-
0
votes0
answers28
viewsResultset to return BD data - Java
All right, let’s go... I have a question, I have a Bd with 3 tables and used Inner Join to unite them, and internal function of Postgresql to create a dynamic table, whose result is this: I need to…
-
0
votes2
answers509
viewsHow to map multivariate attributes?
I am trying to map this conceptual model to the logical, but I have doubts about how to map the multivariate attribute "palavra_chave" that will allow the registration of as many keywords as the…
-
0
votes2
answers264
viewsRemove First Name and Last Name from Full Name
I am using the SUBSTRING_INDEX command to get the first name and last name of a table field "Names". SELECT SUBSTRING_INDEX(nome_completo, ' ', 1) AS primeiro_nome, SUBSTRING_INDEX(nome_completo, '…
-
0
votes1
answer92
viewsClass diagram x Database
I have a class diagram and would like to know how to build the database. Follow the scenario: With the classes below I have a Demand that has a requester and an analyst, right next to each of the…
-
0
votes1
answer54
viewsUpdate data via cursor in another table
I designed the cursor below to update contacts. It runs successfully, however it does not provide the expected result. DECLARE @sequencia int, @codigoOld int, @telefoneOld nvarchar(5), @timestampOld…
databaseasked 6 years, 8 months ago Orlando Cawende 29 -
0
votes2
answers89
viewsCalculate number of sales of a seller
I’m doing academic work on comics, in this case I’m developing a database for a food distributor. I am in doubt as to how I can count the amount of sales that a seller has made in order to calculate…
-
0
votes0
answers385
viewsSqlbulkinsert- Import Excel Spreadsheet
I have a dotnet application to import spreadsheet, but I don’t know why I’m not able to enter the information in the database. My code is below. using System; using System.Collections.Generic; using…
-
0
votes1
answer63
viewsSQL "Where" problem
I am doing a query in SQL and as a constraint I want the query to return the data from the first day of the previous month until today. For example: If I run today (10/04/2019) the query, will…
-
0
votes0
answers92
viewsHow to run the JOIN command in ORACLE?
Hello. I am having problems with my query at ORACLE, someone would tell me how to solve it ? SELECT C.NRO_CONTA, C.NOME, C.SALDO, SUM(RESULTADO.COTAS) FROM CONTA C JOIN FUNDOS_APLIC AS RESULTADO ON…
-
0
votes1
answer133
viewsReference in the mongodb
Well, guys, I know there’s no such thing as a relationship, but I need to know how to do something related. I have two collections a call, Extinguisher and the other Historical, I want an extinct…
-
0
votes0
answers104
viewsHow should I name variables in the SQL language?
Is there any pattern of naming variables in SQL? I want to define the most standardized possible,for the following cases: Appointment of the database Table nomination Naming of columns Appointment…
-
0
votes1
answer36
viewsChange a table in the database from a date in another table
I have a ban_logs table that contains a date and needs that after that date, an event or Trigger is enabled to change the is_banned field of the user_data table. ban_logs id, user_id, date,…
-
0
votes0
answers193
viewsHow to Optimize Java Connection with Postgres
My connection class with the database is taking too long to open the connection, it takes almost 20 seconds. Hibernate Usage and the Bank is Postgres running localhost. Am I doing something wrong?…
-
0
votes1
answer80
viewsReturn a value from a MYSQL/JAVA column
I have the following code to store the maximum value of a column in a variable integer codemax: cf = new ConnectionFactory().getConexao(); int codigomax = 0; try { stmt1 =…
-
0
votes1
answer88
viewsDate range query in a given time
I have a query that takes all the data between days. However, I would like him to take this data only in an interval of hours (from 08:00 to 17 for example). My query currently looks like this:…
-
0
votes0
answers304
viewsJasper report only works in the local application, does not work on the Web Server
My print report is only working in the local application, using Hibernate connection, when I try to run on the server does not work due to lack of connection to the database, how can I use a…
-
0
votes0
answers135
viewsKnapsack Problem (Backpack Problem) SQL SERVER CTE RECURSIVE
Good afternoon. I am trying to develop a solution within the ERP of the company in which I work, with the objective of identifying the possibilities of INVOICES summed whose TOTAL is equal or…
-
0
votes2
answers59
viewsTable Receives 2 foreign keys - Relational Model
I have a table called QR-Code, this can be sent by an employee, or by a resident, but in the table Qr-code has to have only one code of who sent it, as I can represent it in the relational model??…
-
0
votes1
answer34
viewsHow to get the most distant date in Mysql?
I have the following tables boi ------------------------------- id | peso | data_pesagem | ------------------------------- 1 | 175 | 2019-01-02 | 2 | 200 | 2019-01-03 |…
-
0
votes1
answer28
viewsError In php variables
I was trying to make the connection to the database, but the bank is only saving the ID user’s. {$con = mysql_connect("localhost","root", ""); mysql_select_db("cadastro",$con); $nome =…
-
0
votes1
answer20
viewsHow to achieve a web table optimized for displaying about 100 thousand data
I have a service to do and I need a table optimized to work with large amount of data, about 100 thousand Rows at least... In which the person is typing and filtering the data We have some but it…
-
0
votes1
answer138
viewsI can’t do Insert with array
I have a form with the following elements: <form name="dadosLocacao" action="registra_locacao.php" method="POST"> <div class="form-group"> <label for="filme">Filme</label>…
-
0
votes0
answers106
viewsWhat’s the UPDATE error? (Java with Database)
Hello, I am developing for the first time a system in Java with Database and there is some error in the Update that since yesterday I look for and not found. The error is that when I click to…
-
0
votes2
answers91
viewsHow to create a form where it stores the data in a table and at the end you can register the data in the table in the Database?
I am creating a form where you register by entering 5 data (5 fields), and then when pressing the "Add" button, this data would be added in a "table" below where it shows your number, name and can…
-
0
votes0
answers278
viewsAlternative to using UNION in mysql/php
Good morning, I am doing the sum of the elements of a column (I called Minhacoluna) in function of another, called "turn". There are three values for turn, so I need the code to return three…
-
0
votes1
answer758
viewsPython- How to better store input (date) entries?
I have used write ("with open" "write") to overwrite and/or add date(personal names, address,phone) in the.py scripts, and it has worked out, but if I don’t take care it gets messy, both because the…
-
0
votes1
answer237
viewsHow to handle errors in sequelize create
Hello, I would like to know how I can treat possible errors when performing a create with sequelize for example considering the following insertion Livros.create({ BK_TITLE: data.title, BK_GENRE:…
-
0
votes0
answers44
viewsSelect data from 2 PHP tables
Good people, I have here two tables with the following structure: 1 - Orders, 2 - Order_items. I need to select the data of each and display the purchase details, example: Order #1 (table 1) Client:…
-
0
votes0
answers25
viewsDoes the following equation respect the syntax of Relational Algebra?
π Nome.Empregado (σ Empregado.IdentEmp = TrabalhoNo.IdentEmp ^ TrabalhaNo.ProjNum = Projeto.ProjNum ^ Nome = ‘Banco de Dados’ ((Empregado x TrabalhoNo) x Projeto)) More specifically in the part I…
-
0
votes1
answer41
viewsDoubt about Mysql Query
What code is required to display all a user’s posts? I did something like this in PHP: "SELECT * FROM postagens WHERE id='$p_id' AND u_id='$u_id';"; But always returns 0 lines :( CREATE DATABASE IF…
-
0
votes0
answers62
viewsFatal Erro Database
I was installing a site, after all completed I open the site and I come across this error: Fatal error: Uncaught Error: Call to Undefined Function mysql_select_db() in…
-
0
votes1
answer919
viewsInsert record automatically when doing a PL/SQL insert
I’m starting to mess with databases PL/SQL and I’m having a hard time creating a Trigger when inserting a row in the table, the Trigger place a value in my column whose name is token. I made a code…
-
0
votes1
answer37
viewsSearch data in BD when loading page
I am creating a search site and I have some links with certain categories. I need a system where by clicking these categories the loaded page can fetch the data in the BD and display. I know it is…
-
0
votes1
answer63
viewsA table just to store images or split by types?
I want to register users, where they should put their profile photo and inside the program, store other images, I better make a table only for all photos or split for each type? I saw some places…
-
0
votes1
answer31
viewsWhy don’t you create Foreign Key?
I ran the commands in Mysql Workbench, but did not create the Foreign Key connection, which is wrong in querys? create table Computador ( ID int NOT NULL primary key AUTO_INCREMENT, Nome varchar(45)…
mysql database mysql-workbench foreign-key primary-keyasked 5 years, 4 months ago Felippe Jaqson Chemello 3