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
-
2
votes2
answers891
viewsDatabase modeling of a banknote system
I need to create a database for a banknote system, but I’m terrible with data modeling. I did the modeling but I don’t know if it’s correct. The fields are not yet definitive, I just want to know if…
-
2
votes2
answers191
viewsCOUNT() query does not work
The purpose of the query is to list, within a user-defined period, all states and their total number of independent quotes if zero. Customers must be active (status 30) and have city id number…
-
2
votes2
answers2394
viewsHow do I get the Logged in user ID in the PHP session and play in a variable to insert?
I need to get the user ID already logged in to play in an Insert query, because I will connect it to a Foreign Key Employee. I need to get this ID, only I’m not sure how to proceed and I’m beginner…
-
2
votes1
answer89
viewsRemoving lines from a problematic database in R
A few days ago I asked a question in the stack, according to link. The reply I received from prof. @Marcus Nunes shows that less than 10% of lines have more than 15 tabs of the type ;. In that case,…
-
2
votes1
answer83
viewsWhat would be the ideal unique natural key associated with a person?
I’m developing a system whose one of the tables represents people. Of course, the most accurate document to represent only one person is CPF. However, the system provides for the possibility that…
-
2
votes1
answer190
viewsConnection Tkinter - Database
Good night! Guys, I’m starting in the world of programming and today I was following a tutorial that for me didn’t work and I don’t know how to solve the problem, I tried everything. This is to…
-
2
votes1
answer289
viewsForeign key with UNIQUE
What happens if I put one foreign key as UNIQUE in a table? I tested that possibility but maybe I misunderstood, if we apply a UNIQUE in a foreign key and insert the wrong value in this table, the…
-
2
votes1
answer60
viewsNotice Message: Undefined Index (Codeigniter)
I have a form where two multiple selects is loaded, here the code: <div class="form-group"> <label for="categorias[]">Selecione a(s) categoria(s) referente(s) a foto:</label>…
-
2
votes1
answer215
viewsUpdate Database Problem "too long string literal"
I have a problem when it comes to Update of a content to the database, below the code used for the Update public function atualizar_conteudo_manual() { $dadosmanual_update = array…
-
2
votes1
answer39
viewsBugando Bank Field with Thousand values
Guys, I know it’s a very basic question, but how do I make a field of my bank accept values where these are values like 1000+ and also come as decimals. I will show an example below in the value of:…
-
2
votes1
answer45
viewsID being created and not starting with 0 - Oracle 11g
I am studying Database, using Oracle 11g and making the tables in SQLPLUS. I create the table: CREATE TABLE COMPRAS (ID NUMBER PRIMARY KEY, VALOR NUMBER, DATA DATE, OBSERVACOES VARCHAR2(30),…
-
2
votes1
answer209
viewsError while creating tables simultaneously in sqlite database
I’m developing a mobile application that saves data from a form in the local database, using the sqlite. Only every time the database is reset or changed its version it returns me an error that…
-
2
votes1
answer59
viewsSelect by schedule time
Good afternoon, Folks! I’m building a TV grid app. There is a table in the database that contains information from (Program name, description and time). In my application, the system sorts this…
-
2
votes3
answers454
viewsReplace Sql in the middle of the text
SQL Server Database , Column is a Varchar(9) . And I need to fix this data because I need to filter only by people over 50 years old and that way I’m not getting , more in case someone knows a…
-
2
votes5
answers79
viewsSQL using two tables
I need to select all records from the table solicitation where all the table records tasks that have in the column id_solicitation the id concerning that request, and date of completion are…
-
2
votes1
answer203
viewsTernary relationship of entities in a relational scheme would be counter-normative, and how to do this mapping in Entity framework 6?
Taking as an example: We can abstract the relationship in several ways, one of them would be putting relation of N p/ N between project and skills needed, while another for employee and skills…
-
2
votes0
answers20
viewsMongodb collections
I have a database in Mongo with the following collections "Productsservices" and "stock" where the stock collection will inform the stock value of a record within the product and service collection…
-
2
votes2
answers48
viewsSQL showing records if they only meet different conditions than usual
I have a slightly different situation, tried different conditions but none brought the desired result. My need is this: I have a base containing authors of books and their respective works. I need…
-
2
votes2
answers103
viewsHow to search multiple data in mysql without losing performance
I have a table called "readings" where my search returns 10 thousand results for the equipmentid = 1 SELECT id, result, date FROM readings WHERE equipamentid = 1; for each returned result I need to…
-
2
votes0
answers126
viewsHow to assign a null value to an input variable if the user leaves the field blank or type zero?
The context in which the problem arose is the following: I have a stored procedure that performs the registration of certain values in a table of my database. In this procedure I set all variables…
-
2
votes2
answers109
viewsCONSULT DATA FROM A FOREIGN KEY TABLE
I have 3 tables in a database, one houses customer data, other products and one sales, containing foreign table id key products and customers. I need to make a query that shows the purchases made by…
-
2
votes1
answer97
viewsUpdate is not performed in the Database using Sequelize and Nodejs
I have the following route that is responsible for receiving the data coming from a form and doing an update of the data that is in my database router.post('/articles/update', (req, res) => { let…
-
2
votes1
answer54
viewsCan I rename an attribute by creating a table from a type?
Following the Object-Relational model, I want to create the tables or_medico and or_atendente derived from t_funcionario that I created. Below follows the structure of type: DROP TYPE t_funcionario…
-
2
votes0
answers96
views -
2
votes1
answer52
viewsMysql, Sum accumulated values by date and ID
Good afternoon, I’m having a problem to get a relatively common result, I’ve seen some materials talking about but none applied to my specific need. I need the cumulative total of each release,…
-
2
votes2
answers36
viewsRelationship between Similar Tables
I have a Relational Database structure. I will illustrate more briefly my tables: Tab_client with fields (ID, Name, ETC...) Tab_company with the fields (ID, Name, ETC...) Image tag with fields (ID,…
-
2
votes2
answers131
viewsInsert data with pymysql into a mysql database error. How to resolve?
seqteste.txt or List: >gb:KX262887|Organism:Zika virus|Strain Name:103451|Segment:null|Subtype:Asian|Host:Human GTTGTTGATCTGTGTGAATCAGACTGCGACAGTTCGAGTTTGAAGCGAAAGCTAGCAACAGTATCAACAG…
-
2
votes1
answer52
viewsBest way to query the database using LINQ and Entity Framework
Hello! I need to make a query in the database, the scenario is as follows: I receive email and from it I seek the id user. About the bank, there is the table Contact, which has Nxn relationship with…
-
2
votes1
answer53
viewsProblems when grouping information through ifelse and case_when functions
I am trying to group the information contained in each of the Brazilian states into regions. Initially I checked the distribution of these in each state through the function table. Dice:…
-
2
votes0
answers19
viewsBase table or view not found: 1146 Table doesn’t exist Laravel 8.0.4
I upgraded my Standard to version 8.0.4 and now my project has the following error when I try to run php Artisan serves. I have 4 database connections, and only one is the main one and is where the…
-
1
votes1
answer139
views -
1
votes2
answers601
viewsHow to change the location where MAMP creates the database?
I’d like to change the location where the Mamp creates the database. The pattern would be this: /Applications/MAMP/db/ And I would like to create by default the database on my server that would be:…
-
1
votes2
answers349
viewsDesign table of "workflow"
I’m doing an application in Cakephp and would like your help in what would be the best way to create my database and my relationship between models. It would be a "workflow". I would like it to work…
-
1
votes3
answers1619
viewsInsert data Database Related tables
I’m having trouble inserting data that has related tables. $sqlinsert2 = "INSERT INTO tb_detalhe_trabalhador VALUES(0,NULL,NULL,'".$MedicaValidade."',.. Currently the data that are as NULL are the…
-
1
votes3
answers864
viewsDifference between ways to perform a backup (Disk space, buffer, etc.)
Suppose I have a machine with 10GB free disk space, and I have a backup script from a database postgresql, that when run, it backs up locally and just after finished, copies to another remote…
-
1
votes1
answer1089
viewsCreate 1:1 relation in Query Browser
I would like to know how to create 1:1 relations in Query Browser. I don’t know if I’m right, but he creates 1:n relationships by creating Foreign Keys.
-
1
votes1
answer2919
viewsTake data from BD Sqlite without using Listview
My code needs to take the data from the database, in short only the following commands are missing: if (cursor.moveToNext()) { Contato contato = new Contato();…
-
1
votes1
answer341
viewsFunction RANDOM in IBM Informix BD?
I need to use an Random() SQL function in a Informix version 11.50 database. But in select below returns syntax error : select random(), codigo from minha_tabela; 674: Routine (random) can not be…
-
1
votes1
answer796
viewsHow to add values from a column in Ruby/Ror
Loveliness? I’m trying to build an application in Rails. In it I have a resource where users inform the running time related to a category. Well, I need to perform adding up the total column time…
-
1
votes1
answer979
viewsJPQL to view bank date/time with Hibernate without query
There is a way to query the database date/time without using activate query? On the Oracle I do this: SQLQuery qry = session.createSQLQuery("SELECT SYSDATE FROM dual"); But I would like a general…
-
1
votes2
answers282
viewsRelate Check Boxes to Radio Buttons
I’m with a project where I have to put occurrences. This is a school project. So the occurrences would be like this: An occurrence would be a warning or a suspension, and its causes, that is, messed…
-
1
votes3
answers21331
viewsInsert image into database
What type of variable do I use to store an image in the database? And is there a specific command for this? or just enter as any record? I have a product table with the fields: code, name, price,…
-
1
votes1
answer424
viewsConnection via PHP to an SQL Server 2012 database
My problem has some variants: I have a website built on joomla, which is hosted on a linux server. The administrator where I have hosted my website has already informed me that it will not install…
-
1
votes3
answers2710
viewsHow do I create a view in mysql by taking data from 4 or more different tables?
How can I create a view and show the data as below:…
-
1
votes1
answer153
viewsUsing Symfony to start the database automatically when deploying the project
Is there any place in Symfony reserved for me to provide scripts or run a class that populates the database with the initial information I need? The ideal would be during the first run and each…
-
1
votes2
answers2430
viewsDelete files with Codeigniter
I want to delete a BD record that contains an image. When you do this, also delete that image from the folder where it is. How to proceed to make such action?
-
1
votes2
answers164
viewsWhat is the best type of column to record amount of time?
We usually use Datetime to record a specific moment. But what if I want to record that an event lasted half an hour (00:30) or an hour and fifteen (01:15)? I thought to convert to decimal, so the…
-
1
votes2
answers1059
viewsFor database abstraction, should I use uppercase or lowercase column names?
I am developing an application that will need to connect to any database. I am using Laravel for this. Laravel’s ORM maps the database fields and provides my class as an attribute automatically, but…
-
1
votes1
answer185
viewsShould I create a table by category, or a single table?
I want to set up a classified site and I have a question: how can I create the categories in the comic book? Create an ad table for each category? Or create a table Categorias with them inside?…
-
1
votes1
answer1791
viewsUsing JPA with H2 Database
I apologize for posting my question in the chaining of a similar one. So I’m posting as new topic, ok? I am using the H2 and JPA database to create my tables. Testing my application, I can create…