Questions tagged as 'sql'

2
answers

Which object performs best? SqlDataSource or DataTable?

In terms of performance, speed, or security, what is the best object to use as a DataSource ? Example, I am creating a DataSource , to popular a GridView : By SqlDataSource : this.sqlDataSource1.ConnectionName = "...
asked by 27.07.2016 / 15:35
2
answers

Doubt referring to Count in SQL command

I need to count the amount of supplies available in stock according to your codigoSuprimento , so I created the following sql command: select count(codigosuprimento) quantidade, codigosuprimento from public.estoque where usado = '0' grou...
asked by 22.08.2017 / 16:11
1
answer

How to put quotes in a variable for MySQL query

I'm doing a procedure, I need to put a varchar variable in the query, but it does not go with the single quotation marks, I've tried concatenating it or something like that, but it's no use: set @comando := concat(@comando, '"'); //ao contrári...
asked by 09.10.2018 / 21:33
3
answers

Relationship between tables

I have the following tables: TB_ESTOQUE |COD_PRODUTO|QT_DISPONIVEL|COD_FILIAL| | 0856322 | 5 | 41 | | 0856351 | 2 | 41 | | 0856322 | 9 | 114 | | 0856720 | 3 | 20 | | 08563...
asked by 09.10.2018 / 16:41
2
answers

SQL Command in String MySQL

I'm doing a procedure that holds a select in a varchar variable. Now I need to run this sql command, how do I do this? I'm using MySql. Procedure: delimiter $$ create procedure eixos_caminhao (in numeroEixos int) declare comando varchar(500);...
asked by 09.10.2018 / 17:42
2
answers

PDO does it use syntax of some DBMS or do they all work?

When considering PDO usage , one of the key usability is the scope of multiple databases . Example scenario Different ways to filter 5 records, which vary depending on the database: SELECT TOP 5 campo FROM tabela SELECT campo FROM ta...
asked by 03.10.2018 / 13:35
3
answers

Spring Data JPA does not recognize the SQL 'Limit' command?

I'm creating a REST API, using Spring Boot, which, using data from a table, displays random phrases. Giving a Google, I discovered that it is possible to generate random results through pure SQL: SELECT <coluna> FROM <tabela> OR...
asked by 31.10.2018 / 06:21
1
answer

Java - SQL Error Updating All Users

Good morning, I have the following problem my updateUsuario SQL is updating all how do I just update the User that you have accessed? public class Acessar { public static Connection con = dao.ConectarDB.getConexao(); public static String...
asked by 02.12.2015 / 11:43
2
answers

Delete sectors and their descendants - PHP

I have the following table structure: CREATE TABLE IF NOT EXISTS 'setores' ( 'set_cod' int(10) NOT NULL AUTO_INCREMENT, 'set_base' int(10) NOT NULL, 'set_setor' varchar(50) NOT NULL, 'set_data' timestamp NOT NULL DEFAULT CURRENT_TIMEST...
asked by 08.08.2016 / 21:46
2
answers

Multiply the number of elements from two different tables

I have two tables: pessoas and carros . I would like to take the number of elements of both tables, and multiply them.     
asked by 12.08.2016 / 19:03