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
votes2
answers234
viewsMy PHP not saved in BD
The BD connection has been successfully established. If I play the same Query in Phpmyadmmin the command works and the data is saved in the BD. But if I use the same command in PHP it simply won’t…
-
0
votes1
answer26
viewsSql Exec Problemas
Well, I’m trying to execute the command below, but it’s always giving error, someone knows why? declare @maquinaCount varchar(max); declare @maquinaOnline varchar(max); select @maquinaCount =…
-
0
votes1
answer352
viewssetFocus in the grid column with the name of the field in the database
When I try to focus on a specific column by the name of the field in the database, it is not right. However if I do putting the number in the order of the column, example column 4, I know, but I…
-
0
votes1
answer1335
viewsError Code: 1062. Duplicate entry '2' for key 'PRIMARY'
I am trying to update the local table with the data from the cursoProunine table with the following command : Insert into local (idlocal, Uf, city) SELECT idlocal, uf_search, city_search FROM…
-
0
votes0
answers59
viewsHow to read this relation in this ER diagram?
Having this ER diagram how do I read the relationship between account and customer? I thought to read as follows "A customer can have N accounts, and an account is always associated with M clients"…
-
0
votes1
answer29
viewsdata are not stored in the Database
Good morning, I made a text editor with php js and a little jquery for the link slide effect. However it is not storing in the database and does not accuse me no error anyone can tell me how to fix?…
-
0
votes1
answer31
viewsChange report in Database
We have several tables that some users will have permissions for changes. I need to have a table of changes made by the user. Let me give you an example. Let’s assume a products table, this product…
-
0
votes1
answer70
viewsBug when doing INSERT in database with PHP and Mysql
I have an INSERT script that even not selecting any image within another input, in the database saves the name of the image formatted by the Rand function but without any extension, instead of being…
-
0
votes1
answer116
viewsDisplay a record by quantity and the most repeated value of a column
Hello, I have the following problem: I need to display the localities, the number of shipments of each one (ie how often the name of the locality appears in the column) and the most common disease…
-
0
votes2
answers568
viewsDatabase connection error . MDF C# Visual Studio
App.Config <connectionStrings> <add name="conn" connectionString="Data Source=.\SQLExpress;AttachDbFilename=C:\Sistema\Sistema.mdf;Integrated Security=True"…
-
0
votes2
answers119
viewsLIMIT IN A QUERY IN A FIELD
I have a table where there are two fields with possible values: yes-no. The select I’m doing is this: select nome, media, escola as 'Particular', bairro as 'COTA DE BAIRRO' from alunos where curso =…
-
0
votes0
answers52
viewsError connecting 2 postgres database with FOREIGN DATA WRAPPER
I’m trying to connect two postgre databases and I’m getting an error importing the tables: CREATE EXTENSION postgres_fdw; CREATE SERVER gestware_server FOREIGN DATA WRAPPER postgres_fdw OPTIONS…
-
0
votes0
answers29
viewsPass variable between PHP files
That may be a duplicate question, but I have this problem. I took a project to continue the service here and it uses old functions like mysql_connect, mysql_querry and I need to change it. ex:…
-
0
votes1
answer285
viewsJSON in Laravel
I wanted to know how to send the data of the query in json through the controller and how the view should receive them. Controller: $dados = $req->all(); $query = ""; if($dados['filter'] == 1) {…
-
0
votes1
answer72
viewsIs there any other way to run my mongodb other than by Docker?
Recently, I started with a project that uses mongodb, monitored by Robo3t, but when I look for information on the Internet on how to run it, explanations only appear using Docker. My computer is 32…
-
0
votes1
answer69
viewsError returning database records
Good evening everyone, I have the following error when returning the database data: "Warning: mysqli_fetch_assoc() expects Parameter 1 to be mysqli_result, null Given in" Follows the sources: php…
-
0
votes1
answer61
viewsHow to improve this sql code?
I would like to improve this code so that it does not repeat the same code in both Ifs. I don’t feel like using procedures because I don’t see the need. DECLARE @Ordem VARCHAR (7), @Valor…
-
0
votes1
answer50
viewsFilling missing result index of a select with 0
I make a select in the database from which I get a array data. With this, I do the following foreach in the same: foreach ($resultado4 as $key => $value7) { $array6[$value7['carteira'].'flores']…
-
0
votes1
answer45
views2 calls to the same table in Sqlite (output different than expected)
Given the following 2 tables: CREATE TABLE IF NOT EXISTS sugestoes ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, texto VARCHAR(250), autor VARCHAR(250), itens VARCHAR(250), pontos INTEGER );…
-
0
votes1
answer56
viewsSQL Server: Access tables in [Cg]
I have a set of tables of "like" Cg in a database, but I can’t access it, it has two types of sets Cg and Dbo, i can access only the tables that are in dbo. Example: Tables inaccessible guy: Cg That…
-
0
votes1
answer675
viewsHelp Android Database Locked (code 5)
I’m with an error Android Database Locked (code 5). I’ve tried all possible solutions found on Google and nothing solved. I have a Databasehelper class that has control of the bank’s connection and…
-
0
votes1
answer21
viewsReturn a single line per code
I have a table that keeps a client’s record and its duration in operation. sql needs to return me only the last client term (the most recent one). no code can be repeated follows the result that sql…
-
0
votes1
answer203
viewsCount separate records with filtering condition in another field
Staff need to perform a count of how many distinct records exist in a field, but my filtering condition is based on another field. Example of how the data are organized: PDV | DESC ----------------…
-
0
votes0
answers123
viewsHow to fix the Auto Increment that is populating high numbers in the comic Heroku?
I’m coding a API Restful with Spring Boot v.2.0 etc. The case is that when I try to make a deploy to the Heroku using Migration (Flyway) of insertion the ids get high. My model or entity of User…
-
0
votes0
answers102
viewsData Modeling - Relationship Optional
I need to do a database modeling for the following scenario: One Task(which is a ticket, a service request) will always have a Address, which is where this task will be attended to. To Task may be…
-
0
votes0
answers49
viewsWhat is the best option for a system that contains individuals and legal entities, to register both in the same table, or to make a table for each one?
What would be the best option in terms of performance, or in general? How is it done?
databaseasked 4 years, 8 months ago João Hamerski 1 -
0
votes1
answer253
viewsHelp with Trigger Mutating
I am creating a Rigger that needs to be fired through a table, even creating a COMPOUND TRIGGER it accuses error of mutating, I am aware that I cannot perform a SELECT of the table I am firing to…
-
0
votes0
answers1511
viewsMinimum Cardinality and Maximum Cardinality in Database
Good Afternoon! I’m trying to understand about Cardinalidade Minima and Cardinalidade Máxima between different entities! What I know so far is : A Cardinalidade Minima can be a Atributo Opcional(0)…
-
0
votes0
answers237
viewsOracle 11G XE change size tablespace system
I have following script: DECLARE countTablespaceFile integer; BEGIN SELECT count(*) INTO countTablespaceFile FROM DBA_DATA_FILES where file_name in ('/oracle/bdond/cbiep01/bdrgt/system01.dbf',…
-
0
votes1
answer117
viewsUse composite key as PK or not?
I have two tables: 1- Contracted Service 2- Payment Contracted Service 1 service may have N payments. I modeled the Contracted Service Payment class as follows: CREATE TABLE…
-
0
votes1
answer37
viewsHow to open connection with 2 tables in php
I’m having difficulty connecting twice in my database, each time will connect to a table the code and the following: Categories <!-- Portfolio Grid --> <section class="bg-light"…
-
0
votes0
answers38
viewsGives error when executing this query in the system that generates reports
Error executing this query in the report system, but directly from the database returns right> ERROR>>> ORA-00942: table or view does not exist Stijdbcdatabase The consultation is a very…
-
0
votes1
answer129
views -
0
votes1
answer75
viewsCreating database in Visual Studio
If I create the database of my project in Visual Studio it will always use the T-SQL language to create the manipulate? Or I can create the entire database with the relationships and everything in…
-
0
votes0
answers49
viewsProblem with connection to mysql database configured no more goes up
I’m trying to upload a local system but it’s not connecting to the database. I’ve already made the settings. I’ll leave the error below if anyone can help me thank. here and the configuration in the…
-
0
votes0
answers32
viewsC# - Treeview error popular with SQL database tables
I’m in trouble and I need help. I want to popular a treeview with data from an SQL database, but I have an error when putting the data through the code it duplicates everything. My query: select…
-
0
votes1
answer359
viewsRecover sequential auto increment after deleting some column
I am using SQL server and the scenario is that I have a table with an auto increment id field, for example I have 3 field inserted, in case there are the ids 1, 2 and 3, if I delete the column with…
-
0
votes1
answer23
viewsSQL-Obtain code of the employees who participated in all projects
I have the following tables Employee(Empnum ,Name) Project(Projnum,Name) and Assignment (Empnum ,Projnum,Function) I wanted to build a query in which I return the employee number (Empnum ) that…
-
0
votes0
answers34
viewsphp does not save form data
<!DOCTYPE html> <html lang="pt-br"> <head> <meta charset="utf-8"> <title>Login Test</title> <link rel="shortcut icon" href=""> …
-
0
votes0
answers153
viewsHow to create a temporary table within a stored procedure
greetings! My question is the following: I would like to know how to create a temporary table within a procedure, in which the values of my temporary table will be taken from a permanent table in my…
-
0
votes3
answers80
viewsDoubt with IBM DB2 rule
Guys I’m having a hard time transcribing this sql server structure to IMB DB2. Could someone help me. with cte as ( select CASE WHEN CONVERT(datetime, format( getdate(), 'HH:MM') ) BETWEEN '06:00'…
-
0
votes1
answer52
viewsaverage population per city of each state
Good afternoon, here I am stuck in more question of a job, need to make a query where it returns the average population per city of each state, I managed to perform some researches but all gave…
-
0
votes1
answer71
viewsTake only the values that are different in the query
I made a query that brings the values of credit and debit, but I need to bring only the values that are different from these two fields. At the moment I do not know why it is bringing all. Look at…
-
0
votes1
answer140
viewsHow to encrypt Stringconnection to a Mysql remote database in C#
I am developing an application that I intend to sell, and so I created a serial verification system, which checks if that activation code is already associated with the PC MAC. I do this by…
-
0
votes1
answer343
viewsHow to add 1 second to an Oracle date?
I am trying to search a table for a row that has the start_date in the second after the date placed. select * from PAY_PERIOD where pay_period_schedule_id = 2 AND start_date = TO_DATE('2020-04-30…
-
0
votes1
answer234
viewsConvert VARCHAR to TIMESTAMP (AWS REDSHIFT/POSTGRESQL)
I have the following problem, at source I have the data coming as varchar example of data source in varchar format: 08:15:49 18:16:05 20:01:33 etc.... I need to reinsert this data into a new table…
-
0
votes0
answers37
viewsAverage sales ticket using AVG Laravel
I’m trying to calculate the average sales value of a store but I’m facing some problems in calculating the total value of each sale, follow the code Controller: $valor_total =…
-
0
votes1
answer22
viewsAutomation of code
Using a DB2 database I need to automate a query and currently have the following scenario: SELECT * FROM tabela WHERE DATA1 < '2020-06-01' AND DATA2 >= '2020-05-01' How to make date conditions…
-
0
votes1
answer56
viewsRun an XMLA query using C#Webapi
My C# Webapi looks like this. using Microsoft.AnalysisServices.AdomdClient; using System; using System.Data; using System.Web.Http; using System.Xml; namespace FastReport.WebApi.Controllers {…
-
0
votes1
answer566
viewsHow to add equal amount SQL?
I have the following query: SELECT DISTINCT CTRL_CARGA_PED_VENDA.CtrlCargaNum, ITEM_PED_VENDA.PedVendaNum, PRODUTO.ProdCodEstr, PRODUTO.ProdNome, Sum(ITEM_PED_VENDA.ItPedVendaQtd) AS QtdItem FROM…