Questions tagged as 'sql'

1
answer

Do SELECT with average user ratings

Well, I'm developing a project and it has the list of people, I would like to list them based on the average of the evaluation, I tried to do with INNER JOIN and AVG, but with them they will not show users who have just registered. The SELECT th...
asked by 08.11.2018 / 13:02
1
answer

Copy table column A to table B sql

Good afternoon, folks, I have two tables and I need to do a SELECT to bind the code of cities that are in table B to the cities of table A. I'm using the query: select a.Cidade, b.Cidade, b.cod from tabelaA a left join tabelaB b...
asked by 08.08.2018 / 23:04
1
answer

Doubt over Encrypt Password - SQL Server

I am developing an ASP.NET MVC system, SQL Server database, which will have logins control, and to encrypt the password, I have developed the following functions and procedures: CREATE FUNCTION [dbo].[ENCRIPTA_SENHA] ( -- Add the parameter...
asked by 16.08.2018 / 16:47
1
answer

Script to change table names in the PostgreSQL database

I have this script: SELECT n.nspname AS schema_name, c.relname AS table_name, c.reltuples::int AS num_reg FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace LEFT JOIN pg_tablespace t ON t.oid = c.reltablespace WH...
asked by 02.10.2018 / 04:47
3
answers

I can not sum the column

I want to sum the Value column, I know that in order to use SUM () I have to use GROUP BY as well, but I can not do the summation. I do not know what fields I have to put in GROUP BY. SELECT DISTINCT z.sales_office AS kam, z.customer,g.sales_o...
asked by 25.09.2018 / 14:44
2
answers

update sql relating a column with external value

Good morning, I'm having a hard time doing an SQL Server update. I have the following situation: Table 1 ID Codigo Table 2 ID Nome And I have an excel file like this: Excel Codigo Nome I need to update the Name colum...
asked by 25.09.2018 / 14:40
2
answers

Add a column with data in Varchar2 format [duplicate]

I want to add the sum of the Value column that is of type Varchar2, I know that to use SUM () I have to use GROUP BY as well, but I can not do the summation. I do not know what fields I have to put in GROUP BY. SELECT DISTINCT z.sales_office...
asked by 26.09.2018 / 14:06
1
answer

SQL Alphabetical ordering with html code

I have a table that contains the titulo field. I have a query and I want to sort alphabetically by it, however, some fields are with HTML codes, I'll give examples:    Goat slaughtering and meat processing       Slaughter and Commerci...
asked by 18.07.2018 / 16:43
2
answers

How to dynamically get a specific day in a query

I would like to get the last day of the previous month in a dynamic way. I do not know how it is that I will by wo.createdtime <= Moth(current_date) something like that and this is in milliseconds, it complicates even more. If anyone c...
asked by 10.07.2018 / 21:58
1
answer

Database query error - invalid number

Good afternoon. I am having trouble in a database query. Performing this returns this error: ORA-01722: número inválido 01722. 00000 - "invalid number" *Cause: The specified number was invalid. *Action: Specify a valid number. My cod...
asked by 05.07.2018 / 18:33