Questions tagged as 'sql'

6
answers

Perform INSERT INTO query with SELECT DISTINCT with data from 2 tables

I need to insert values in a table by SQL query that selects the different id_cliente that exist in the table Clientes with its amount and the rest of the fields in the table Facturas adding 1 to field num_factura (...
asked by 11.08.2016 / 14:09
2
answers

Queries with hours in SQL Server?

I have a question about how I can make queries in SQL Server with hours fields. I have a column called hora_inicio_prestamo and another hora_fin_prestamo , both of type time(0) , I also have a column called Estado_presta...
asked by 07.04.2017 / 03:05
3
answers

Help with the logic of a query for MySQLi

Greetings guys I have the following sentence: $query = "SELECT * FROM pedidos WHERE usuario = '$usua AND status_pedido = 'ESPERANDO' "; Just as it works perfectly but I would like it to also select if the condition is met status_qualifie...
asked by 10.10.2018 / 16:10
3
answers

LINQ query in .NET VISUAL STUDIO

I need to translate the following query from SQL to LINQ in .NET with C #: This is the SQL query to translate: SELECT COUNT(id_documento) FROM documento I need the value to be stored in a variable or to capture the n...
asked by 08.04.2018 / 06:09
2
answers

SQL 60,000 records in less than 3 minutes

Today I have an optimization question, my boss wants me to save 60,000 records in the shortest possible time. For this I have made a query that takes information from a .csv file and I put it on a temporary basis, from which I make a small fil...
asked by 23.08.2018 / 19:38
1
answer

what is the limit of an id, in database?

I have a database in Postgres that is already running a week and the amount of data entered is 3788, this number reflects the id of my table, plus I am informed that this amount is similinar per week. I create the id in t...
asked by 01.04.2018 / 00:54
1
answer

UPDATE from a SELECT using SQL Server

In SQL Server, it is possible to make a INSERT INTO to a table using a SELECT : INSERT INTO tabla (col, col2, col3) SELECT col, col2, col3 FROM otra_tabla WHERE sql = 'ok' Is this also possible for a UPDATE ? I have a...
asked by 09.02.2017 / 17:21
2
answers

Is there a "time" type that represents such that HH: mm in SQL?

I am a SQL beginner and I am creating a table, my doubt is that I have defined my start time and end time as VARCHAR2 to enter a time, which correspond to some classes (of a gym), that it would be more correct to create it with some type time...
asked by 11.08.2016 / 12:34
2
answers

Obtain Maximum and minimum of an SQL Calculated query (2 columns). Server 2008

This query is the final part of a store procedure that manages to show me the results in this way: final_comparativo as ( select s.CeEmplazamiento, avg(s.Totales) TotalGeneral , s2.TotGral, @Mes as Mes f...
asked by 06.06.2017 / 23:54
1
answer

MySQL - Detail with a query

I have a database called messaging , consisting of 3 tables    Table - users Here the personal information of each user is stored. ______ _________ _________ ________ | idUs | nomUs | emailUs | codeUs | ────── ───────── ─────────...
asked by 18.01.2017 / 07:59