Questions tagged as 'sql'

1
answer

SQL command in MYSQL

I'm creating a DBA and I need to do a CHECK on an index of my produto table, but I'm using MySQL and am having a syntax problem. Follow the example: CREATE TABLE produto( Cod_produto int primary key not null, nome_produto varchar(5...
asked by 25.08.2017 / 15:41
3
answers

Sum of a column is not giving the expected value

I have a dummy table with two columns and some data in it, depending on the image. When I execute my following SQL statement, the result of the query is 22. The result should not only be 12? I could not understand why. Could anyone e...
asked by 24.05.2017 / 03:04
1
answer

Making quick queries [closed]

How can I make queries faster on a MySQL table with 3 million records, the table has only 4 columns, and it takes me almost 5 seconds to return data. The fields I'm searching for have index . The Query returns close to 50,000...
asked by 28.10.2016 / 11:19
4
answers

GROUP BY and ORDER BY MySQL [closed]

When I send Query: SELECT * FROM tabela WHERE id_cliente = '$id_cliente' ORDER BY ano DESC Duplicate values are returned, because there are duplicate values in the table. But I want to return only once every year contained in the t...
asked by 11.07.2017 / 20:08
1
answer

List Database with Java or PHP [closed]

I would like to know if there is any way for an application to show all the databases of a connection? I currently use the command: select * from information_schema.TABLES;     
asked by 13.08.2017 / 17:52
1
answer

Color in a SQL query

I would like to put a com in a SQL query for example: wp_usermeta.meta_key = 'first_name' or wp_usermeta.meta_key ='last_name' Would you like to put red here 'last_name' is it possible? Follow the complete query code: $sql = ("s...
asked by 13.07.2015 / 10:22
1
answer

Refresh warning screen [closed]

I am developing a stock control system and front of box and I intend to create a warning screen in the main form (it can be with datagridview), where, if when selling certain product and it reaches the minimum stock limit, then the warning scree...
asked by 06.01.2017 / 02:13
1
answer

How do I make messages in Javascript etc, when a warning appears?

I want to know a code that when the person clicks on an OK button to appear a warning: "You are logged in!". If you do not get a warning: "You are not in the system, enter your Access information correctly!". Would you help me?     
asked by 05.09.2018 / 15:50
1
answer

Column not found using ALIAS in laravel

I'm having a problem while accessing a column in the laravel query builder, the following code works in the Sql Workbench. Vendas::selectRaw('if(faturamento.Codfaturamento is null, vendas.totalvenda, faturamento.valor) AS vlrFatura') -...
asked by 03.10.2018 / 21:54
1
answer

how to fetch table values in C # [closed]

I have this following code, how do I return what is in the user field of the user table? public int GetPerfilId(string username) { int result = 0; if(db != null) { DAL.Utilizador uti = db.Utilizador.Where(u => u.u...
asked by 05.05.2016 / 16:47