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
-
6
votes1
answer2140
viewsHow to remove spaces leaving only one?
Considering a variable with a text in SQL Server. How can I remove 2 or more spaces within the text? In this case leaving only 1 space. For example: '1 tigre, 2 tigres, 3 tigres' It should result…
-
6
votes1
answer2181
viewsIdentify if a string is capitalized in sql server!
I have a field in a table that must be filled all in lower case, but the user being user filled some lines in upper case. I want to identify what records are like this so I can request correction. I…
-
6
votes5
answers16830
viewsHow do I list all tables with their respective databases?
I would like to list all the tables in my database that ends with a specific name and also all my databases that match these tables. I tried to do it but nothing comes back. Query SELECT da.name AS…
-
6
votes1
answer112
viewsTables with unconventional names like ABC1234
I have seen some that some systems adopt a different way of naming tables with letters and numbers like ABC1234, XX_900, etc.. These days I’ve been working on creating some queries in a system that…
-
6
votes2
answers1510
viewsHow to view the last 30 days of a query
I’m trying some alternatives to show only the records of the last 30 days, but I couldn’t make it work, the query I have is like this: SELECT comunidade.descricao AS nomeunidade ,comcargo.descricao…
-
6
votes1
answer1546
viewsHow to round up time?
I have the following function which treats an hour coming from the bank: SELECT f.chapa AS chapa, f.nome AS nome, f.secao AS cod_secao, f.nsecao AS desc_secao, c.codigo AS cod_funcao, c.nome AS…
-
6
votes1
answer221
viewsWhat is a T-SQL query?
In the Stack Exchange Data Explorer, specifically in the first line it says: Click the Compose Query button up there and start Typing your T-SQL query [...] That in free translation would be: Click…
-
6
votes2
answers1493
viewsSyntax difference between databases
What is the difference, in the syntax, of the following databases, for a simple query, of the type: SELECT * FROM tabela WHERE id = '1' ORDER BY nome GROUP BY nome LIMIT 1 Or, what do they differ…
-
6
votes4
answers829
viewsBest approach is to filter data in the database or application?
Suppose we have a table 'Vendas' with the following columns 'estado', 'cidade', 'vendedor', 'valor'. 'estado' and the 'cidade' would be where the sale was held and 'vendedor' would be what made this…
-
6
votes1
answer343
viewsDifference between using Sqliteconnection and Java Drivermanager
I am connecting to the Sqlite database with the following code: import org.sqlite.SQLiteConnection; public SQLiteConnection conn() throws SQLException{ String path = System.getProperty("user.dir");…
-
6
votes1
answer1578
viewsWhat is an embedded database (Embedded)?
what is an embedded database, and what we call the "unbuilt"? For example: I’m trying to create a database by the H2 Database Engine, and it has two database options: Embedded or Server. You could…
-
6
votes3
answers14615
viewsHow to remove a Foreign key in mysql?
I need to edit a table, but I cannot remove it. I need to remove Foreign key, however, all commands I tried did not work. I’m currently trying to alter table tabela drop foreign key nomefk And the…
-
6
votes2
answers1076
viewsWhat is Microsoft Access for?
It’s a stupid question, I know. I have almost no contact with MS Access. I know it is a database. Does it have anything special? Any Feature worthy of note? How does it work? What demands does it…
-
6
votes2
answers2211
viewsHow to save images in the database using spring boot?
I’m having trouble saving images from a form in the database. Does anyone know how to save an image in the Mysql database using spring boot? I’m learning this technology now, so with this…
-
6
votes2
answers230
viewsInvalid Property 'category.subcategory' of bean class. Error saving user to database
I am developing a web application that has the following mapping: A user has a category; A category has several subcategories; a subcategory has several products. As shown below: What I am trying to…
-
6
votes1
answer66
viewsWhy does (a < x < b) produce a result other than ((a < x) and (x < b))?
List all fields of all products whose cost plus 30% is greater than 8 and less than 10. That was my answer: SELECT * FROM `produtos` WHERE (8 < (pcusto*1.3) < 10); This is the feedback: SELECT…
-
6
votes1
answer499
viewsCOUNT(*) x COUNT(1) x COUNT(id)
I would like to understand better about the difference between these ways of using the counter: select COUNT(*) from tabela select COUNT(1) from tabela select COUNT(id) from tabela This question…
-
6
votes1
answer400
viewsHow to return the last value of an sql string?
I need to use the last character of a string G. Like I get it with sql server? SET @VALOR = '0000050529-G' I want to take the letter G
-
6
votes0
answers4119
viewsShortcut to Identar Query Sql
Good afternoon, everyone! Is there any keyboard shortcut that makes the Query SQL identation and leaves the code organized? In the Database.Net application the command is Ctrl+M If anyone knows…
-
6
votes2
answers820
viewsDifference between non-relational database models
When it comes to non-relational databases, we have some options, such as the Document database and Graph database. Regarding the two, what are the main differences and benefits of using each?…
-
6
votes5
answers146
viewsIs there a disadvantage or is it harmful to use null types?
I always have trouble receiving null values from the database because I forget to use the cancellable types and face the same problem: The type cannot be null This usually happens with attributes…
-
6
votes2
answers387
viewsHow to do concurrency control in Hibernate for INSERT in the database
I’m having a competition control problem in entering data in my web application. Context: I have 3 tables (ex: X, Y and Z) that record hospitalizations of patients (already registered). A patient…
-
6
votes2
answers1944
viewsView or temporary table?
Analyzing a code problem I came across different approaches to similar problems where one has a view for data access, and another uses a temporary table. I searched and found this question which…
-
6
votes3
answers475
views -
6
votes1
answer57
viewsselect with order by
I have a simple table with only one text field, no field auto increment and indexes CREATE TABLE teste (Nome varchar(30) NOT NULL) I inserted the information in this table in the following order:…
-
6
votes1
answer141
viewsHow to determine a gap condition between records?
In the case of records containing date and/or time, how to determine that between the first record returned and the others there is always the same interval? Let’s take this example: Raw data:…
-
6
votes2
answers1019
viewsselect bringing all un-duplicated records based on a single column
How can I bring all records from a column that are not repeated. For example: | tela | url | perfil | dataCriacao | --------------------------------------------- | dica | /dica/ | ROLE_CDL |…
-
6
votes2
answers48
viewsHow to create a View with 2 tables with different columns in SQL?
I have the following query: CREATE OR REPLACE FORCE VIEW "Resumo_vendas" ( "TIPO_REGISTRO" ,"VLR_DESCONTOS" ,"VLR_ACRESCIMOS" ,"VLR_PIS" ,"VLR_COFINS" ,"VLR_ICMS" ,"DTA_EMISSAO_NOTA" ) AS ( SELECT 1…
-
5
votes4
answers4278
viewsMysql performance with Innodb in large data mass table
I currently have a table with about 6 million records that in turn perform a large amount of I/O operations, so in the design of the project I chose to use the Innodb instead of Myisam in Mysql,…
-
5
votes2
answers350
viewsFetchtype.EAGER for Fetchtype.LAZY
I have the following problem, the whole system uses a relation, Eager, but for a specific query I do not want to bring all relations in the bank, because it would be too heavy the process, only for…
-
5
votes1
answer547
viewsIs it possible to create a foreign key from another database?
I want to reference a foreign key from a different bank, saw on some forums that it is only necessary to do `nome_database`.`nome_tabela`, but it’s not working. My code is this:: ALTER TABLE…
-
5
votes1
answer2052
viewsUsing Hibernate to generate tables with H2
I’m developing an application in which I decided to use H2 as an embedded database. It is the first time that I am using this type of database and I am having problems to generate the tables by…
-
5
votes2
answers8457
viewsClose PDO connection
I have worked with other languages before working with PHP and in some the framework when you opened a connection with the database was good to finish it, in PDO so I realized there is a function in…
-
5
votes1
answer844
viewsFormat date and time and list according to current date
This application has two tables: Students and Occurrences. To show the occurrences I can calmly... Only now I’ve come up with a new business rule: show occurrences by date. So basically it would be…
-
5
votes1
answer192
viewsDatabase Allocation
I have some questions regarding my database. I use an MS-SQL "database", which is provided by Locaweb (I don’t have very clear this concept of Locaweb providing me with a "database" which has within…
-
5
votes2
answers544
viewsRank database [#1 of 10]
I need to rank the DB records during paging. I don’t intend to create a field for ranking at first. Assuming I have 10 records 1) Ordenando a paginação por AZ, quero listar com o número…
-
5
votes1
answer325
viewsIn a service-oriented architecture, is the database decentralized?
I’m with the prospect of taking on a big project, and by its own scale I suggested the adoption of a service-oriented architecture - because it is easier to solve several medium problems than a very…
-
5
votes0
answers12120
viewsIs there a free database for product barcodes?
I’m making an app that is related to supermarket products, and a future possibility is that, instead of the user searching by product name, he can also use the mobile phone to scan the barcode. How…
-
5
votes1
answer1494
viewsStructure of a database for 'Secret Friend'
I’m creating a secret friend system for the family, where it will be possible to have: Registration of users with their data (ex: Tennis size, shirt, etc...) ; Groups of registered users; Generate a…
-
5
votes2
answers3756
viewsHow to save the path of an image in the Database?
I’m using JDBC and picking up an image to save in the database. However I want to save the image in the hard drive and save in the database only the way (path) hers. I wanted to know which is the…
-
5
votes1
answer147
viewsPersisting all data as string is a problem?
Is there any problem in storing all the information of an application like string in the database? Independent of the application, SGDB, the programming language used, etc. I ask more for data…
-
5
votes2
answers9964
viewsPivot dynamic columns
I need to display this: Thus: Following the instructions of the links s: Use PIVOT operator without aggregation I cannot place a subquery inside the IN in the PIVOT Dynamic pivot with SQL Server I…
-
5
votes1
answer688
viewsMysql Backup with Event Scheduler
I would like some tip on how to backup a mysql database with Event Scheduler. I only got in my searches, find Event to back up tables individually. I wish I could back up the whole bank, someone can…
-
5
votes1
answer2172
viewsRevoke privileges
I have a database and I’m trying to make sure that only my user has access to this base. ie no one else can open, search, delete anything. I’m using the following syntax: GRANT USAGE ON batabase.*…
-
5
votes2
answers707
viewsMysql to Python 3 connector
I’m doing a project with Django and Python 3 but I can’t find the appropriate Mysql connector. The django.db.backends.mysql works, but only for Python 2, and I wanted to avoid using this version. On…
-
5
votes2
answers3824
viewsWhat is the best way to save files, Bank or File System?
I have a demand to attach Pdfs to my application. The files have varying sizes, from 5 to 200 MB or more. Here comes my question: what is the best option to store? Direct in the database…
-
5
votes1
answer1244
viewsUsing multiple databases
I don’t know much about databases, and I’ve never worked with large systems... I’m creating an application with Cakephp that will serve as a webservice for two distinct client types, one client is…
-
5
votes1
answer751
viewsIndexing of Database
What is the advantage of maintaining an indexed database, with Foreign key and indexing of the most used fields as in searches?
-
5
votes2
answers1099
viewsHow to remove formatting from the GETDATE() command
I am developing an application that will be used by several customers simultaneously, I would like to use as id the Day, Month, Year, Hour, Minute, Second and Millisecond, would have as I remove the…
-
5
votes3
answers11223
viewsWhat is the MINUS command for and how it works on oracle
I’ve never seen this command before and I haven’t found it here either, I don’t know if it has another name and from the Oracle documentation I couldn’t understand exactly how it works. I just want…