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
answers1240
viewsIs there a way to auto-increment the id in Mongo?
You can do this, every time I create a new user for example it auto increments _id. Starting from 1 and going up to the number of users
-
2
votes2
answers176
viewsSelect a certain amount of data for each status type
Billy Jow here! On my table historical I have a field status that can assume four possible values: 'EVALUATE', 'FAILURE', 'REEVALUATE', 'SUCCESS' I wish to select 20 records from each status where…
-
2
votes1
answer480
viewsBLOB column 'about' cannot have a default value (default)
When trying to keep a column as null, mediumText, and add an 'as defined' value, it returns: BLOB column 'about' cannot have a default value (default) Why can’t I? What things imply this? How can I…
-
2
votes2
answers155
viewsConvert date 20171130 to format 30/11/2017 in string
I have this date field '20171130' saved in the database, and I need to convert to string formatting "30/11/2017" in my application, how to do this type of conversion ?.
-
2
votes1
answer62
viewsParse data from a C#database?
Precise deserialize the information of a database in C#, I have the following SQL in C#: select Id, Email, Name, Login FROM usuarios WHERE Login = @login and Senha = CONVERT(VARCHAR(2000),…
-
2
votes1
answer270
viewsQuery the Database in Android
I would like a help from you to check what is wrong with this consultation: int raioKm = 10; String latitude = "CONVERT(" + "NUMERIC(10,7), " + "SUBSTRING(localizacao, 0, CHARINDEX(localizacao, ','…
-
2
votes3
answers1806
viewsSQL searching records from a Date and Time
I have the following SQL: select * from tb_valores where DATA >= '14/12/17' and HORA >= '16:34:00') I would like to bring all records from that date and time. The problem is that if I have…
-
2
votes1
answer154
views -
2
votes1
answer451
viewsIs it possible to query "INSERT INTO table SET field = 'value' " in Postgresql?
It is possible to run the query INSERT INTO nome_tabela SET nome_campo = 'aaaa' in the Postgresql database. I had to migrate a virtual store made in PHP with bank Mysql, for Postgresql. The bank…
-
2
votes1
answer248
viewsFetch ip via sql
Does anyone know if there is a way for me to search via sql (Firebird) all ips that are using a Table or Views? I am trying to update a view, but am trying the following error: This operation is not…
-
2
votes0
answers106
viewsCopy data from one BD to another whenever you have a new record
I need to copy the data from a BD-1 PGSQL to another BD-2 PGSQL whenever I have a new record. I was trying to give a SELECT inside the INSERT but is failing with the connection, I already checked…
-
2
votes1
answer1525
viewsIs it possible to search a data in the database without knowing which table it is in?
I have a banco de dados very large and it is impossible to build a SELECT * FROM for each table and locate the data I need. It is a texto especifico ('with as parameter 23') I’ve searched every way…
-
2
votes1
answer2359
viewsReturn of "?" instead of the special characters in a SELECT
I’ve got a problem, I’ve encoded everything with utf-8, I’ve tried multiple ways to fix it and I can’t, in one <option> of HTML, I pull a table from the database, but it returns with a special…
-
2
votes0
answers564
viewserror #1932 in phpMyAdmin
I installed XAMPP for Windows 5.6.15, Apache + Mariadb + PHP + Perl. Everything works fine until "out of the blue" some tables are randomly "in use". I just can’t access them anymore, keep…
-
2
votes2
answers274
viewsHow to normalize this small database?
I’m trying to improve this small I TCC database of the technician, it’s very small, it’s from a small page to a trade, in which I would have a catalog of products and promotions to attract buyers to…
-
2
votes1
answer33
viewsHow to ensure data entry and update in different databases
I’m developing an application with a microservice architecture and a question has arisen. Each application functionality will have an isolated API, how can I ensure that when making an Insert/update…
-
2
votes1
answer51
viewsHow to select and play values in the same column
Example: select 'a' as 'letras', 'b' as 'letras' I want to play the letter 'a' and the letter 'b' in the column 'letters', but with this code it returns 2 columns with the same name, but I want to…
-
2
votes1
answer143
viewsWhen to use UNIX_TIMESTAMP
Absolutely, we all work with dates, timestamp, among other forms and various formats. The UNIX_TIMESTAMP (the time in seconds from '1970-01-01 00:00:00' UTC to date) always ends up appearing…
-
2
votes2
answers1778
viewsMultiple codeigniter database connections
I’ve been investigating the use of multiple Codeigniter databases. If I know which databases are ahead of time, I can set the information in the configuration file and then call the database group I…
-
2
votes2
answers1455
viewsDatabase/slow server
I’m starting in the database area and I notice a great slowness in some banks I use in virtual servers. In my case I access a windows that has a postgres and with an average frequency my scripts are…
-
2
votes2
answers213
viewsInsert multiple lines into Informix
I use a Informix bank and I have to do 3500 Inserts. Informix runs line by line and this is impractical. How do I insert all lines at once? Example: insert into tabela (coluna1, coluna2, coluna3)…
-
2
votes1
answer337
viewsError when connecting to Sqlserver C# Web.config database
I’m trying to make an application .NET MVC, but when I connect to the bank is giving the following error: An Exception of type 'System.Nullreferenceexception' occurred in Gerarxml.dll but was not…
-
2
votes1
answer1092
viewsMysql - Separating line values into multiple lines
I need to separate the values of a line into several lines, taking into account that it has line that has up to 2000 values separated by ,…
-
2
votes4
answers2013
viewsFind the best-selling item along with a particular item
To explain, I prefer an example: I want to find out which item is the most sold along with the salty chicken. For this, I tried the following approach and failed miserably by lack of technical…
-
2
votes2
answers860
viewsHow to create a report in Sql Server with information by date
I am created a system for output management, one of my tables stores the output history information, it has the following columns, IDpedido, DataDoPedido CodProduto, QuantidadeProduto CustoProduto…
-
2
votes2
answers94
viewsAdds WITH query within another query
Guys, how to add the query below as a subconsulta. Consultation with WITH: WITH tabela (projeto, operadora) AS ( SELECT p.projdesc, tt.tartitulo FROM tarefa tt INNER JOIN projetos p ON p.projid =…
-
2
votes2
answers87
viewsI have this query and I’m not able to group by month
DECLARE @Year INT = 2005, @Month INT = 7 SELECT --SequenceNo = ROW_NUMBER() OVER(ORDER BY OrderDate), Year = Year(convert(int,OrderDate,111)), case Month(convert(int,OrderDate,111)) when 1 then…
-
2
votes3
answers2314
viewsHow to calculate two columns and compare the result with another column?
I have a table, where I am bringing two different results with the query below: select sum(qtde_pontos) from dbo.tbl_cc_ponto where re = '9289' and natureza_operacao = '2' and data_lacto >=…
-
2
votes1
answer242
viewsError entering data into database
I am making a system in java with postgresql database for client registration, any help is welcome to solve my problem. org.postgresql.util.psqlexception: ERROR: syntax error at or near ","…
-
2
votes1
answer534
viewsIs SQL Express free?
I need a database to use on a Xamarin Forms app for college. I even created in Azure, but the limitation of 32 MB is very large, because I need to store photos too. I searched and saw that has the…
database sql-server xamarin xamarin-forms sql-server-expressasked 6 years, 6 months ago Lucas F. 65 -
2
votes1
answer2431
viewsSelect with Laravel/Eloquent
I have the following select in my controller: $turmaAlunos = DB::select(' SELECT alunos.ST_ALUNO_ALU, alunos.ID_ALUNO_ALU FROM alunos WHERE alunos.ID_ALUNO_ALU NOT IN ( SELECT…
-
2
votes1
answer128
viewsType of relationship between tables (Laravel)
I’m implementing my TCC, about photos and such.. But now I got a question when creating the tables... I’m using Laravel ok? Next, I have the following tables: users - roles - photos - tags works as…
-
2
votes2
answers876
viewsQuery SQL to select student and student name
I have this simple relational model, and I need a query that selects the student and the student’s name.…
-
2
votes3
answers640
viewsGrouping by day and by date period
I have a query of the period 26 a 30-06 that brings the following result: Data_Cancelado Cancelados 27-06-2017 4 29-06-2017 5 However, I want it to come this way, ie,. Data_Cancelado Cancelados…
-
2
votes1
answer30
viewsQuery to catch a student’s mistakes and successes
I would like a query to catch mistakes and hits from a particular student of the following table below:…
-
2
votes1
answer1113
viewsHow to Insert into the table if the record does not exist
How to insert in the table if there is no record, as for example there is the table turma_materia, has the following information: +----+-------+---------+ | ID | turma | materia |…
-
2
votes1
answer170
viewsHow to pass my data set from wide format to long cm multiple variables in R
I have the following data frame: dput(exemplo) structure(list(id = c(1, 2, 3, 4, 5, 6, 7), grupo = c("A", "A", "A", "B", "B", "B", NA), fc_pre = c(90, 98, 77, 98, 100, 92, 89), fc_pos = c(70, 77,…
databaseasked 7 years, 3 months ago Nelson Carvas Junior 23 -
2
votes3
answers103
viewsI’m not able to log data into the database
I’m a beginner in java and I have the following problem. On the state registration screen, I have a country selectOneMenu, and two fields for name and acronym. When I go to save in the database I…
-
2
votes0
answers39
viewsCount records that precede the selected one in the sql server, mysql query
I have a question: How do I know how many records you have before a selected value. For example: Select * from cidades where nome= 'SAO PAULO' ORDER BY nome Assuming that the cities table has 500…
-
2
votes0
answers71
viewsHow does the database version align with the PHP application?
Work on a project that system versions are incremented manually on semantic model, usually after a sprint a new version is released when a work is merged with the main branch and passes through the…
-
2
votes3
answers590
viewsHow to remove apostrophes from a variable
I have a text Edit PRODUCT that comes like this: 'STICKER 478', with apostrophes. How do I make it come out like this: STICKER 478 on sql server? I’ve tried that and it doesn’t work: DECLARE…
-
2
votes1
answer110
viewsIs there any way to bring information from the database without using server side language?
I was evaluating the website of Zap Imoveis to find out what languages and technologies are used on their website. I use the Wappalyzer, an extension of Google Chrome, which shows the technologies…
-
2
votes1
answer44
viewsReverse transformation in R to var continues with max = Inf
I have the following var continuous: > summary(banco1$rac) Min. 1st Qu. Median Mean 3rd Qu. Max. NA's 0.000 5.077 6.694 17.380 8.728 4917.000 465 This var does not have normal distribution and so…
-
2
votes4
answers90
viewsIs there a difference in these two querys?
Is there any difference in these two querys? What is the difference of using parentheses in and? SELECT * FROM produto WHERE grupo = 'bebidas' AND preco < 10 OR estoque <= 100 ORDER BY estoque…
-
2
votes1
answer147
viewsProblem entering data with methods. Java/Mysql
I get the following error when I try to add a new data into a table in my database. I have a class whose name is Banco de Dados , another whose name is ShowMenu and another whose name is Principal.…
-
2
votes1
answer1021
viewsConsultation with MAX(DATE)
I am trying to generate the query below as follows. Cliente Tarefa Data da Ultima Providencia Teste 16555 04-07-2017 However, is generating duplicate, IE, I want to take the last date of the last…
-
2
votes4
answers19922
viewsLimit the number of SQL query lines
I have the following Query SELECT estado, num_ocorrencia FROM bra_ocorrencias WHERE nome like 'João' ORDER BY num_ocorrencia DESC It returns me all the states with the most relevant occurrences…
-
2
votes4
answers593
viewsSql - Query of two maximum values
Suppose we have this database codigo, data, valor,seq (1, '2014-01-01', 10,2), (1, '2014-01-02', 20,1), (2, '2014-01-03', 30,1), (2, '2014-01-05', 40,1), (2, '2014-01-05', 50,2), (3, '2014-01-06',…
-
2
votes2
answers82
viewsSearch in two tables
I have a media table with the fields id_midia, nome, tipo and another table of synonyms that has the fields id_midia, sinônimo. I need to make a query where it checks the two tables if the term…
-
2
votes1
answer354
viewsHow to update the database with SELECT Sum
I need to do the update of a table summing two values (money + deposited), thus obtaining the total. This total I already have using the code Select SUM(dinheiro)+(depositado) total from usuarios…