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
votes1
answer128
viewsAnalogy between POO and database
I’ve been reading about the Entity Framework, that it has some features of transforming classes into tables and objects into lines. I found it super interesting! To what extent is this analogy…
-
2
votes3
answers1358
viewsProblems adding Foreign key to Mysql
I’m having trouble defining the attribute anoAuto from the business table as a foreign key for cars.ano. Mysql always says "ERROR CODE: 1215. Cannot add Foreign key Constraint". create table…
-
2
votes1
answer879
viewsHow to search data from a table using other reference?
I’ll give you a simple example... I have a table 'products' that has in the columns, id, product name, value. I have another table 'users' columns, id, name. And another table 'buysdosusuarios' id,…
-
2
votes4
answers4389
viewsSelect from previous months
I need to do select data from previous months, month by month. My query is like this: SELECT * FROM VIEW_INCD WHERE MONTH(DH_CRIA_INCD) = DATEPART(mm,GETDATE()) - 1 AND YEAR(DH_CRIA_INCD) =…
-
2
votes1
answer44
viewsWhat is the OPTION=3 parameter for in the Database connections?
A database connection is usually something like this Driver=MySQL ODBC 5.1 Driver;Server=XXX;Database=XXX;UID=XXX;PWD=XXX;OPTION=3; Most google searches suggest this OPTION=3. In the mysql manual…
-
2
votes2
answers807
viewsHow to model n-to-n relationship correctly? Women also have friendship with men and not only men have friendship with women
Hello, I want to do the following: Create in Mysql the n-to-n relationship where men have friendships with women and women also have friendships with men. Example: John has friendship with Fernanda,…
-
2
votes0
answers375
viewsConnection to external database
I created a database on 000webhost and created a PDO connection to access it from my localhost in vertrigo <?php //CONSTANTES define('HOST', 'databases.000webhost.com'); define('USUARIO',…
-
2
votes3
answers7703
viewsRemove last number with sql
I would like to take the last paragraph 1 from this sequence: 0495747500000049908275289000100040000000041 How do I do in sql server?
-
2
votes1
answer403
viewsTable is not generated in Oracle database
That normal wheel: create table M_VENDEDORES ( ID_VENDEDOR number (10,0) not null, NOME varchar2 (100) not null, CPF number (11,0) not null, ENDERECO varchar2 (100) not null, NUMERO varchar2 (10)…
-
2
votes1
answer173
viewsSqlite - Too Many levels of Trigger recursion
I’m getting the error below when I try to make an insertion in Sqlite. Error while executing SQL query on database 'BDTESTE': Too Many levels of Trigger recursion Table creation CREATE TABLE…
-
2
votes2
answers322
viewsInsert name instead of value option id
Write to Database //Ids $codEstado = filter_input(INPUT_POST, 'estado', FILTER_VALIDATE_INT); $codCidade = filter_input(INPUT_POST, 'cidade', FILTER_VALIDATE_INT); $codBairro =…
-
2
votes0
answers29
viewsHow to create a database with ibm cloud Storage and ibm cloud sql query
Good night, I am having trouble creating a database using these two IBM tools, I have already created the database on sql server and converted to CSV, after that I uploaded to Storage, but every…
-
2
votes2
answers129
viewsBest way for database normalization
What would be the best way forward regarding data normalization? The system will have basically three types of "people": Agency Collaborator Client These entities have some common properties, for…
-
2
votes2
answers857
viewsGroup By By Data
I have a table called tsc, with the properties ID and DataHoraOcorrencia. I need to check the amount of ID for DataHoraOcorrecia. SQL SELECT DataHoraOcorrencia as DataHora, COUNT(tsc.ID) as…
-
2
votes1
answer728
viewsPass hidden variable in php page redirect
I was doing a job and I need to finish my login on the login page, php redirect pro index along with a variable. In the login I made a select where returned me the nickname of the user, now I need…
-
2
votes1
answer41
viewsRails - Relationship BD
I have a table user, where I have a mandatory field cidade, and I have a table contatos (that is belongs_to: user), but the form does not have the field cidade which is mandatory to user. How do I…
-
2
votes1
answer237
viewsBottom Up Approach in Data Warehouse
Within the context of Data Warehouse(DW), I would like to know: Why is it correct to state that this approach (Bottom Up) does not guarantee standardization of metadata, and may create data…
databaseasked 7 years ago Jonathas B. C. 883 -
2
votes3
answers5576
viewsIncorrect daylight saving time on Postgresql
With the change of date of the start of daylight saving time this year, postgresql database are experiencing problems (as well as several other systems), going on to inform the timezone with dls…
-
2
votes1
answer150
viewsAre there classification metrics for the elaboration of SQL queries?
Doubt Have some method to sort in difficulty levels, an SQL query in easy, medium or difficult? This question may be a little subjective, but speculating may be a good option. Context I was…
-
2
votes1
answer118
viewsHow to use order by stop ordering month names in Oracle
Hello, I would like to know how to solve this problem. I would like to take the name of the days of the month and sort them and not the numbers of the corresponding months. Follow the query I…
-
2
votes2
answers2434
viewsIn terms of performance, "Character Varying" or "text" in Postgresql?
Before posting this question I scoured the internet to know the differences and performance of each type and I came to the conclusion that I should discuss a little more on this subject here with…
-
2
votes2
answers428
viewsHow to make a query that brings only the count of an uninterrupted sequence?
I want the counting of uninterrupted values of the current year backwards, until the first occurs NULL. Example: Several people make donations to an NGO annually and this is stored in a database,…
-
2
votes2
answers2825
viewsEmail confirmation of registration
I signed up with Cpf and email. I already put to validate Cpf and such, and I can send the email to the user who put the email there, but I need the registration to be done only if the email really…
-
2
votes2
answers1061
viewsWhat are real and practical examples in the use of Stored Procedures?
When participating in an interview for the position of developer, I come across a question related to Stored Procedure (SP) and at first I have theoretical knowledge on the subject, but I have never…
-
2
votes1
answer114
viewsIs there a canonical definition for database schema (schema)?
Each bank seems to define scheme (schema) in a different way. See for example the Mysql, the MS SQL Server, the Postgresql... Is there a relevant canonical definition or does only the individual…
-
2
votes1
answer66
views2 Groupby in a Mysql query
In Mysql I have a login table with the field day and User ID: 28-01-2019 - a 28-01-2019 - a 29-01-2019 - a 29-01-2019 - b 29-01-2019 - b 30-01-2019 - a 30-01-2019 - b 30-01-2019 - c What I need is…
-
2
votes1
answer513
viewsGrouping Data Preferably-MYSQL
I’m trying to group equal lines, but based on a value. I know it’s possible through a sub-query, but how I’m using inner join I couldn’t apply. SELECT * FROM Concessionarias C inner join…
-
2
votes0
answers67
viewsI can’t save photo in the bank
I am creating a web application that registers employees,and in this register there is an option to upload photo to link to profile, but when registering null arrives in the bank. Can someone help…
-
2
votes1
answer91
viewsWhat are the terms Weak Entity, Weak Relationship and One Optional/Mandatory?
I’m using an online tool yEd Live to model a MER diagram. However, there are some elements that use terms in which leave me with some doubts. Those terms are: Weakentity (rectangle) Weakrelationship…
-
2
votes0
answers39
viewsData do not send to the database
So, I created a CRUD class, the code is not returning any errors, but it is not being inserted in the database. I have tried to arrange several ways, but I can’t find any way. CRUD.class.php class…
-
2
votes1
answer1339
viewsHow to relate two "models" to Mongoosis?
I have two models in my comic book user js. var mongoose = require('mongoose'); var Schema = mongoose.Schema; var bcrypt = require('bcrypt'); // User Model var UserSchema = new Schema({ name: {…
-
2
votes1
answer223
viewsThe Object 'XXXX' is dependent on column 'XXXX'
When I try to change the type of the primary key of a table, I get the following error: The object 'XXXX' is dependent on column 'XXXX'. I would like to know how to "less" manual fix this error…
-
2
votes2
answers426
viewsView Mapping with Entity Framework
I am doubtful how to map a View created in Oracle Bank 11G with Fluent-API. Here is an excerpt from the view with alias: tran.id_transporte AS "ID Navio", tran.ds_nome_transporte AS "Navio",…
c# database entity-framework-6 fluent-apiasked 6 years, 9 months ago Samuel Renan Gonçalves Vaz 720 -
2
votes3
answers5148
viewsReturn BD data using List/Arraylist - Java
I have a problem, I set up a dynamic table in Postgresql and I need to print the lines of it, performing a method in Java, whose beginning is already pre-set. That would be with a List simple with…
-
2
votes1
answer98
viewsShould failed completed transactions persist in the database?
When I came across this statement I was confused, could anyone clarify? Question: One of the known properties in relational databases as ACID is the durability, according to which, in a successfully…
-
2
votes1
answer50
viewsDoubt in VBA Excel 2013
I have this bit of code: Range("F8").Select For Each m In Range(Range("C8"), Range("C" & rows.Count).End(xlUp)) If ActiveCell.Offset(0, 0) <> " " Then ActiveCell.Offset(0, 7) =…
-
2
votes2
answers682
viewsDoubt between using composite primary key or not in the associative table
I’m making a relationship where the same is N:N... Example: Projeto x Funcionario In this relationship I create an associative table called Projeto_Funcionario leading the id of the two classes.…
-
2
votes1
answer100
viewsRedeem Firebase information on a Textview on Android
All right people? I would like to rescue the information from Firebase in a Textview on Android. I can already enter the information in the Database, as shown in the following image: I would like to…
-
2
votes1
answer308
viewsSQL - Transform different values of a Column into multiple columns with Count in each of them
My question is how to separate different values of a column into several columns and give a Count in each item according to the name in postgres, follows example below How are you: --TIPO…
-
2
votes1
answer689
viewsRemove accents from an array
I have a select in which it is completed through a bank query: <select class="form-control" name="select_cidades"> <option>Selecione a Cidade</option> <?php $result_cidades =…
-
2
votes3
answers86
viewsProblems with SELECT RIGHT JOIN
I have two tables, A and B. Na Table A, I have a column with names of machines (Cutter, Baler, Packer and Rewinder) and in the other column some causes that made them stop (As Lack of Electrical…
-
2
votes1
answer120
viewsCalculating rates in R
I have the following dataframe: data <- data.frame(Individuo=c("1","2","3","4","5","6"), Sexo=c(2,4,4,2,4,2),Ocupaçao=c(1,1,2,2,1,2), Raça=c("Branco","Negro","Pardo","Branco","Pardo","Branco"),…
-
2
votes1
answer255
viewsHow to make a weekly mysql query
Good morning everyone! I would like a Help!!! I am in doubt of how to make a weekly mysql query, starting on Monday and ending on Sunday, and the data will be inserted every day, and from the data…
-
2
votes1
answer453
viewsDelete Rows in several tables dynamically in Postgres
I need to delete to clean the database automatically in tables that are within different schemas, "public" and "cine"; I have the following query that returns me SELECT concat('"',table_schema,'"',…
-
2
votes2
answers720
viewsSQL SERVER | Fill empty fields in select
I have a select in a table: select a.linha, a.NUM_LCTO, a.DT_LCTO from arquivo a order by 1 That returns me the values as follows (I put only a few lines, the total result is about 800000 lines.):…
-
2
votes1
answer350
viewsHow to concatenate a variable plus a message in the "Insert"?
Concatenate a variable and a message in the insert? Example: declare a int; set a = 2; insert into tb_usuario values ('a' + 'fez tal coisa');
-
2
votes1
answer394
viewsChange the type of a column in several tables in SQL Server
I have a database with 41 tables, in all tables I have a common column to which I would like to assign another dataType. In my case the column is currently varchar(255) and would like to change to…
-
2
votes1
answer54
viewsI cannot list a table in php
I cannot list a simple table in php... I don’t see what’s wrong with the code, when I run this php code just shows me a blank page... What I’m doing wrong? <html> <head>…
-
2
votes2
answers226
viewsLaravel and Sqlite database
Think of me, you have server Laravel with a Sqlite database configured, access to this database in thesis is to be faster, since it is on the server itself. Follow the example: user -> server…
-
2
votes1
answer70
viewsWhat kind of data to accept any size?
What kind of data can I use to store text "dynamically" in SQL Server? I know that CHAR and VARCHAR are character data types, the difference is that CHAR is a type of data fixed length and VARCHAR…