Most voted "sql" questions
Structured Query Language (SQL) is a language to query databases. Questions should include examples of table code and structure. This tag refers to the default language, not to be used for questions about the implementation of specific DBMS (such as Mysql, Postgresql, Oracle, MS SQL Server). In this case use the specific DBMS tag. Answers to questions marked with ANSI SQL should use SQL as much as possible.
Learn more…6,771 questions
Sort by count of
-
0
votes0
answers327
viewsHow to create a new database in ORACLE?
I installed oracle database, oracle client e sql Developer num windows 8.1 64 bits. With the installation of the oracle database, a database was created at localhost:1521 But now I would like to…
-
0
votes1
answer174
viewsPopular Datagridview with Entity Framwork
I have in SQL Server a database called STORE; In this database I have a table called Funcio, it contains 5 columns and they are respectively: Name, CPF, Date, Date issued, Idfuncionario. In my C#…
-
0
votes1
answer74
viewsHow to make an Insert in this table
I have a registration of vehicles, which has a combo box with the years for the user to choose, these years come from the table "year". When I complete a registration of a new car, I have to give an…
-
0
votes1
answer920
viewsDifference between hours without taking into account the date
Good night, I have the following code: WITH CONSULTA AS ( SELECT V.CHAPA, V.DATA, MAX(V.BATIDA) AS MAXBATIDA, MIN(V.BATIDA) AS MINBATIDA FROM ARELBATIDATRANSITOVIEW AS V WHERE V.CODCOLIGADA = 1 AND…
-
0
votes2
answers2012
viewsCan I have a settings table without Primary key?
In a database, this table will be for storing information and will have only one line, and there may be updates and will initialize null and during the course of the program will be added. Is it…
-
0
votes1
answer76
viewsHelp in SQL ORACLE query
Column DEPENDENCY: T - Titular; E - Esposa; F - Filhos; FA - Filho Adotivo As table above, how do I bring data only of CEP S that are divergent as the CEP of the Holder: Titular Admilson has 2…
-
0
votes0
answers102
viewsCalculated field
Good afternoon, I have a database made using the phpMyAdmin tool, but based on SQL. The database has a table that has a calculated field. The table has 6 records, but when I do the command for the…
-
0
votes2
answers2189
viewsHow to delete all records from the database
Good afternoon, in my application has a database that shows the results of the game, I put a button that its function will be to erase all the data of the bank... how do I do this part? in the blogs…
-
0
votes1
answer1197
viewsSELECT to filter null value?
I’m trying to make a SELECT in a table conta, in this table I have a foreign key to the table venda, in certain cases this foreign key is null and I want to return the information of the sale when…
-
0
votes0
answers177
viewsLiquibase. sql file not found
When I run liquibase it does not find . slq files configured by tag. Sqlfile. how to solve this? Data from the problem: Design use of liquibase 3.4.2. Configured the Maven plugin Execute script in…
-
0
votes1
answer475
viewsHow to insert data into another table from the foreign key?
I have a table in my database called imoveis where I have some columns, standing out localizacao_fk and correspondencia_fk, both foreign keys that reference the table enderecos. What I want to know…
-
0
votes1
answer2401
viewsHow to convert a varchar type from a column to datetime within a view using SQL?
I have a view with a varchar type column and I want to convert this column to a date time type my code is here: update temp_vertical_dashboard set data = convert (datetime,data,101)…
-
0
votes0
answers139
viewsField calculated in Java
I’m doing a project in Java and I have a data base with two tables and one of them with a calculated field. The calculated field is of type "time" and was done with the command UPDATE nome_da_tabela…
-
0
votes1
answer632
viewsSQL to check skipped number
I have a table with 12,560 records from 5 years ago, that is, it does not have such a good modeling and it has a field called 'code' that the user filled with something like CA-0001. The problem is…
-
0
votes1
answer102
viewsKnow Count() output in query
I have the following query on Pdo: $ranking = $pdo->query("SELECT * FROM usuarios GROUP BY moedas ORDER BY count(moedas) DESC LIMIT 3"); I use this to make a ranking to know users with more…
-
0
votes1
answer106
viewsPull the last information from a table
I wanted to know how to pull the last information that was registered in the bank, but I can’t use the ID. in my Route table have the columns Id(PK), Date, Current Km_and Nveiculoid(CK). In this…
-
0
votes1
answer459
viewsSpinner.setadapter on a null Object Reference
The array of players is filled with the dice but gives error in the method setadapter. Spinner spinnerJogador1; ArrayList<JogadorModel> jogadores = jogadorRepository.SelecionarDisponiveis();…
-
0
votes2
answers1587
viewsSQL Syntax Error in FK Creation
I’m looking to add a foreign key on the table CONSULTATION Only Mysql reports the following error: 1064 - You have an error in your SQL syntax; check the manual that Corresponds to your Mariadb…
-
0
votes1
answer138
viewsFirebird 2.5 Query of a trial
I am using this code to bring all calls from previous months being -1 last month, -2 the month before last month, but I need to bring the 3 results ( -1, -2 ,-3 ) which I must modify ? SELECT COUNT…
-
0
votes2
answers416
viewsComparison of two dates using Mysql varchar type
I have a question regarding the preparation of an SQL query in which I pass a registration date and check if it is bigger than the current date, but I have a problem the registration date is varchar…
-
0
votes0
answers38
viewsPrimary key and index in SQL
I have a table where the Primary Key user_id is used as query parameter, need to set this field as index to improve query performance? Or only as Primary key is sufficient for such?…
-
0
votes0
answers94
viewsSQL - AVG with vendor alias and grouping
I need to create a query that calculates the average of a vendor delivery "score". It follows query, and in sequence, explanation of the fields: SELECT distinct C7_FILIAL, CASE WHEN C7_FILIAL =…
-
0
votes1
answer328
viewsSelect with multiple Left Joins
I performed a LEFT JOIN considering as attributes (CPF, TEL1, TEL2 and TEL3). Why all these? Why the field CPF often returns zeroed in one of the bases, so I’m considering the phone fields as well.…
-
0
votes0
answers41
viewsHow to save values from an array to a database?
I’m creating an Android app for tcc. I have 3 vectors: coorx[i]; coory[i]; busy[i]. This Busy vector is not fixed, so the values were changing according to what the user requested. Then I would have…
-
0
votes2
answers374
viewsQuery bringing duplicate items + product code
Hi, I’m performing an SQL query on my Firebird server. I made the query using the following syntax: select ds_produto_servico, count(ds_produto_servico) from tb_produto_servico group by…
-
0
votes2
answers150
viewsIs it possible to apply to different computers simultaneously performing CRUD?
I am creating an application in C# using Visualstudio 2015 Enterprise together with SQL Server 2016 to save the data, but I’m almost done with the project and I still don’t know if it will actually…
-
0
votes1
answer6085
viewsRename entire Mysql Database
I wonder if it is possible to rename a whole Mysql database I have the Database Register with the people table I would like to rename registration to CAD_CRS It is possible?…
-
0
votes1
answer108
viewsAdd images in the bd using classes in c#
i am doing a project that has classes, for example, a User class, where you have :code, name, password and photo and you have the user input method: public string Inserir() { return "insert into…
-
0
votes1
answer1222
viewsQuery in two tables with Count
I have a table in mysql that has a number of contracted items. Table itens_contratados id_hired Item Qty contract Table servico, in this I inform the service I performed in the contract id_hired I…
-
0
votes1
answer503
viewsPerform condition on Trigger
I have a Rigger that updates my table. I wanted to know how to make Trigger only run if the status column is different from the one already in my table, if it is the same nothing happens. DELIMITER…
-
0
votes0
answers193
viewsIn which table does wordpress store the layout of posts?
I need to update old posts with a new layout, I was wondering in which table of the wordpress database is the layout of the posts anyone has idea? , Obs have to change without being by Adm panel, It…
-
0
votes1
answer384
viewsFunction regex blank spaces SQL Server 2008
Hello, Within a specific table in my DB, I have certain fields that were registered by someone else (users), so some fields instead of having a single space ' ', has spaces of the most diverse…
-
0
votes1
answer119
viewsView wordpress posts with SQL
I’m making a static site, where all the files are in PHP, however this site has a blog that should be manageable by Wordpress, then you ask me and pro what not to do everything by Wordpress? because…
-
0
votes1
answer84
viewsProblem with Combobox - Systemdatarowview
I have a problem. My software has an order registration screen and in it there are some Combo Box that pull certain information according to what is selected in the Product (Cake, Candy or Cupcake)…
-
0
votes1
answer137
viewssubconsulta with 3 different tables using ilike in postgres
I’m having a question. How do I search a given text using ilike to know if this text exists in 3 related tables. ? I tried to exist but it did not give CREATE TABLE metodo ( id SERIAL NOT NULL,…
-
0
votes1
answer71
viewsInconvergence of consolidated results x by interval
I am making a query for 10 minutes interval between date, the problem is that when I give a between to count all the results it returns a value and when I divide these values by interval and sum at…
-
0
votes2
answers324
viewsInsert ID into Table with 13,346 lines with LOOP
I need to update a table with 13,000 lines. And this table contains a field called "faixa_cep_id" and all ids are 0. I need to update this with a loop to not duplicate the fields (EX: 1, 2, 3,…
-
0
votes1
answer100
viewsSQL query is not grouping
I’m new in SQL and I’m trying to group the data as query below, however, is not grouping. The correct one was to leave, for example select left(P.ProjDesc,6), COUNT(P.ProjID) from Projetos P where…
-
0
votes1
answer494
viewsDoubt - Query (Do not bring a particular record)
Good afternoon Galera! Next, below is a query where it was to bring all the calls that has the description ''Block Client - Delinquent' and with id = 572 (blocked clients), however, this query has…
-
0
votes1
answer252
viewsIncreasing column sorting, but per result row
I have the following table structure and results: I need to create an efficient instruction able to sort the values in ascending form, but they should be sorted by column/row and not only by column.…
-
0
votes1
answer54
viewsView user information on another page
I have a login page (login.php) and one that I would like to display all user data (profile.php), I searched and saw that using Sessions this would be possible, I made the code, based on the…
-
0
votes1
answer45
viewsPDO help using Mysql
I’m having trouble connecting the database using PDO, use Mysql. when executing the connection with the bank appear the following error messages: Fatal error: Uncaught Exception 'Pdoexception' with…
-
0
votes1
answer92
viewsMy SQL does not find accented words
My SQL works perfectly when the word to be searched is not sharp, however, when the word is stressed, there is no result in the search. My database is mysql and in the php admin I made the…
-
0
votes1
answer56
viewsUpdate in a table row
I’m starting to use the Sqlite on a project and would like a help on how to do the update in a specific line, in this case, only one "ID" will be updated at a time. Follows the codes: View and where…
-
0
votes2
answers2936
viewsInsert special mysql characters and pull these identical values in the web application
Good evening, I need to add values to the database by mysql so that they have special characters. I can add, but I can’t pull the values correctly, they end up coming with symbols in place of the…
-
0
votes4
answers2146
viewsSQL - Draw random lines
Given the table as an example: I want to draw, between the lines with the same order number, a single line, that is, one of order 1, one of order 2 and one of order 3, randomly. I need a generic…
-
0
votes1
answer50
viewsDATASTAGE ODBC query get current_timestamp
I am doing a job in Datastage and when I enter the query in ODBC I need the Current timestamp, and it always passes me to null when writing in the table. I’ve used CURRENT_TIMESTAMP,…
sqlasked 7 years, 12 months ago Rafael Ribeiro 1 -
0
votes1
answer37
viewsMap tables to save access history
I have an application, in which I need to save at least once on the day, the date and time that user accessed the application/ system. Because we charge at the end of the month for the number of…
-
0
votes0
answers67
viewsTrigger mysql - error?
Hi, this is the first time I’m using triggers and I don’t know how to fix an error I’m having and a problem I don’t know how to do. I want to do a Rigger for when a date entered (start date and end…
-
0
votes1
answer719
viewsExtract and include SQL data with R
I am designing an SQL database that will have tables that store collected data and a table that stores calculated indexes of this data to be later exposed on a Dashboard. I intend to calculate these…