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
votes0
answers472
viewsHow to update php correctly
Hello I am making an administrative panel where the administrator can edit the Name, User and email but it does not perform the UPDATE in the database but in the message it says that the update…
-
1
votes1
answer516
viewsPassing Date parameters for queries
I am having a problem when passing a parameter. I tried to debug by passing the Date as `string, but the problem arises that one expects a number instead of a character. After that I searched other…
-
1
votes0
answers32
viewsRun ALTER on a PROCEDURE that is referenced by another object
I’m trying to change/drop the function [xxxx] according to the code. But the following error returns to me Msg 3729, Level 16, State 3, Procedure xxxxx, Line 1 [Batch Start Line 15] Cannot ALTER…
-
1
votes1
answer1000
viewsConversion from . FRM to . SQL
I have a 300MB database and all I have are the FRM, MYI and MYD files. I need to convert the FRM files first to create the structure of the tables, I have already used the following tools and…
-
1
votes2
answers42
viewsGraph error in R: "invalid color name"
I’m working with the data set starwars, package dplyr. My goal is to create a chart with this data, where the independent variable is the height of the characters, and the dependent is their body…
-
1
votes1
answer51
viewsError: android.widget.Linearlayout cannot be cast to android.widget.Gridlayout
I’m trying to make an android app that lists the components coming from the bank. The error is as follows: Androidruntime: java.lang.Classcastexception: android.widget.Linearlayout cannot be cast to…
-
1
votes0
answers27
viewserror in Session Codeigniter
I have a dynamic menu that does a search in the bank and fills this menu, when I’m at home it works normally but when I change the page the value returns null and generates error in count(), I…
-
1
votes1
answer48
viewsHow to Capture Data with Pandas?
I work with a database that uses frequency, and I want to analyze the frequency data and transform it into several lines. Follow image example: I want to make line 6, for example, become 6 equal…
-
1
votes1
answer43
viewsTime mask HH:MM from a number type field using oracle sql for reporting
I have a query that I use to report hours worked, I tried to use to_char and some other examples I found in stackoverflow. SELECT CASE WHEN BC.ENTRADA1 IS NULL THEN 0 ELSE…
-
1
votes1
answer67
viewsHow to make a query in SQL that brings a count of some results
Next, I am developing a query in SQL and the purpose of this query is to Count the records that reached the value below 99,7%(As I have the data for this already calculated and transformed in…
-
1
votes1
answer20
viewsCompare SQL Server users to AD users
I need to raise users of an instance that no longer exist in the AD for cleaning these. Is there any way to compare AD users with windows Authentication users of an SQL instance?
-
1
votes2
answers159
views -
1
votes2
answers289
viewsAdd a column with data in Varchar2 format
I want to sum up the column Value that is of the type Varchar2, I know that to use the SUM() I also have to use the GROUP BY, only that I am not able to make the sum. I don’t know which fields I…
-
1
votes2
answers53
viewsHow to update a data when the date entered is equal to the current date?
I’m making a system where the user can schedule posts, IE, if he enters the date and time, the post will be released when the current date is equal to the entered, until then the logic is simple but…
-
1
votes1
answer50
viewsQuery with field as IN value
I’m trying to do a survey using INNER JOIN in table service, the scheduler field.serv_id is a string "vector" and its value in the database is: '1, 2' I did 3 Indsert’s in the service, the only…
-
1
votes2
answers70
viewsHelp with an associative table of friends
I have a table of friends, which has the following composition: id_friends (id of the relation) id_usuario_de (id of the user who sent the friend request) id_usuario_para (id of the user who…
-
1
votes0
answers57
viewsProblem with PHP/Mysql Registration
good morning/afternoon/evening. I have a problem on my TCC site, specifically in the user registration. In the register, has 3 parts, one of personal data, one of phone and another of address, with…
-
1
votes2
answers324
viewsSQL Select return only one of several
have two tables. Table "user" which has 5 lines and 5 users. is the "location" table that has 20 records, using 5 Foreign key of user table ID When I use this select I made select u.nome from…
-
1
votes1
answer182
viewsSelect with PIVOT always returns null
I’m trying to do a query using the pivot based on this link insert link description here, but without success, as it always returns 2 Null lines: Query: DECLARE @registros as table ( ID int, Campo…
-
1
votes1
answer720
viewsHow to add sql values in column
I have the following sql code: select PS.PatSldBemValResidAnt ,PS.PatSldBemValDepAcum ,Sum(PS.PatSldBemValDep) PatSldBemValDep ,Sum(PS.PatSldBemValResid) PatSldBemValResid from Pat_Saldo_Bem as PS…
-
1
votes0
answers302
viewsYou have a syntax error in your SQL next to’T FOREGN_KEY_CHECKS=0' in line 1
I don’t know much about databases, so my knowledge of sql is minimal. A friend passed me a db so that I could edit and update the data of this (something that seems simple to me), but when trying to…
-
1
votes1
answer90
viewsInner Join with Where and multiple tables
I am mounting a query, where I need to Join between two tables (because the data will be in the main B but not in the complementary BC) and a third table that necessarily need data, which will…
-
1
votes1
answer136
viewsSELECT to fill in a field
Good afternoon, I have a table called Pessoa and another Matricula, I need to make a query that returns the fields to me name, license plate and person of them, where name and person are on the…
-
1
votes1
answer83
viewsPostgresql - Trying a rollback in a function
The structure of relation between tables presented below is not the most convenient and technical. Just to illustrate what I need. I have read many articles about Function, Trigger functions and I…
-
1
votes2
answers49
viewsUPDATE only in the last inserted rows
I’m importing some Excel spreadsheets via ETL into a relational database. The problem is that in order for me to achieve the relationship of the tables, I am using queries for the insertion of…
-
1
votes3
answers143
viewsC# - Know location of database file dynamically
I am making a program using C# in WPF, and I need to access the database dynamically, in this case I am using a .mdf.file. In code I have connectionString like this: string stringConexao = @"Data…
-
1
votes2
answers210
viewsSQL Server foreign key is giving null value when entering data in the main table
Good! I’ve been learning sql for about a week now and I’m having some problems understanding how Foreign Keys work, specifically by creating Inserts in an application where Foreign key(foreign key)…
-
1
votes1
answer150
viewsMultiple applications consuming the same database
Today I have an application that uses a database (Mongodb), but I have few users yet and as we know it is very difficult to have an application that is successful and accumulates many users.…
-
1
votes1
answer38
viewsReturning error in insert function
Good morning. My function is returning an error, but I don’t know what you mean, I used the Singleton standard to do, so I will post 2 codes: <?php class IndicadoDAO{ private $idIndicado; private…
-
1
votes0
answers29
viewsSqlite does not input data into the database during an Asynctask
I’m trying to add data to DB inside an Asynctask. In it I catch the Inputstream coming from an httpURLConnection, I interpret the JSON and saved in the local Sqlite. But I don’t even know if this is…
-
1
votes2
answers52
viewsBD sales record
Good morning. I’m making a sales web app, and I want to return the sales ID to insert into the intermediate sales table (multiple products in 1 sale). I tried that way, but obviously I couldn’t:…
-
1
votes1
answer224
viewsPostgres: Error converting date in Postgres 10
When I perform a date conversion on postgres 9.6 that I have on my machine, it fixes the date if it is invalid, the same is not happening on postgres 10 that is on another machine: Postgres 9.6…
-
1
votes0
answers201
viewsError while restoring mysql backup
Good afternoon Personal. I have a problem related to the backup and restoration of data from a Mysql database. I generated a backup of the data using mysqldump to format the pc and install a new…
-
1
votes1
answer162
viewsINSERT WITH JOIN DUPLICATING DATA
Hello, I have these 3 tables in my database: Table colaboradores Table cursos Table c_vendas_itens I would like to make a Join of the three tables and save in another one, I can do this through the…
-
1
votes1
answer381
viewsBring last date of SQL Product
I am performing the following consultation to bring the products with their last sale date: SELECT P.ID AS 'Código', p.Nome, CONVERT(decimal(18,2),pe.Valor_Custo) as 'Custo',…
-
1
votes1
answer97
viewsModeling teaching offer database
I’m studying databases and I’ve come up with a problem that I’m not getting out of. The problem is: "A school conducts education level offerings annually. Each year, one or more levels of education…
-
1
votes1
answer48
viewsReturn least repeating records
I have a table registro structured 'id(AI)', 'b1(INT 2)', 'b2(INT 2)', 'b3(INT 2)', 'b4(INT 2)', 'b5(INT 2)' which receives the values entered in the FORM of the insert.php page, example how data is…
-
1
votes1
answer181
viewsHow to avoid access to the database?
The perfect world would be that no user (company employees) had access to the production bank and this is my goal, only I do not know what the steps to get to this point. Today the devs have a…
-
1
votes1
answer1695
viewsSQL how to select in 2 different columns
I’m trying to make a SELECT to select 2 different columns from the same table, example: id | name | tags ----------------------------------- 1 | acao | null 2 | aventura | null 3 | rpg |…
-
1
votes2
answers240
viewsHow to sort a table according to data from another table
I have two tables Table 1 create table tb1 ( cd_tb1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY ); Table 2 create table tb2 ( cd_tb2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, cd_tb1 int, vl_avaliacao…
-
1
votes1
answer37
viewsControl the data that Mysql sends to Nodejs
I developed a Project that "clones" a proposal and its products, in addition to making some updates, but the return that this procedure returns to my Nodejs is not very useful to me. It is possible…
-
1
votes1
answer56
viewsDatabase error that appears when updating the page - SQL server
I have a system made in CODEIGNITER where several users access simultaneously, and lately I’m receiving complaints that on several pages of the portal, appears the following error: "Unable to…
-
1
votes1
answer179
viewsRemove method does not work, nor returns error
My method remove does not delete the record on BD. And, worst, returns no error, nor executes the query (except for Select, I think it’s normal). I used the prints to know if the object was arriving…
-
1
votes1
answer525
viewsInner Join in Procedure
I am creating a small database on SQL Server, for an ASP.NET mvc project of my course. Using ADO.NET I am creating procedures, to use in my DAL class, so far everything well has a lot of information…
-
1
votes2
answers422
viewsFinding students without a class - Python / Excel
I have a spreadsheet in Excel with all my students and their respective grades (5th to 9th). I need to find all my students who aren’t in any class. Through the Excel filter I can do, but I have…
-
1
votes1
answer55
viewsHow to know which columns were modified in an UPDATE using TRIGGER?
Good afternoon, everyone. I am creating a TRIGGER AFTER UPDATE in a table in the BD, and I need to know which columns were changed (regardless of the value that was placed), and put the column names…
-
1
votes2
answers313
viewsCalculate the average of a field in a specific year within a period
I was studying queries in mysql using the Employees demo database (link), when I decided to do a search in the table salaries than would be a report of how much the company spent per year on wages.…
-
1
votes1
answer232
viewsProblem with Mysql Pool conections
I have this class I use to create the connection: class DbConnection { constructor() { this._con = undefined; this._pool = undefined; } _createPool( database , user, password ) { this._pool =…
-
1
votes2
answers74
viewsSQL query, count the amount of existing values of a Foreign Key for each corresponding Primary Key in 1 query
Example with 2 tables: table admin: columns: | id_admin | email | password | values: | 1 | ex@ex | 123 | | 2 | ex2@ex2 | 123 | table news: columns: | id_news | title | content | admin_id_admin |…
-
1
votes1
answer8888
viewsConcatenate columns in SQL SERVER
I need to concatenate 3 columns in a row using SQL Server, when I concatenate it returns this value: Would have to stay: Moura 105ah ground floor I’ve seen some examples on the internet, but I…