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
-
1
votes1
answer223
viewsHow do I create an alert through a Trigger by not blocking the Insert?
Guys, usually whenever I create a Rigger is to perform insertion blocking or only update values. But this time I just need the system to alert not stopping the person performing the document…
-
1
votes0
answers62
viewsData Modeling (Relay Scale System)
I’m developing a relay scale system. Think of it as a kind of calendar, where one day has multiple shifts, shift has multiple positions, and employee is scaled to the position. Employee may be on…
-
1
votes1
answer90
viewsSQL Server - Return only the searched word
I have a problem where the Cód. below returns not only the searched words, but tb words that have this word in their composition. Ex: The term is Rio, but also finds terms as salary. In the link…
-
1
votes0
answers20
viewsMysql search with jumps of hours/days/month
I would like to understand how I can do a search in mysql skipping a certain amount of days of each record, for example, show the records from the beginning of a table to the end by skipping from 7…
-
1
votes0
answers17
viewsTable structure with polymorphy
I am developing a CRM and I am in doubt in the structure of the tables, I do not know exactly what is the best way to follow to not have performance problems and also not mix the data, I ended up…
-
1
votes0
answers50
viewsShould I avoid Queries?
Example scenario I have 3 tables: relatorios, atividades and carros. Table relatorios, will be the "cover" of the day, with date, initial and final mileage, etc. Table atividades, will be each…
-
1
votes1
answer73
viewsIn a banking scenario with high transaction volume Code First can be higher than Database First or vice versa?
I am architecting the development of a backend structure composed of microservices for a financial institution. Probably the biggest project I’ve ever worked on, and I’m having serious doubts about…
-
1
votes1
answer148
viewsIs there a performance problem in using many foreign keys (FK)? If so, is it bad to have foreign attributes without being FK?
To clarify how much can be "many foreign keys", I will explain the context: In a system, I want to store by whom a certain record has been edited ( updatedBy) or raised (createdBy). This can happen…
-
1
votes1
answer118
viewsI’m having a stupid question, but it’s been a while and I don’t know how to solve it. (Mysql)
I was trying to create a table in mysql, simple, but it was giving an error. I decided to download an ide (Dbeaver), it kept giving error, so I downloaded Mysql Workbench and it does not generate…
-
1
votes1
answer168
viewsError adding foreign key, how to proceed?
I am trying to reference the column id of a table in another table in my database, but I am told an error that is not very specific. The engine being used is Innodb and the database is in Mysql. It…
-
1
votes0
answers91
viewsRstudio - Update and add new data
Hello, I’m looking for IBGE data (library("sidrar")), df <- get_sidra (api = "/t/1846/n1/all/v/all/p/all/c11255/90707/d/v585%200") #Selecionando as colunas que me interessa df1 <-…
-
1
votes0
answers91
viewsInstead of Trigger to enter values - ORACLE
Summarizing my problem, I need to automatically insert values into a table after other values are entered into it. The way I found to do this on the Oracle was by using a Trigger of the kind INSTEAD…
-
1
votes1
answer229
viewsSELECT with two Foreign key, return the two tables even looking for only one of the keys
I have a table that has two FK to reference the same table. By selecting all elements that have one of the two FK, using the query: SELECT "Proposta".id, "Proposta".id_segurado,…
-
1
votes0
answers82
viewspython with redis
Good night, I’m trying to make a simple messaging application that unites Python with Redis, I was able to connect to the database in a simple set/get, but I’m not able to do any hashing to…
-
1
votes1
answer48
viewsSELECT displaying the same field several times from a calculation
I started studying databases, I am using Postgres and I came across the following need, I have field "packages" in one in the table "flow", where I need to separate the packages by quantity of…
-
1
votes1
answer76
viewsShow only users with the same Administrator id on the page
Good person, I have a page where shows all registered clerks as shows this image(https://prnt.sc/t972jm). In the "Unit" column of my bank it shows the unit that the clerk works. I have two units in…
-
1
votes1
answer24
viewsHow to use 2 lists to change Mysql via Python 3.x, in this case
Good guys, all right? I am creating a script in Py by COLAB itself because I need to change the weight of various products in Woocommerce, I capture the ID of a product group based on size 300ml,…
-
1
votes2
answers636
viewsReturn of a Knex query using . map
Good afternoon, you guys. I have a Controller that receives data from a frontend spreadsheet, read the dice and play these to run a query in the database, so my intention is to play the results back…
-
1
votes1
answer35
viewsReturn value that is not in the other table
I have a query that returns purchase requests on a date, the requests are three, the 1594, 1595 and 1596.. These solitaires have shopping order referring to them that are in another table and that I…
-
1
votes0
answers77
viewsUsing pivot, in this query with dynamic columns
I have the query below where I display products, ordered by the product code, the date of movement of the product is from the latest to the oldest, but as I wanted only the last 5 dates of a defined…
-
1
votes0
answers31
viewsQuery amount of storage consumed by a User
Good morning, I’m having trouble checking the amount of disk a person consumed. This was the query built, seeing several sites: SELECT table_name AS 'Nome da tabela', ROUND(((data_length +…
-
1
votes1
answer39
viewsCatch the lowest and highest value of a category with the count and ID
I need some help to make a SELECT that returns me the highest and lowest value of a category with its respective IDs and the amount of each category. The algorithm is complex, because it needs to…
-
1
votes1
answer582
viewsMigration does not create table in database. Typeorm, postgresql
Good evening, you guys. In this project I am using typeorm to configure my database. I create my Migration, but when I execute the command Yarn typeorm Migration:run, It doesn’t create the table I…
-
1
votes3
answers170
viewsHow to query a struct array in C after you have already written on it?
Hello, I want a help I am making a program that has a menu the registered user and then consult the registration, the problem and I am not being able to consult the "database" vector of structs. The…
-
1
votes0
answers118
viewsI cannot install Mysql, proble with MYSQL CONNECTOR NET 8.0.17
I had mysql on my computer working perfectly a while ago on version 8.0.17, I did the uninstallation months ago and today I had to install again, the latest version is on 8.0.22, when I tried to…
-
1
votes1
answer75
viewsReturn name instead of foreign key ID
I’m developing a Python system and wanted to return data from the specific database, only instead of the foreign key id I wanted to return the name of that person. The creation of tables:…
-
1
votes1
answer63
viewsSQL doubt in query
Can someone give me some guidance in this consultation? How to find out how many possible shows watched? For viewers of the day "24/07/2020" who passed the turnstile before the opening time of the…
-
1
votes1
answer31
viewsConvert percentage
I’m having trouble converting % my code: select veiculos , qtd , trunc(qtd / sum(qtd) over()* 100, 4 ) PERC from ( select ent_datahora_entrada , veiculos , count(*) qtd from ( select…
-
1
votes1
answer28
viewsError when displaying contents of a mysql BD via a PHP API
When creating an API for later consumption I get this error: Fatal error: Uncaught Error: Call to a Member Function prepare() on string in C: wamp64 www React test with API full src api…
-
1
votes1
answer35
viewsFilter search for only ID’s that have more than one POSTGRESQL linked record
In the query below I can find the largest reduced linked to account, but I need it to be only in the id’s that have more than one reduced linked. The table has more than 4000 reduced SELECT (id,…
-
1
votes0
answers21
viewsAdd column values created in PIVOT
Well, in this query I have to list the products that went out for consumption in a certain period, and how much was consumed of each product. I have the Cód of the product, name, date of movement,…
-
1
votes0
answers10
viewsSearch for content in more than one column (Ttable)
I am developing an application in Delphi 6, that I need to perform a search in more than one field in a Ttable, using only a search field. Currently, the search is being done only in a field looking…
-
1
votes2
answers47
viewssql search filter - exception
Hello! I’m having a hard time developing a logic for a bank search. I need to return from the bank a table with the student list enrolled with a certain type of voucher. But each student can have N…
-
1
votes0
answers43
viewsSelect data in three Mysql tables and bring the latest result with the sum
I am trying to join data from three tables using this sql: select c.NOME,c.CPF,e.DATA_CAD ,e.ENFERECO as ENDEREÇO_Atual , sum(f.VALOR) from cli1 as c inner join end1 as e on c.IDCLI1 = e.ID_END…
-
1
votes0
answers109
viewsDifference between Insert all and Insert with select dual on Oracle
Hello, good morning! I have some questions about how best to include mass data in an Oracle database so that the database does not suffer so much. Doing some research I identified two methods to do…
-
1
votes1
answer58
viewsHow to count the amount of distinct occurrences in a BD and return
I have 3 tables in a library database. One is the member table, with the age of that member and one PRIMARY KEY. The second table, book, has a PRIMARY KEY isbn and the rest of the attributes authors…
-
1
votes2
answers55
viewsPostgresql change an element of a JSON column
Hello, I’m trying to change a JSON column, but I want to change only one element, in this case, the "url". There are some urls that have the symbols ' ' and '$' at the beginning and end, as below:…
-
1
votes1
answer58
viewsSQL does not calculate with NULL values
I have a query where I have 3 columns grouped and last totaling 3, the problem is for Edson the query is not TOTALING. TOTAL = CREDIT - (DISCOUNT + REBATES) The total Edson has to give 266,49 but my…
-
1
votes1
answer32
viewsReturn only values from a database row
I want to make a system similar to a page posting, where, when clicking a button of the specific div, the user will be redirected to a page with information related to that object. However, I am…
-
1
votes1
answer60
viewsENOBUFS error on Mongodb Nodejs
My database connectorMongo for nodejs, after a while running triggers the ENOBUFS error, knocking down all the tcp connections from the computer.. other apps claim tcp exhaustion.. however I could…
-
1
votes1
answer32
viewsReturn the period where you have the highest number of records in a table
I am mounting a query from the same table of my bank that needs to return (as stated in the title) the period (monthly, for example) in which presents the largest number of entries. It turns out…
-
1
votes1
answer38
viewsI need to show a dataset in MYSQL
Need to pull the amount of matches played, amount of goals scored, create an average goal per match (average goals = Number of matches / Number of goals) all in one View, I did the VIEW but always…
-
1
votes1
answer44
viewsHow to select data that depends on other tables that have another key in common?
Hello! I was working on a database project using the SQL language in Mysql Workbench. The setting of my project is a university library where we have the tables: (Bold = PK | Italic = FK)…
-
1
votes0
answers18
viewsMysql Workbench is not importing the database, what to do?
I’m having trouble importing the bank I just saved into the workbench. Appears the message of finished, but does not transfer the bank, I have looked tutorials but no results, I have updated the…
-
1
votes2
answers90
viewsI need to create a report that sums up values by category and groups this information according to origin
I need to create a report that sums up values by category and groups that information according to origin. I explain: I need to bring the sum of monthly fees, enrollment, material and fees, but…
-
1
votes1
answer27
viewsHow to exchange the primary key of a table in Mysql
CREATE TABLE Produto ( Codigo_Produto INTEGER, Descricao_Produto VARCHAR(50), Preco_Produto FLOAT, PRIMARY KEY (Codigo_Produto) ); CREATE TABLE Nota_fiscal ( Numero_NF INTEGER, Data_NF DATE,…
-
0
votes1
answer218
viewsHow to change settings for a Binding Source?
How do I run an application that is linking (Binding) to a local database to use Binding on any machine.
-
0
votes2
answers2314
viewsThe method openOrCreateDatabase(String, int, null) is Undefined for the type Bancodedados
I’m having trouble creating a class that creates and manipulates the database! But in the method criar() gave a problem saying that "The method openOrCreateDatabase(String, int, null) is Undefined…
-
0
votes1
answer2112
viewsCan a foreign key reference more than one table?
would like to know if it is possible for a foreign key to reference more than one table, for example: client table PK - client code - client name employee table PK - official code - official name…
-
0
votes1
answer135
viewsContesting banknote database structure
I have a banknote allocation system where contestation, replica and/or rejoinder is allowed, which is the best way to store in the database? Create three tables (contestacao, replica, treplica)…